Skip to content

Commit

Permalink
update shares to usdc, add response fields, move proto
Browse files Browse the repository at this point in the history
  • Loading branch information
ttl33 committed Jun 29, 2024
1 parent 4e7e2c5 commit 4fc03b1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
6 changes: 0 additions & 6 deletions proto/dydxprotocol/vault/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ message QueryOwnerSharesRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

// OwnerShare is a type for owner shares in a vault.
message OwnerShare {
string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
NumShares shares = 2;
}

// QueryOwnerSharesResponse is a response type for the OwnerShares RPC method.
message QueryOwnerSharesResponse {
repeated OwnerShare owner_shares = 1;
Expand Down
38 changes: 29 additions & 9 deletions proto/dydxprotocol/vault/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgDepositToVault deposits the specified asset from the subaccout to the vault.
// MsgDepositToVault deposits the specified asset from the subaccout to the
// vault.
message MsgDepositToVault {
option (cosmos.msg.v1.signer) = "subaccount_id";

Expand All @@ -39,22 +40,41 @@ message MsgDepositToVault {
// MsgDepositToVaultResponse is the Msg/DepositToVault response type.
message MsgDepositToVaultResponse {}

// MsgWithdrawFromVault withdraws the specified amount of shares from the vault to the subaccount.
message MsgWithdrawFromVault {
// MsgWithdrawFromVault withdraws the specified amount of shares from the vault
// to the subaccount.
message MsgWithdrawFromVault {
option (cosmos.msg.v1.signer) = "subaccount_id";

// The vault to withdraw from.
VaultId vault_id = 1;

// The subaccount to withdraw to.
dydxprotocol.subaccounts.SubaccountId subaccount_id = 2;

// Number of shares to withdraw.
uint64 shares = 3;

// The target amount of quote quantums to withdraw.
// The target amount should account for slippage. For example:
// * user equity = $1020
// * target amount = $1000
// * slippage = $50
// then, the amount withdrawn is $970 (= 1020 - (1000 + 50 - 1020))
bytes target_quote_quantums = 3 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
];
}

// MsgWithdrawFromVaultResponse is the Msg/WithdrawFromVault response type.
message MsgWithdrawFromVaultResponse {}
message MsgWithdrawFromVaultResponse {
// Number of shares that have been redeemed as part of the withdrawal.
NumShares redeemed_shares = 1;

// Number of shares remaining after the withdrawal.
NumShares remaining_shares = 2;

// Number of shares for the vault after the withdrawal.
NumShares total_shares = 3;
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
Expand Down
6 changes: 6 additions & 0 deletions proto/dydxprotocol/vault/vault.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ message NumShares {
(gogoproto.nullable) = false
];
}

// OwnerShare is a type for owner shares in a vault.
message OwnerShare {
string owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
NumShares shares = 2;
}

0 comments on commit 4fc03b1

Please sign in to comment.