diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts index 1d01a63e94..536b91c8b6 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts @@ -1,6 +1,5 @@ import { Params, ParamsSDKType } from "./params"; -import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType } from "./vault"; -import { OwnerShare, OwnerShareSDKType } from "./query"; +import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./vault"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** GenesisState defines `x/vault`'s genesis state. */ diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts index d2cf4d2f7d..51d512cc28 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts @@ -1,4 +1,4 @@ -import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType, NumShares, NumSharesSDKType } from "./vault"; +import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType, OwnerShare, OwnerShareSDKType } from "./vault"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; import { Params, ParamsSDKType } from "./params"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; @@ -86,18 +86,6 @@ export interface QueryOwnerSharesRequestSDKType { number: number; pagination?: PageRequestSDKType; } -/** OwnerShare is a type for owner shares in a vault. */ - -export interface OwnerShare { - owner: string; - shares?: NumShares; -} -/** OwnerShare is a type for owner shares in a vault. */ - -export interface OwnerShareSDKType { - owner: string; - shares?: NumSharesSDKType; -} /** QueryOwnerSharesResponse is a response type for the OwnerShares RPC method. */ export interface QueryOwnerSharesResponse { @@ -495,61 +483,6 @@ export const QueryOwnerSharesRequest = { }; -function createBaseOwnerShare(): OwnerShare { - return { - owner: "", - shares: undefined - }; -} - -export const OwnerShare = { - encode(message: OwnerShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.owner !== "") { - writer.uint32(10).string(message.owner); - } - - if (message.shares !== undefined) { - NumShares.encode(message.shares, writer.uint32(18).fork()).ldelim(); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OwnerShare { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOwnerShare(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.owner = reader.string(); - break; - - case 2: - message.shares = NumShares.decode(reader, reader.uint32()); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): OwnerShare { - const message = createBaseOwnerShare(); - message.owner = object.owner ?? ""; - message.shares = object.shares !== undefined && object.shares !== null ? NumShares.fromPartial(object.shares) : undefined; - return message; - } - -}; - function createBaseQueryOwnerSharesResponse(): QueryOwnerSharesResponse { return { ownerShares: [], diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts index 8a9bcbbbac..d86abb0830 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts @@ -1,11 +1,14 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +import { MsgDepositToVault, MsgDepositToVaultResponse, MsgWithdrawFromVault, MsgWithdrawFromVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** DepositToVault deposits funds into a vault. */ depositToVault(request: MsgDepositToVault): Promise; + /** WithdrawFromVault attempts to withdraw funds from a vault. */ + + withdrawFromVault(request: MsgWithdrawFromVault): Promise; /** UpdateParams updates the Params in state. */ updateParams(request: MsgUpdateParams): Promise; @@ -16,6 +19,7 @@ export class MsgClientImpl implements Msg { constructor(rpc: Rpc) { this.rpc = rpc; this.depositToVault = this.depositToVault.bind(this); + this.withdrawFromVault = this.withdrawFromVault.bind(this); this.updateParams = this.updateParams.bind(this); } @@ -25,6 +29,12 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositToVaultResponse.decode(new _m0.Reader(data))); } + withdrawFromVault(request: MsgWithdrawFromVault): Promise { + const data = MsgWithdrawFromVault.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.vault.Msg", "WithdrawFromVault", data); + return promise.then(data => MsgWithdrawFromVaultResponse.decode(new _m0.Reader(data))); + } + updateParams(request: MsgUpdateParams): Promise { const data = MsgUpdateParams.encode(request).finish(); const promise = this.rpc.request("dydxprotocol.vault.Msg", "UpdateParams", data); diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts index 1aed45a95f..bfb9fa6b67 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts @@ -1,9 +1,12 @@ -import { VaultId, VaultIdSDKType } from "./vault"; +import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType } from "./vault"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; -/** MsgDepositToVault is the Msg/DepositToVault request type. */ +/** + * MsgDepositToVault deposits the specified asset from the subaccount to the + * vault. + */ export interface MsgDepositToVault { /** The vault to deposit into. */ @@ -15,7 +18,10 @@ export interface MsgDepositToVault { quoteQuantums: Uint8Array; } -/** MsgDepositToVault is the Msg/DepositToVault request type. */ +/** + * MsgDepositToVault deposits the specified asset from the subaccount to the + * vault. + */ export interface MsgDepositToVaultSDKType { /** The vault to deposit into. */ @@ -33,6 +39,88 @@ export interface MsgDepositToVaultResponse {} /** MsgDepositToVaultResponse is the Msg/DepositToVault response type. */ export interface MsgDepositToVaultResponseSDKType {} +/** + * MsgWithdrawFromVault attempts to withdraw the specified target amount of + * asset from the vault to the subaccount. + */ + +export interface MsgWithdrawFromVault { + /** The vault to withdraw from. */ + vaultId?: VaultId; + /** + * The subaccount to withdraw to. + * The subaccount must own shares in the vault. + */ + + subaccountId?: SubaccountId; + /** + * The number of shares to redeem as quote quantums and withdraw. + * If the specified number exceeds the number of shares owned by the + * subaccount, then all the shares owned by the subaccount are redeemed and + * withdrawn. + */ + + shares?: NumShares; +} +/** + * MsgWithdrawFromVault attempts to withdraw the specified target amount of + * asset from the vault to the subaccount. + */ + +export interface MsgWithdrawFromVaultSDKType { + /** The vault to withdraw from. */ + vault_id?: VaultIdSDKType; + /** + * The subaccount to withdraw to. + * The subaccount must own shares in the vault. + */ + + subaccount_id?: SubaccountIdSDKType; + /** + * The number of shares to redeem as quote quantums and withdraw. + * If the specified number exceeds the number of shares owned by the + * subaccount, then all the shares owned by the subaccount are redeemed and + * withdrawn. + */ + + shares?: NumSharesSDKType; +} +/** MsgWithdrawFromVaultResponse is the Msg/WithdrawFromVault response type. */ + +export interface MsgWithdrawFromVaultResponse { + /** Number of owner shares that have been redeemed as part of the withdrawal. */ + redeemedShares?: NumShares; + /** Amount of equity (in quote quantums) that has been withdrawn. */ + + withdrawnQuoteQuantums: Uint8Array; + /** Number of owner shares remaining after the withdrawal. */ + + remainingShares?: NumShares; + /** Number of total vault shares after the withdrawal. */ + + totalVaultShares?: NumShares; + /** Vault equity (in quote quantums) after the withdrawal. */ + + totalVaultEquity: Uint8Array; +} +/** MsgWithdrawFromVaultResponse is the Msg/WithdrawFromVault response type. */ + +export interface MsgWithdrawFromVaultResponseSDKType { + /** Number of owner shares that have been redeemed as part of the withdrawal. */ + redeemed_shares?: NumSharesSDKType; + /** Amount of equity (in quote quantums) that has been withdrawn. */ + + withdrawn_quote_quantums: Uint8Array; + /** Number of owner shares remaining after the withdrawal. */ + + remaining_shares?: NumSharesSDKType; + /** Number of total vault shares after the withdrawal. */ + + total_vault_shares?: NumSharesSDKType; + /** Vault equity (in quote quantums) after the withdrawal. */ + + total_vault_equity: Uint8Array; +} /** MsgUpdateParams is the Msg/UpdateParams request type. */ export interface MsgUpdateParams { @@ -155,6 +243,156 @@ export const MsgDepositToVaultResponse = { }; +function createBaseMsgWithdrawFromVault(): MsgWithdrawFromVault { + return { + vaultId: undefined, + subaccountId: undefined, + shares: undefined + }; +} + +export const MsgWithdrawFromVault = { + encode(message: MsgWithdrawFromVault, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.vaultId !== undefined) { + VaultId.encode(message.vaultId, writer.uint32(10).fork()).ldelim(); + } + + if (message.subaccountId !== undefined) { + SubaccountId.encode(message.subaccountId, writer.uint32(18).fork()).ldelim(); + } + + if (message.shares !== undefined) { + NumShares.encode(message.shares, writer.uint32(26).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawFromVault { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawFromVault(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.vaultId = VaultId.decode(reader, reader.uint32()); + break; + + case 2: + message.subaccountId = SubaccountId.decode(reader, reader.uint32()); + break; + + case 3: + message.shares = NumShares.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgWithdrawFromVault { + const message = createBaseMsgWithdrawFromVault(); + message.vaultId = object.vaultId !== undefined && object.vaultId !== null ? VaultId.fromPartial(object.vaultId) : undefined; + message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; + message.shares = object.shares !== undefined && object.shares !== null ? NumShares.fromPartial(object.shares) : undefined; + return message; + } + +}; + +function createBaseMsgWithdrawFromVaultResponse(): MsgWithdrawFromVaultResponse { + return { + redeemedShares: undefined, + withdrawnQuoteQuantums: new Uint8Array(), + remainingShares: undefined, + totalVaultShares: undefined, + totalVaultEquity: new Uint8Array() + }; +} + +export const MsgWithdrawFromVaultResponse = { + encode(message: MsgWithdrawFromVaultResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.redeemedShares !== undefined) { + NumShares.encode(message.redeemedShares, writer.uint32(10).fork()).ldelim(); + } + + if (message.withdrawnQuoteQuantums.length !== 0) { + writer.uint32(18).bytes(message.withdrawnQuoteQuantums); + } + + if (message.remainingShares !== undefined) { + NumShares.encode(message.remainingShares, writer.uint32(26).fork()).ldelim(); + } + + if (message.totalVaultShares !== undefined) { + NumShares.encode(message.totalVaultShares, writer.uint32(34).fork()).ldelim(); + } + + if (message.totalVaultEquity.length !== 0) { + writer.uint32(42).bytes(message.totalVaultEquity); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawFromVaultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawFromVaultResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.redeemedShares = NumShares.decode(reader, reader.uint32()); + break; + + case 2: + message.withdrawnQuoteQuantums = reader.bytes(); + break; + + case 3: + message.remainingShares = NumShares.decode(reader, reader.uint32()); + break; + + case 4: + message.totalVaultShares = NumShares.decode(reader, reader.uint32()); + break; + + case 5: + message.totalVaultEquity = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgWithdrawFromVaultResponse { + const message = createBaseMsgWithdrawFromVaultResponse(); + message.redeemedShares = object.redeemedShares !== undefined && object.redeemedShares !== null ? NumShares.fromPartial(object.redeemedShares) : undefined; + message.withdrawnQuoteQuantums = object.withdrawnQuoteQuantums ?? new Uint8Array(); + message.remainingShares = object.remainingShares !== undefined && object.remainingShares !== null ? NumShares.fromPartial(object.remainingShares) : undefined; + message.totalVaultShares = object.totalVaultShares !== undefined && object.totalVaultShares !== null ? NumShares.fromPartial(object.totalVaultShares) : undefined; + message.totalVaultEquity = object.totalVaultEquity ?? new Uint8Array(); + return message; + } + +}; + function createBaseMsgUpdateParams(): MsgUpdateParams { return { authority: "", diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts index a9a7696cef..eebc9295a6 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts @@ -79,6 +79,18 @@ export interface NumSharesSDKType { /** Number of shares. */ num_shares: Uint8Array; } +/** OwnerShare is a type for owner shares in a vault. */ + +export interface OwnerShare { + owner: string; + shares?: NumShares; +} +/** OwnerShare is a type for owner shares in a vault. */ + +export interface OwnerShareSDKType { + owner: string; + shares?: NumSharesSDKType; +} function createBaseVaultId(): VaultId { return { @@ -178,4 +190,59 @@ export const NumShares = { return message; } +}; + +function createBaseOwnerShare(): OwnerShare { + return { + owner: "", + shares: undefined + }; +} + +export const OwnerShare = { + encode(message: OwnerShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + + if (message.shares !== undefined) { + NumShares.encode(message.shares, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OwnerShare { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOwnerShare(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + + case 2: + message.shares = NumShares.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): OwnerShare { + const message = createBaseOwnerShare(); + message.owner = object.owner ?? ""; + message.shares = object.shares !== undefined && object.shares !== null ? NumShares.fromPartial(object.shares) : undefined; + return message; + } + }; \ No newline at end of file diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index 541a0f9fe6..6f3d07b2d3 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -3,7 +3,6 @@ package dydxprotocol.vault; import "gogoproto/gogo.proto"; import "dydxprotocol/vault/params.proto"; -import "dydxprotocol/vault/query.proto"; import "dydxprotocol/vault/vault.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; diff --git a/proto/dydxprotocol/vault/query.proto b/proto/dydxprotocol/vault/query.proto index 0249eb75fe..50f1c51635 100644 --- a/proto/dydxprotocol/vault/query.proto +++ b/proto/dydxprotocol/vault/query.proto @@ -4,7 +4,6 @@ package dydxprotocol.vault; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos_proto/cosmos.proto"; import "dydxprotocol/subaccounts/subaccount.proto"; import "dydxprotocol/vault/params.proto"; import "dydxprotocol/vault/vault.proto"; @@ -82,12 +81,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 9f5b77b146..08915b5d3b 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -14,12 +14,21 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; service Msg { // DepositToVault deposits funds into a vault. rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); + + // WithdrawFromVault attempts to withdraw funds from a vault. + rpc WithdrawFromVault(MsgWithdrawFromVault) + returns (MsgWithdrawFromVaultResponse); + // UpdateParams updates the Params in state. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgDepositToVault is the Msg/DepositToVault request type. +// MsgDepositToVault deposits the specified asset from the subaccount to the +// vault. message MsgDepositToVault { + // This annotation enforces that the tx signer is the owner specified in + // subaccount_id. Therefore, this enforces that only the owner of the + // subaccount can deposit into the vault using that subaccount. option (cosmos.msg.v1.signer) = "subaccount_id"; // The vault to deposit into. @@ -39,6 +48,54 @@ message MsgDepositToVault { // MsgDepositToVaultResponse is the Msg/DepositToVault response type. message MsgDepositToVaultResponse {} +// MsgWithdrawFromVault attempts to withdraw the specified target amount of +// asset from the vault to the subaccount. +message MsgWithdrawFromVault { + // This annotation enforces that the tx signer is the owner specified in + // subaccount_id. Therefore, this enforces that only the owner of the + // subaccount can withdraw from the vault equity allocated to the subaccount. + option (cosmos.msg.v1.signer) = "subaccount_id"; + + // The vault to withdraw from. + VaultId vault_id = 1; + + // The subaccount to withdraw to. + // The subaccount must own shares in the vault. + dydxprotocol.subaccounts.SubaccountId subaccount_id = 2; + + // The number of shares to redeem as quote quantums and withdraw. + // If the specified number exceeds the number of shares owned by the + // subaccount, then all the shares owned by the subaccount are redeemed and + // withdrawn. + NumShares shares = 3; +} + +// MsgWithdrawFromVaultResponse is the Msg/WithdrawFromVault response type. +message MsgWithdrawFromVaultResponse { + // Number of owner shares that have been redeemed as part of the withdrawal. + NumShares redeemed_shares = 1; + + // Amount of equity (in quote quantums) that has been withdrawn. + bytes withdrawn_quote_quantums = 2 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; + + // Number of owner shares remaining after the withdrawal. + NumShares remaining_shares = 3; + + // Number of total vault shares after the withdrawal. + NumShares total_vault_shares = 4; + + // Vault equity (in quote quantums) after the withdrawal. + bytes total_vault_equity = 5 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; +} + // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { // Authority is the address that controls the module. diff --git a/proto/dydxprotocol/vault/vault.proto b/proto/dydxprotocol/vault/vault.proto index 75b7766ab8..e532ee07db 100644 --- a/proto/dydxprotocol/vault/vault.proto +++ b/proto/dydxprotocol/vault/vault.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package dydxprotocol.vault; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; @@ -32,3 +33,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; +} diff --git a/protocol/app/module/interface_registry.go b/protocol/app/module/interface_registry.go index 3246180a27..e2b59a98e5 100644 --- a/protocol/app/module/interface_registry.go +++ b/protocol/app/module/interface_registry.go @@ -95,6 +95,9 @@ func NewInterfaceRegistry(addrPrefix string, valAddrPrefix string) (types.Interf "dydxprotocol.vault.MsgDepositToVault": getLegacyMsgSignerFn( []string{"subaccount_id", "owner"}, ), + "dydxprotocol.vault.MsgWithdrawFromVault": getLegacyMsgSignerFn( + []string{"subaccount_id", "owner"}, + ), // App injected messages have no signers. "dydxprotocol.bridge.MsgAcknowledgeBridges": noSigners, diff --git a/protocol/app/msgs/all_msgs.go b/protocol/app/msgs/all_msgs.go index 1e50883461..28e7c9dd3d 100644 --- a/protocol/app/msgs/all_msgs.go +++ b/protocol/app/msgs/all_msgs.go @@ -239,10 +239,12 @@ var ( "/dydxprotocol.stats.MsgUpdateParamsResponse": {}, // vault - "/dydxprotocol.vault.MsgDepositToVault": {}, - "/dydxprotocol.vault.MsgDepositToVaultResponse": {}, - "/dydxprotocol.vault.MsgUpdateParams": {}, - "/dydxprotocol.vault.MsgUpdateParamsResponse": {}, + "/dydxprotocol.vault.MsgDepositToVault": {}, + "/dydxprotocol.vault.MsgDepositToVaultResponse": {}, + "/dydxprotocol.vault.MsgWithdrawFromVault": {}, + "/dydxprotocol.vault.MsgWithdrawFromVaultResponse": {}, + "/dydxprotocol.vault.MsgUpdateParams": {}, + "/dydxprotocol.vault.MsgUpdateParamsResponse": {}, // vest "/dydxprotocol.vest.MsgSetVestEntry": {}, diff --git a/protocol/app/msgs/normal_msgs.go b/protocol/app/msgs/normal_msgs.go index 7808cf1c8e..fa0c39c63f 100644 --- a/protocol/app/msgs/normal_msgs.go +++ b/protocol/app/msgs/normal_msgs.go @@ -236,7 +236,9 @@ var ( "/dydxprotocol.sending.MsgWithdrawFromSubaccountResponse": nil, // vault - "/dydxprotocol.vault.MsgDepositToVault": &vault.MsgDepositToVault{}, - "/dydxprotocol.vault.MsgDepositToVaultResponse": nil, + "/dydxprotocol.vault.MsgDepositToVault": &vault.MsgDepositToVault{}, + "/dydxprotocol.vault.MsgDepositToVaultResponse": nil, + "/dydxprotocol.vault.MsgWithdrawFromVault": &vault.MsgWithdrawFromVault{}, + "/dydxprotocol.vault.MsgWithdrawFromVaultResponse": nil, } ) diff --git a/protocol/app/msgs/normal_msgs_test.go b/protocol/app/msgs/normal_msgs_test.go index c5bba587c3..2aae5dbd9e 100644 --- a/protocol/app/msgs/normal_msgs_test.go +++ b/protocol/app/msgs/normal_msgs_test.go @@ -141,6 +141,8 @@ func TestNormalMsgs_Key(t *testing.T) { // vault "/dydxprotocol.vault.MsgDepositToVault", "/dydxprotocol.vault.MsgDepositToVaultResponse", + "/dydxprotocol.vault.MsgWithdrawFromVault", + "/dydxprotocol.vault.MsgWithdrawFromVaultResponse", // ibc application module: ICA "/ibc.applications.interchain_accounts.v1.InterchainAccount", diff --git a/protocol/testutil/encoding/utils.go b/protocol/testutil/encoding/utils.go index 83a423be70..5b36ef5ea5 100644 --- a/protocol/testutil/encoding/utils.go +++ b/protocol/testutil/encoding/utils.go @@ -93,6 +93,7 @@ func GetTestEncodingCfg() testutil.TestEncodingConfig { // Vault. &vaulttypes.MsgDepositToVault{}, + &vaulttypes.MsgWithdrawFromVault{}, } for _, msg := range msgInterfacesToRegister { diff --git a/protocol/x/vault/keeper/msg_server_withdraw_from_vault.go b/protocol/x/vault/keeper/msg_server_withdraw_from_vault.go new file mode 100644 index 0000000000..f9a0b5edca --- /dev/null +++ b/protocol/x/vault/keeper/msg_server_withdraw_from_vault.go @@ -0,0 +1,15 @@ +package keeper + +import ( + "context" + + "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" +) + +// TODO: implement +func (k msgServer) WithdrawFromVault( + goCtx context.Context, + msg *types.MsgWithdrawFromVault, +) (*types.MsgWithdrawFromVaultResponse, error) { + return &types.MsgWithdrawFromVaultResponse{}, nil +} diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 7475e9626c..b532ef771d 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -150,28 +150,27 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescriptor_4be4a747b209e41c) } var fileDescriptor_4be4a747b209e41c = []byte{ - // 324 bytes of a gzipped FileDescriptorProto + // 316 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x0b, 0x0b, 0x09, 0x21, 0xab, 0xd0, 0x03, 0xab, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x8b, 0xe9, 0x83, 0x58, 0x10, 0x95, 0x52, 0xf2, 0x58, - 0xcc, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0x25, 0x25, 0x87, 0x45, 0x41, 0x61, 0x69, 0x6a, - 0x51, 0x25, 0x1e, 0x79, 0x30, 0x09, 0x91, 0x57, 0xaa, 0xe6, 0xe2, 0x71, 0x87, 0xb8, 0x2d, 0xb8, - 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x82, 0x8b, 0x0d, 0x62, 0xbe, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, - 0x91, 0x94, 0x1e, 0xa6, 0x5b, 0xf5, 0x02, 0xc0, 0x2a, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, - 0x82, 0xaa, 0x17, 0x32, 0xe4, 0x62, 0x03, 0xcb, 0x16, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, - 0x49, 0x62, 0xd3, 0x19, 0x06, 0x22, 0x83, 0xa0, 0x0a, 0x95, 0x8e, 0x30, 0x72, 0xb1, 0x82, 0x45, - 0x84, 0xcc, 0xb8, 0x38, 0xc0, 0x62, 0xf1, 0x99, 0x29, 0x50, 0x8b, 0xa5, 0x71, 0x6a, 0xf7, 0x4c, - 0x09, 0x62, 0x2f, 0x83, 0x30, 0x84, 0x1c, 0xb8, 0x78, 0x4a, 0xf2, 0x4b, 0x12, 0x73, 0xe2, 0x8b, - 0x33, 0x12, 0x8b, 0x52, 0x41, 0x56, 0x83, 0xf4, 0xca, 0x62, 0xd3, 0xeb, 0x57, 0x9a, 0x1b, 0x0c, - 0x56, 0x14, 0xc4, 0x0d, 0xd6, 0x02, 0xe1, 0x08, 0x39, 0x72, 0xf1, 0xe4, 0x97, 0xe7, 0xa5, 0x16, - 0xc1, 0x4c, 0x60, 0x06, 0x3b, 0x5e, 0x0e, 0x9b, 0x09, 0xfe, 0x20, 0x75, 0x60, 0x6d, 0x41, 0xdc, - 0xf9, 0x70, 0x76, 0xb1, 0x53, 0xe0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, - 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, - 0x99, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa3, 0x46, 0x84, 0x89, - 0x6e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x3e, 0x5c, 0xa4, 0x02, 0x1a, 0x39, 0x25, 0x95, 0x05, 0xa9, - 0xc5, 0x49, 0x6c, 0x60, 0x71, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x13, 0x40, 0x00, - 0x4c, 0x02, 0x00, 0x00, + 0xcc, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0x25, 0x25, 0x87, 0x45, 0x01, 0x98, 0x84, 0xc8, + 0x2b, 0x55, 0x73, 0xf1, 0xb8, 0x43, 0xec, 0x0e, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xb2, 0xe0, 0x62, + 0x83, 0xe8, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0xc3, 0x74, 0x8b, 0x5e, 0x00, + 0x58, 0x85, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xf5, 0x42, 0x86, 0x5c, 0x6c, 0x60, + 0xd9, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x49, 0x6c, 0x3a, 0xc3, 0x40, 0x64, 0x10, + 0x54, 0xa1, 0xd2, 0x11, 0x46, 0x2e, 0x56, 0xb0, 0x88, 0x90, 0x19, 0x17, 0x07, 0x58, 0x2c, 0x3e, + 0x33, 0x05, 0x6a, 0xb1, 0x34, 0x4e, 0xed, 0x9e, 0x29, 0x41, 0xec, 0x65, 0x10, 0x86, 0x90, 0x03, + 0x17, 0x4f, 0x49, 0x7e, 0x49, 0x62, 0x4e, 0x7c, 0x71, 0x46, 0x62, 0x51, 0x2a, 0xc8, 0x6a, 0x90, + 0x5e, 0x59, 0x6c, 0x7a, 0xfd, 0x4a, 0x73, 0x83, 0xc1, 0x8a, 0x82, 0xb8, 0xc1, 0x5a, 0x20, 0x1c, + 0x21, 0x47, 0x2e, 0x9e, 0xfc, 0xf2, 0xbc, 0xd4, 0x22, 0x98, 0x09, 0xcc, 0x60, 0xc7, 0xcb, 0x61, + 0x33, 0xc1, 0x1f, 0xa4, 0x0e, 0xac, 0x2d, 0x88, 0x3b, 0x1f, 0xce, 0x2e, 0x76, 0x0a, 0x3c, 0xf1, + 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xf3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xd4, 0x88, 0x30, 0xd1, 0x4d, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x87, + 0x8b, 0x54, 0x40, 0x23, 0xa7, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x2c, 0x6e, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0x82, 0xe6, 0xbf, 0x21, 0x2c, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/protocol/x/vault/types/query.pb.go b/protocol/x/vault/types/query.pb.go index d8d1991754..3abfb97bf7 100644 --- a/protocol/x/vault/types/query.pb.go +++ b/protocol/x/vault/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -390,59 +389,6 @@ func (m *QueryOwnerSharesRequest) GetPagination() *query.PageRequest { return nil } -// OwnerShare is a type for owner shares in a vault. -type OwnerShare struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - Shares *NumShares `protobuf:"bytes,2,opt,name=shares,proto3" json:"shares,omitempty"` -} - -func (m *OwnerShare) Reset() { *m = OwnerShare{} } -func (m *OwnerShare) String() string { return proto.CompactTextString(m) } -func (*OwnerShare) ProtoMessage() {} -func (*OwnerShare) Descriptor() ([]byte, []int) { - return fileDescriptor_478fb8dc0ff21ea6, []int{7} -} -func (m *OwnerShare) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OwnerShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OwnerShare.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *OwnerShare) XXX_Merge(src proto.Message) { - xxx_messageInfo_OwnerShare.Merge(m, src) -} -func (m *OwnerShare) XXX_Size() int { - return m.Size() -} -func (m *OwnerShare) XXX_DiscardUnknown() { - xxx_messageInfo_OwnerShare.DiscardUnknown(m) -} - -var xxx_messageInfo_OwnerShare proto.InternalMessageInfo - -func (m *OwnerShare) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *OwnerShare) GetShares() *NumShares { - if m != nil { - return m.Shares - } - return nil -} - // QueryOwnerSharesResponse is a response type for the OwnerShares RPC method. type QueryOwnerSharesResponse struct { OwnerShares []*OwnerShare `protobuf:"bytes,1,rep,name=owner_shares,json=ownerShares,proto3" json:"owner_shares,omitempty"` @@ -453,7 +399,7 @@ func (m *QueryOwnerSharesResponse) Reset() { *m = QueryOwnerSharesRespon func (m *QueryOwnerSharesResponse) String() string { return proto.CompactTextString(m) } func (*QueryOwnerSharesResponse) ProtoMessage() {} func (*QueryOwnerSharesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_478fb8dc0ff21ea6, []int{8} + return fileDescriptor_478fb8dc0ff21ea6, []int{7} } func (m *QueryOwnerSharesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -504,66 +450,61 @@ func init() { proto.RegisterType((*QueryAllVaultsRequest)(nil), "dydxprotocol.vault.QueryAllVaultsRequest") proto.RegisterType((*QueryAllVaultsResponse)(nil), "dydxprotocol.vault.QueryAllVaultsResponse") proto.RegisterType((*QueryOwnerSharesRequest)(nil), "dydxprotocol.vault.QueryOwnerSharesRequest") - proto.RegisterType((*OwnerShare)(nil), "dydxprotocol.vault.OwnerShare") proto.RegisterType((*QueryOwnerSharesResponse)(nil), "dydxprotocol.vault.QueryOwnerSharesResponse") } func init() { proto.RegisterFile("dydxprotocol/vault/query.proto", fileDescriptor_478fb8dc0ff21ea6) } var fileDescriptor_478fb8dc0ff21ea6 = []byte{ - // 818 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x6f, 0x13, 0x49, - 0x14, 0xf6, 0xc6, 0x3f, 0xee, 0x32, 0x76, 0x4e, 0xba, 0xb9, 0x5c, 0xce, 0x71, 0x72, 0x1b, 0x67, - 0x25, 0x12, 0x27, 0x21, 0xbb, 0xd8, 0x80, 0x48, 0x81, 0x10, 0x71, 0x01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 0x3a, 0x51, 0x95, 0x1f, 0x27, 0xaa, 0xf2, 0xfa, 0x54, 0x8d, 0x1c, 0x9d, - 0xaa, 0x91, 0x6f, 0xa7, 0x6a, 0xe4, 0xd1, 0x8d, 0xd1, 0x5f, 0xe7, 0x3d, 0x99, 0x89, 0x3f, 0xd2, - 0x95, 0x04, 0x8f, 0x5f, 0xfd, 0x15, 0x00, 0x00, 0xff, 0xff, 0xba, 0xc6, 0x80, 0x08, 0xe6, 0x08, - 0x00, 0x00, + // 758 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x4f, 0x13, 0x4d, + 0x18, 0xee, 0xd0, 0xd2, 0xef, 0x63, 0x5a, 0xbe, 0xe4, 0x1b, 0x11, 0x6b, 0xc1, 0xa5, 0x6c, 0x22, + 0x14, 0xd0, 0x1d, 0x5b, 0x4d, 0xe4, 0x60, 0x8c, 0x70, 0x50, 0x39, 0x01, 0x8b, 0xf1, 0xe0, 0x41, + 0x9c, 0xb6, 0x63, 0xd9, 0x64, 0xbb, 0xb3, 0xec, 0xce, 0x56, 0x2a, 0xe1, 0x62, 0xe2, 0xc1, 0x9b, + 0xd1, 0xbf, 0x40, 0x0f, 0x9e, 0xfc, 0x1f, 0xbc, 0x72, 0x24, 0xf1, 0x62, 0x3c, 0x10, 0x03, 0xfe, + 0x21, 0x66, 0x67, 0x86, 0x76, 0xfb, 0x63, 0x43, 0x63, 0xb8, 0x34, 0xd3, 0x77, 0xde, 0x79, 0x9e, + 0x67, 0xdf, 0xe7, 0x7d, 0x5f, 0xa8, 0xd5, 0x5a, 0xb5, 0x3d, 0xd7, 0x63, 0x9c, 0x55, 0x99, 0x8d, + 0x9b, 0x24, 0xb0, 0x39, 0xde, 0x0d, 0xa8, 0xd7, 0x32, 0x44, 0x10, 0xa1, 0xe8, 0xbd, 0x21, 0xee, + 0xf3, 0x13, 0x75, 0x56, 0x67, 0x22, 0x86, 0xc3, 0x93, 0xcc, 0xcc, 0x4f, 0xd7, 0x19, 0xab, 0xdb, + 0x14, 0x13, 0xd7, 0xc2, 0xc4, 0x71, 0x18, 0x27, 0xdc, 0x62, 0x8e, 0xaf, 0x6e, 0x17, 0xab, 0xcc, + 0x6f, 0x30, 0x1f, 0x57, 0x88, 0x4f, 0x25, 0x01, 0x6e, 0x96, 0x2a, 0x94, 0x93, 0x12, 0x76, 0x49, + 0xdd, 0x72, 0x44, 0xb2, 0xca, 0x5d, 0xe8, 0xd2, 0xe4, 0x07, 0x15, 0x52, 0xad, 0xb2, 0xc0, 0xe1, + 0x7e, 0xe4, 0xac, 0x52, 0x67, 0x06, 0xc8, 0x77, 0x89, 0x47, 0x1a, 0x67, 0xbc, 0x83, 0xbe, 0x4f, + 0xfc, 0xca, 0x7b, 0x7d, 0x02, 0xa2, 0xcd, 0x50, 0xcd, 0x86, 0x78, 0x64, 0xd2, 0xdd, 0x80, 0xfa, + 0x5c, 0x5f, 0x87, 0x97, 0xba, 0xa2, 0xbe, 0xcb, 0x1c, 0x9f, 0xa2, 0x65, 0x98, 0x96, 0xe0, 0x39, + 0x50, 0x00, 0xc5, 0x4c, 0x39, 0x6f, 0xf4, 0x57, 0xc7, 0x90, 0x6f, 0x56, 0x53, 0x87, 0xc7, 0x33, + 0x09, 0x53, 0xe5, 0xeb, 0xcf, 0xe1, 0xff, 0x02, 0xf0, 0x69, 0x98, 0xa2, 0x58, 0x50, 0x09, 0xa6, + 0x78, 0xcb, 0xa5, 0x02, 0xec, 0xbf, 0xf2, 0xb5, 0x41, 0x60, 0x22, 0xff, 0x49, 0xcb, 0xa5, 0xa6, + 0x48, 0x45, 0x93, 0x30, 0xed, 0x04, 0x8d, 0x0a, 0xf5, 0x72, 0x23, 0x05, 0x50, 0x1c, 0x37, 0xd5, + 0x3f, 0xfd, 0x43, 0x52, 0x7d, 0x87, 0x22, 0x50, 0x82, 0xef, 0xc1, 0x7f, 0x05, 0xce, 0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85, 0xef, 0x9f, 0x8a, + 0xfc, 0x8d, 0xe1, 0x92, 0x95, 0x9a, 0x65, 0xa1, 0xa6, 0x8c, 0x6e, 0x0d, 0x52, 0x13, 0xed, 0xd6, + 0xde, 0x62, 0xad, 0x6e, 0x1e, 0x9e, 0x68, 0xe0, 0xe8, 0x44, 0x03, 0xbf, 0x4e, 0x34, 0xf0, 0xfe, + 0x54, 0x4b, 0x1c, 0x9d, 0x6a, 0x89, 0x1f, 0xa7, 0x5a, 0xe2, 0xd9, 0xdd, 0xe1, 0x17, 0xe5, 0x9e, + 0x62, 0x12, 0xfb, 0xb2, 0x92, 0x16, 0xf1, 0xdb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xd1, + 0x41, 0x13, 0x56, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1048,48 +989,6 @@ func (m *QueryOwnerSharesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *OwnerShare) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OwnerShare) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OwnerShare) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Shares != nil { - { - size, err := m.Shares.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *QueryOwnerSharesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1256,23 +1155,6 @@ func (m *QueryOwnerSharesRequest) Size() (n int) { return n } -func (m *OwnerShare) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Shares != nil { - l = m.Shares.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - func (m *QueryOwnerSharesResponse) Size() (n int) { if m == nil { return 0 @@ -2050,124 +1932,6 @@ func (m *QueryOwnerSharesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *OwnerShare) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OwnerShare: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OwnerShare: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Shares == nil { - m.Shares = &NumShares{} - } - if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryOwnerSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/vault/types/tx.pb.go b/protocol/x/vault/types/tx.pb.go index 8aa97ebfbc..0d8c3bb21b 100644 --- a/protocol/x/vault/types/tx.pb.go +++ b/protocol/x/vault/types/tx.pb.go @@ -32,7 +32,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgDepositToVault is the Msg/DepositToVault request type. +// MsgDepositToVault deposits the specified asset from the subaccount to the +// vault. type MsgDepositToVault struct { // The vault to deposit into. VaultId *VaultId `protobuf:"bytes,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` @@ -126,6 +127,143 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo +// MsgWithdrawFromVault attempts to withdraw the specified target amount of +// asset from the vault to the subaccount. +type MsgWithdrawFromVault struct { + // The vault to withdraw from. + VaultId *VaultId `protobuf:"bytes,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id,omitempty"` + // The subaccount to withdraw to. + // The subaccount must own shares in the vault. + SubaccountId *types.SubaccountId `protobuf:"bytes,2,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` + // The number of shares to redeem as quote quantums and withdraw. + // If the specified number exceeds the number of shares owned by the + // subaccount, then all the shares owned by the subaccount are redeemed and + // withdrawn. + Shares *NumShares `protobuf:"bytes,3,opt,name=shares,proto3" json:"shares,omitempty"` +} + +func (m *MsgWithdrawFromVault) Reset() { *m = MsgWithdrawFromVault{} } +func (m *MsgWithdrawFromVault) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawFromVault) ProtoMessage() {} +func (*MsgWithdrawFromVault) Descriptor() ([]byte, []int) { + return fileDescriptor_ced574c6017ce006, []int{2} +} +func (m *MsgWithdrawFromVault) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawFromVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawFromVault.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawFromVault) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawFromVault.Merge(m, src) +} +func (m *MsgWithdrawFromVault) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawFromVault) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawFromVault.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawFromVault proto.InternalMessageInfo + +func (m *MsgWithdrawFromVault) GetVaultId() *VaultId { + if m != nil { + return m.VaultId + } + return nil +} + +func (m *MsgWithdrawFromVault) GetSubaccountId() *types.SubaccountId { + if m != nil { + return m.SubaccountId + } + return nil +} + +func (m *MsgWithdrawFromVault) GetShares() *NumShares { + if m != nil { + return m.Shares + } + return nil +} + +// MsgWithdrawFromVaultResponse is the Msg/WithdrawFromVault response type. +type MsgWithdrawFromVaultResponse struct { + // Number of owner shares that have been redeemed as part of the withdrawal. + RedeemedShares *NumShares `protobuf:"bytes,1,opt,name=redeemed_shares,json=redeemedShares,proto3" json:"redeemed_shares,omitempty"` + // Amount of equity (in quote quantums) that has been withdrawn. + WithdrawnQuoteQuantums github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=withdrawn_quote_quantums,json=withdrawnQuoteQuantums,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"withdrawn_quote_quantums"` + // Number of owner shares remaining after the withdrawal. + RemainingShares *NumShares `protobuf:"bytes,3,opt,name=remaining_shares,json=remainingShares,proto3" json:"remaining_shares,omitempty"` + // Number of total vault shares after the withdrawal. + TotalVaultShares *NumShares `protobuf:"bytes,4,opt,name=total_vault_shares,json=totalVaultShares,proto3" json:"total_vault_shares,omitempty"` + // Vault equity (in quote quantums) after the withdrawal. + TotalVaultEquity github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,5,opt,name=total_vault_equity,json=totalVaultEquity,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"total_vault_equity"` +} + +func (m *MsgWithdrawFromVaultResponse) Reset() { *m = MsgWithdrawFromVaultResponse{} } +func (m *MsgWithdrawFromVaultResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawFromVaultResponse) ProtoMessage() {} +func (*MsgWithdrawFromVaultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ced574c6017ce006, []int{3} +} +func (m *MsgWithdrawFromVaultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawFromVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawFromVaultResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawFromVaultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawFromVaultResponse.Merge(m, src) +} +func (m *MsgWithdrawFromVaultResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawFromVaultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawFromVaultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawFromVaultResponse proto.InternalMessageInfo + +func (m *MsgWithdrawFromVaultResponse) GetRedeemedShares() *NumShares { + if m != nil { + return m.RedeemedShares + } + return nil +} + +func (m *MsgWithdrawFromVaultResponse) GetRemainingShares() *NumShares { + if m != nil { + return m.RemainingShares + } + return nil +} + +func (m *MsgWithdrawFromVaultResponse) GetTotalVaultShares() *NumShares { + if m != nil { + return m.TotalVaultShares + } + return nil +} + // MsgUpdateParams is the Msg/UpdateParams request type. type MsgUpdateParams struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` @@ -137,7 +275,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{2} + return fileDescriptor_ced574c6017ce006, []int{4} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -188,7 +326,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{3} + return fileDescriptor_ced574c6017ce006, []int{5} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -220,6 +358,8 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgDepositToVault)(nil), "dydxprotocol.vault.MsgDepositToVault") proto.RegisterType((*MsgDepositToVaultResponse)(nil), "dydxprotocol.vault.MsgDepositToVaultResponse") + proto.RegisterType((*MsgWithdrawFromVault)(nil), "dydxprotocol.vault.MsgWithdrawFromVault") + proto.RegisterType((*MsgWithdrawFromVaultResponse)(nil), "dydxprotocol.vault.MsgWithdrawFromVaultResponse") proto.RegisterType((*MsgUpdateParams)(nil), "dydxprotocol.vault.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateParamsResponse") } @@ -227,39 +367,50 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/tx.proto", fileDescriptor_ced574c6017ce006) } var fileDescriptor_ced574c6017ce006 = []byte{ - // 504 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x5b, 0x54, 0xe8, 0x92, 0x06, 0xb1, 0xaa, 0xd4, 0xc4, 0x91, 0x9c, 0x2a, 0x08, 0x54, - 0x40, 0xb1, 0x45, 0x41, 0x05, 0xf5, 0x04, 0x11, 0x07, 0x22, 0x14, 0x89, 0x3a, 0xc0, 0x81, 0x4b, - 0xd8, 0x78, 0x17, 0xc7, 0x52, 0xec, 0x75, 0x3d, 0xeb, 0x28, 0xe1, 0xc8, 0x17, 0x20, 0x71, 0xe6, - 0x1f, 0x38, 0xf0, 0x11, 0xbd, 0x51, 0x71, 0x42, 0x1c, 0x2a, 0x94, 0x1c, 0xf8, 0x0d, 0xe4, 0xb5, - 0xdd, 0xd8, 0x89, 0x91, 0x72, 0x49, 0x66, 0x67,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d, 0x72, 0x36, 0xd3, 0x94, 0xf3, 0x99, 0xa6, 0xfc, 0x99, 0x69, 0xca, - 0xe7, 0xb9, 0x56, 0x3a, 0x9f, 0x6b, 0xa5, 0x5f, 0x73, 0xad, 0xf4, 0xee, 0xf1, 0xfa, 0xeb, 0x31, - 0x49, 0xbf, 0xef, 0x68, 0x4b, 0x06, 0x5b, 0x32, 0xff, 0xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x67, 0x36, 0x31, 0xb6, 0x02, 0x04, 0x00, 0x00, + // 679 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0x16, 0x7e, 0xfc, 0x64, 0x80, 0x02, 0x13, 0x22, 0xa5, 0xe8, 0x42, 0x6a, 0x34, 0xa8, + 0x61, 0x57, 0x51, 0xd1, 0x70, 0xd2, 0x46, 0x09, 0x84, 0xd4, 0xc8, 0xd6, 0x3f, 0x89, 0x97, 0x75, + 0xda, 0x19, 0xb7, 0x9b, 0x74, 0x77, 0xca, 0xce, 0x6c, 0x01, 0x8f, 0x7c, 0x02, 0x13, 0xcf, 0x7e, + 0x07, 0x0f, 0x7e, 0x00, 0x8f, 0x1c, 0x89, 0x27, 0xe3, 0x81, 0x18, 0x48, 0xf4, 0x3b, 0x78, 0x32, + 0x3b, 0x3b, 0xbb, 0xec, 0xd2, 0x25, 0x59, 0x13, 0x0e, 0x5e, 0xda, 0xf9, 0xf3, 0xbc, 0xcf, 0xf3, + 0xbe, 0xcf, 0xbc, 0x7d, 0x0b, 0x66, 0xf1, 0x2e, 0xde, 0xe9, 0x7a, 0x94, 0xd3, 0x16, 0xed, 0xe8, + 0x3d, 0xe4, 0x77, 0xb8, 0xce, 0x77, 0x34, 0x71, 0x02, 0x61, 0xf2, 0x52, 0x13, 0x97, 0x95, 0x99, + 0x16, 0x65, 0x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 0x5e, + 0x74, 0x31, 0xe2, 0xe4, 0x99, 0x18, 0x39, 0x70, 0x19, 0x0c, 0x23, 0x9f, 0xb7, 0xa9, 0x17, 0xa4, + 0x10, 0xbc, 0xf4, 0x70, 0xad, 0xfc, 0xf5, 0xf3, 0xe2, 0x94, 0x1c, 0x7b, 0x8f, 0x30, 0xf6, 0x08, + 0x63, 0x0d, 0xee, 0xd9, 0xae, 0x65, 0x9c, 0x40, 0xe1, 0x03, 0x30, 0x14, 0x0e, 0x2d, 0xd9, 0xd9, + 0x95, 0x2c, 0x13, 0x42, 0x8d, 0xda, 0x60, 0x50, 0x93, 0x21, 0xf1, 0x2b, 0xa5, 0xa0, 0x2d, 0x4f, + 0x98, 0xaa, 0x33, 0x60, 0xfa, 0x54, 0x52, 0x51, 0x33, 0x2e, 0x7d, 0x29, 0x82, 0x81, 0x3a, 0xb3, + 0xe0, 0x5b, 0x50, 0x3a, 0x35, 0xd7, 0xae, 0x66, 0xc9, 0xf5, 0xfd, 0xbe, 0x2b, 0x8b, 0xb9, 0x60, + 0x71, 0xf3, 0x53, 0x30, 0xd9, 0x3f, 0x02, 0x16, 0xce, 0xe0, 0xe8, 0x43, 0x56, 0x6e, 0xe5, 0x45, + 0xc6, 0x82, 0x6f, 0xc0, 0x68, 0xea, 0x35, 0xae, 0x9c, 0xc1, 0x90, 0x04, 0x55, 0x6e, 0xe6, 0x00, + 0x45, 0x0a, 0xb5, 0xcd, 0xfd, 0x23, 0x55, 0x39, 0x38, 0x52, 0x95, 0x1f, 0x47, 0xaa, 0xf2, 0xfe, + 0x58, 0x2d, 0x1c, 0x1c, 0xab, 0x85, 0x6f, 0xc7, 0x6a, 0xe1, 0xf5, 0xfd, 0xfc, 0x1d, 0xb6, 0x13, + 0xfd, 0x6d, 0x06, 0x8d, 0xd6, 0x1c, 0x12, 0xe7, 0x77, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x04, + 0xff, 0xd7, 0x93, 0x59, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -276,6 +427,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // DepositToVault deposits funds into a vault. DepositToVault(ctx context.Context, in *MsgDepositToVault, opts ...grpc.CallOption) (*MsgDepositToVaultResponse, error) + // WithdrawFromVault attempts to withdraw funds from a vault. + WithdrawFromVault(ctx context.Context, in *MsgWithdrawFromVault, opts ...grpc.CallOption) (*MsgWithdrawFromVaultResponse, error) // UpdateParams updates the Params in state. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } @@ -297,6 +450,15 @@ func (c *msgClient) DepositToVault(ctx context.Context, in *MsgDepositToVault, o return out, nil } +func (c *msgClient) WithdrawFromVault(ctx context.Context, in *MsgWithdrawFromVault, opts ...grpc.CallOption) (*MsgWithdrawFromVaultResponse, error) { + out := new(MsgWithdrawFromVaultResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.vault.Msg/WithdrawFromVault", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) err := c.cc.Invoke(ctx, "/dydxprotocol.vault.Msg/UpdateParams", in, out, opts...) @@ -310,6 +472,8 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts type MsgServer interface { // DepositToVault deposits funds into a vault. DepositToVault(context.Context, *MsgDepositToVault) (*MsgDepositToVaultResponse, error) + // WithdrawFromVault attempts to withdraw funds from a vault. + WithdrawFromVault(context.Context, *MsgWithdrawFromVault) (*MsgWithdrawFromVaultResponse, error) // UpdateParams updates the Params in state. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } @@ -321,6 +485,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) DepositToVault(ctx context.Context, req *MsgDepositToVault) (*MsgDepositToVaultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DepositToVault not implemented") } +func (*UnimplementedMsgServer) WithdrawFromVault(ctx context.Context, req *MsgWithdrawFromVault) (*MsgWithdrawFromVaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawFromVault not implemented") +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -347,6 +514,24 @@ func _Msg_DepositToVault_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_WithdrawFromVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawFromVault) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawFromVault(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.vault.Msg/WithdrawFromVault", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawFromVault(ctx, req.(*MsgWithdrawFromVault)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateParams) if err := dec(in); err != nil { @@ -373,6 +558,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DepositToVault", Handler: _Msg_DepositToVault_Handler, }, + { + MethodName: "WithdrawFromVault", + Handler: _Msg_WithdrawFromVault_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, @@ -462,6 +651,144 @@ func (m *MsgDepositToVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgWithdrawFromVault) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawFromVault) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawFromVault) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Shares != nil { + { + size, err := m.Shares.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.SubaccountId != nil { + { + size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.VaultId != nil { + { + size, err := m.VaultId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawFromVaultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawFromVaultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawFromVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalVaultEquity.Size() + i -= size + if _, err := m.TotalVaultEquity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.TotalVaultShares != nil { + { + size, err := m.TotalVaultShares.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.RemainingShares != nil { + { + size, err := m.RemainingShares.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size := m.WithdrawnQuoteQuantums.Size() + i -= size + if _, err := m.WithdrawnQuoteQuantums.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.RedeemedShares != nil { + { + size, err := m.RedeemedShares.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -564,6 +891,52 @@ func (m *MsgDepositToVaultResponse) Size() (n int) { return n } +func (m *MsgWithdrawFromVault) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VaultId != nil { + l = m.VaultId.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.SubaccountId != nil { + l = m.SubaccountId.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Shares != nil { + l = m.Shares.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgWithdrawFromVaultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RedeemedShares != nil { + l = m.RedeemedShares.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.WithdrawnQuoteQuantums.Size() + n += 1 + l + sovTx(uint64(l)) + if m.RemainingShares != nil { + l = m.RemainingShares.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.TotalVaultShares != nil { + l = m.TotalVaultShares.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.TotalVaultEquity.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -799,6 +1172,388 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgWithdrawFromVault) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromVault: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromVault: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VaultId == nil { + m.VaultId = &VaultId{} + } + if err := m.VaultId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubaccountId == nil { + m.SubaccountId = &types.SubaccountId{} + } + if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Shares == nil { + m.Shares = &NumShares{} + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawFromVaultResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawFromVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedeemedShares", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RedeemedShares == nil { + m.RedeemedShares = &NumShares{} + } + if err := m.RedeemedShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawnQuoteQuantums", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WithdrawnQuoteQuantums.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemainingShares", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RemainingShares == nil { + m.RemainingShares = &NumShares{} + } + if err := m.RemainingShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalVaultShares", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalVaultShares == nil { + m.TotalVaultShares = &NumShares{} + } + if err := m.TotalVaultShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalVaultEquity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalVaultEquity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/vault/types/vault.pb.go b/protocol/x/vault/types/vault.pb.go index 704b30d081..524f5c3960 100644 --- a/protocol/x/vault/types/vault.pb.go +++ b/protocol/x/vault/types/vault.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" @@ -146,35 +147,94 @@ func (m *NumShares) XXX_DiscardUnknown() { var xxx_messageInfo_NumShares proto.InternalMessageInfo +// OwnerShare is a type for owner shares in a vault. +type OwnerShare struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Shares *NumShares `protobuf:"bytes,2,opt,name=shares,proto3" json:"shares,omitempty"` +} + +func (m *OwnerShare) Reset() { *m = OwnerShare{} } +func (m *OwnerShare) String() string { return proto.CompactTextString(m) } +func (*OwnerShare) ProtoMessage() {} +func (*OwnerShare) Descriptor() ([]byte, []int) { + return fileDescriptor_32accb5830bb2860, []int{2} +} +func (m *OwnerShare) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OwnerShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OwnerShare.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OwnerShare) XXX_Merge(src proto.Message) { + xxx_messageInfo_OwnerShare.Merge(m, src) +} +func (m *OwnerShare) XXX_Size() int { + return m.Size() +} +func (m *OwnerShare) XXX_DiscardUnknown() { + xxx_messageInfo_OwnerShare.DiscardUnknown(m) +} + +var xxx_messageInfo_OwnerShare proto.InternalMessageInfo + +func (m *OwnerShare) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *OwnerShare) GetShares() *NumShares { + if m != nil { + return m.Shares + } + return nil +} + func init() { proto.RegisterEnum("dydxprotocol.vault.VaultType", VaultType_name, VaultType_value) proto.RegisterType((*VaultId)(nil), "dydxprotocol.vault.VaultId") proto.RegisterType((*NumShares)(nil), "dydxprotocol.vault.NumShares") + proto.RegisterType((*OwnerShare)(nil), "dydxprotocol.vault.OwnerShare") } func init() { proto.RegisterFile("dydxprotocol/vault/vault.proto", fileDescriptor_32accb5830bb2860) } var fileDescriptor_32accb5830bb2860 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto + // 375 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0x81, 0x90, 0x7a, 0x60, 0x41, 0x21, 0x21, 0x64, 0x79, 0x3d, 0xb0, 0x8c, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, - 0x58, 0x4c, 0x1f, 0xc4, 0x82, 0xa8, 0x54, 0x0a, 0xe1, 0x62, 0x0f, 0x03, 0x49, 0x7b, 0xa6, 0x08, - 0x19, 0x72, 0xb1, 0x94, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x19, 0xc9, 0xea, - 0x61, 0x9a, 0xa1, 0x07, 0x56, 0x1a, 0x52, 0x59, 0x90, 0x1a, 0x04, 0x56, 0x2a, 0x24, 0xc6, 0xc5, - 0x96, 0x57, 0x9a, 0x9b, 0x94, 0x5a, 0x24, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x1b, 0x04, 0xe5, 0x29, - 0x95, 0x70, 0x71, 0xfa, 0x95, 0xe6, 0x06, 0x67, 0x24, 0x16, 0xa5, 0x16, 0x0b, 0xa5, 0x73, 0x71, - 0xe5, 0x95, 0xe6, 0xc6, 0x17, 0x83, 0x79, 0x60, 0x85, 0x3c, 0x4e, 0x1e, 0x27, 0xee, 0xc9, 0x33, - 0xdc, 0xba, 0x27, 0xef, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, - 0xea, 0x27, 0x13, 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x7d, 0xb8, 0x48, 0x0a, 0xc8, 0xc6, 0x62, - 0xbd, 0xe0, 0xd4, 0xa2, 0xcc, 0xc4, 0x9c, 0xcc, 0xaa, 0xc4, 0xa4, 0x9c, 0x54, 0xcf, 0xbc, 0x92, - 0x20, 0xce, 0x3c, 0x98, 0x45, 0x5a, 0x36, 0x5c, 0x9c, 0x70, 0x07, 0x0a, 0x49, 0x71, 0x89, 0x85, - 0x39, 0x86, 0xfa, 0x84, 0xc4, 0x87, 0x44, 0x06, 0xb8, 0xc6, 0x87, 0xfa, 0x05, 0x07, 0xb8, 0x3a, - 0x7b, 0xba, 0x79, 0xba, 0xba, 0x08, 0x30, 0x08, 0x09, 0x73, 0xf1, 0x23, 0xc9, 0x39, 0xfb, 0xf8, - 0x3b, 0x09, 0x30, 0x3a, 0x05, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, - 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, - 0x39, 0xf1, 0x8e, 0xac, 0x80, 0x46, 0x06, 0xd8, 0xad, 0x49, 0x6c, 0x60, 0x71, 0x63, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xf0, 0x30, 0x49, 0x71, 0xaf, 0x01, 0x00, 0x00, + 0x58, 0x4c, 0x1f, 0xc4, 0x82, 0xa8, 0x94, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x87, + 0x48, 0x40, 0x38, 0x10, 0x29, 0xa5, 0x10, 0x2e, 0xf6, 0x30, 0x90, 0x4e, 0xcf, 0x14, 0x21, 0x43, + 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x3e, 0x23, 0x59, 0x3d, 0x4c, + 0xe3, 0xf5, 0xc0, 0x4a, 0x43, 0x2a, 0x0b, 0x52, 0x83, 0xc0, 0x4a, 0x85, 0xc4, 0xb8, 0xd8, 0xf2, + 0x4a, 0x73, 0x93, 0x52, 0x8b, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0xa0, 0x3c, 0xa5, 0x12, + 0x2e, 0x4e, 0xbf, 0xd2, 0xdc, 0xe0, 0x8c, 0xc4, 0xa2, 0xd4, 0x62, 0xa1, 0x74, 0x2e, 0xae, 0xbc, + 0xd2, 0xdc, 0xf8, 0x62, 0x30, 0x0f, 0xac, 0x90, 0xc7, 0xc9, 0xe3, 0xc4, 0x3d, 0x79, 0x86, 0x5b, + 0xf7, 0xe4, 0x1d, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x51, 0xbd, + 0x6b, 0xa2, 0x9b, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x0f, 0x17, 0x49, 0x01, 0xd9, 0x58, 0xac, 0x17, + 0x9c, 0x5a, 0x94, 0x99, 0x98, 0x93, 0x59, 0x95, 0x98, 0x94, 0x93, 0xea, 0x99, 0x57, 0x12, 0xc4, + 0x99, 0x07, 0xb3, 0x48, 0xa9, 0x98, 0x8b, 0xcb, 0xbf, 0x3c, 0x2f, 0xb5, 0x08, 0xcc, 0x15, 0xd2, + 0xe3, 0x62, 0xcd, 0x07, 0xf1, 0xc0, 0xfe, 0xe1, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0xea, + 0x75, 0xc7, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x88, + 0x32, 0x21, 0x53, 0x2e, 0x36, 0x24, 0x27, 0x72, 0x63, 0x0f, 0x00, 0xb8, 0xaf, 0x82, 0xa0, 0x8a, + 0xb5, 0x6c, 0xb8, 0x38, 0xe1, 0xa1, 0x22, 0x24, 0xc5, 0x25, 0x16, 0xe6, 0x18, 0xea, 0x13, 0x12, + 0x1f, 0x12, 0x19, 0xe0, 0x1a, 0x1f, 0xea, 0x17, 0x1c, 0xe0, 0xea, 0xec, 0xe9, 0xe6, 0xe9, 0xea, + 0x22, 0xc0, 0x20, 0x24, 0xcc, 0xc5, 0x8f, 0x24, 0xe7, 0xec, 0xe3, 0xef, 0x24, 0xc0, 0xe8, 0x14, + 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, + 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xe6, 0xc4, 0x87, 0x4c, 0x05, + 0x34, 0x71, 0x80, 0x03, 0x28, 0x89, 0x0d, 0x2c, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x05, + 0x40, 0x04, 0x8b, 0x3f, 0x02, 0x00, 0x00, } func (m *VaultId) Marshal() (dAtA []byte, err error) { @@ -243,6 +303,48 @@ func (m *NumShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *OwnerShare) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OwnerShare) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OwnerShare) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Shares != nil { + { + size, err := m.Shares.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVault(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintVault(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintVault(dAtA []byte, offset int, v uint64) int { offset -= sovVault(v) base := offset @@ -280,6 +382,23 @@ func (m *NumShares) Size() (n int) { return n } +func (m *OwnerShare) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovVault(uint64(l)) + } + if m.Shares != nil { + l = m.Shares.Size() + n += 1 + l + sovVault(uint64(l)) + } + return n +} + func sovVault(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -457,6 +576,124 @@ func (m *NumShares) Unmarshal(dAtA []byte) error { } return nil } +func (m *OwnerShare) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVault + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OwnerShare: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OwnerShare: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVault + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVault + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVault + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVault + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVault + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVault + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Shares == nil { + m.Shares = &NumShares{} + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVault(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVault + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipVault(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0