From 4fc03b15b1470a39e10e134218b0a3cb3998db02 Mon Sep 17 00:00:00 2001 From: Taehoon Lee <19664986+ttl33@users.noreply.github.com> Date: Sat, 29 Jun 2024 14:15:46 -0400 Subject: [PATCH] update shares to usdc, add response fields, move proto --- proto/dydxprotocol/vault/query.proto | 6 ----- proto/dydxprotocol/vault/tx.proto | 38 +++++++++++++++++++++------- proto/dydxprotocol/vault/vault.proto | 6 +++++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/proto/dydxprotocol/vault/query.proto b/proto/dydxprotocol/vault/query.proto index 0249eb75fe..3d8fa9c509 100644 --- a/proto/dydxprotocol/vault/query.proto +++ b/proto/dydxprotocol/vault/query.proto @@ -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; diff --git a/proto/dydxprotocol/vault/tx.proto b/proto/dydxprotocol/vault/tx.proto index 1872a868bd..967ac8ed98 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -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"; @@ -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 { diff --git a/proto/dydxprotocol/vault/vault.proto b/proto/dydxprotocol/vault/vault.proto index 75b7766ab8..215d5122e6 100644 --- a/proto/dydxprotocol/vault/vault.proto +++ b/proto/dydxprotocol/vault/vault.proto @@ -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; +}