From 23413f87191edf56017b3f64a0e5f6ec11bd4db4 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Wed, 31 Jul 2024 11:53:48 -0400 Subject: [PATCH 01/10] add/modify proto to have individual vault quoting parameters --- proto/dydxprotocol/vault/genesis.proto | 5 +- proto/dydxprotocol/vault/params.proto | 10 +- proto/dydxprotocol/vault/query.proto | 3 +- proto/dydxprotocol/vault/share.proto | 23 + proto/dydxprotocol/vault/tx.proto | 16 +- proto/dydxprotocol/vault/vault.proto | 26 - protocol/x/vault/types/genesis.pb.go | 69 +-- protocol/x/vault/types/params.pb.go | 291 +++++++++--- protocol/x/vault/types/query.pb.go | 116 ++--- protocol/x/vault/types/share.pb.go | 553 ++++++++++++++++++++++ protocol/x/vault/types/tx.pb.go | 212 ++++----- protocol/x/vault/types/vault.pb.go | 627 +------------------------ 12 files changed, 1047 insertions(+), 904 deletions(-) create mode 100644 proto/dydxprotocol/vault/share.proto create mode 100644 protocol/x/vault/types/share.pb.go diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index e0346312b7..44f621303f 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -3,14 +3,15 @@ package dydxprotocol.vault; import "gogoproto/gogo.proto"; import "dydxprotocol/vault/params.proto"; +import "dydxprotocol/vault/share.proto"; import "dydxprotocol/vault/vault.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; // GenesisState defines `x/vault`'s genesis state. message GenesisState { - // The parameters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; + // The default quoting parameters for all vaults. + QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ]; // The vaults. repeated Vault vaults = 2; } diff --git a/proto/dydxprotocol/vault/params.proto b/proto/dydxprotocol/vault/params.proto index baf96d7fc2..258f9d911e 100644 --- a/proto/dydxprotocol/vault/params.proto +++ b/proto/dydxprotocol/vault/params.proto @@ -5,8 +5,8 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; -// Params stores `x/vault` parameters. -message Params { +// QuotingParams stores vault quoting parameters. +message QuotingParams { // The number of layers of orders a vault places. For example if // `layers=2`, a vault places 2 asks and 2 bids. uint32 layers = 1; @@ -38,3 +38,9 @@ message Params { (gogoproto.nullable) = false ]; } + +// VaultParams stores individual parameters of a vault. +message VaultParams { + // The quoting parameters specific to this vault. + QuotingParams quoting_params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/dydxprotocol/vault/query.proto b/proto/dydxprotocol/vault/query.proto index babc5112b5..b00d6c35f5 100644 --- a/proto/dydxprotocol/vault/query.proto +++ b/proto/dydxprotocol/vault/query.proto @@ -6,6 +6,7 @@ import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "dydxprotocol/subaccounts/subaccount.proto"; import "dydxprotocol/vault/params.proto"; +import "dydxprotocol/vault/share.proto"; import "dydxprotocol/vault/vault.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; @@ -36,7 +37,7 @@ message QueryParamsRequest {} // QueryParamsResponse is a response type for the Params RPC method. message QueryParamsResponse { - Params params = 1 [ (gogoproto.nullable) = false ]; + QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ]; } // QueryVaultRequest is a request type for the Vault RPC method. diff --git a/proto/dydxprotocol/vault/share.proto b/proto/dydxprotocol/vault/share.proto new file mode 100644 index 0000000000..20dac51bb4 --- /dev/null +++ b/proto/dydxprotocol/vault/share.proto @@ -0,0 +1,23 @@ +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"; + +// NumShares represents the number of shares in a vault. +message NumShares { + // Number of shares. + bytes num_shares = 2 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (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/proto/dydxprotocol/vault/tx.proto b/proto/dydxprotocol/vault/tx.proto index e8d15fc9ca..6f17fd0bdb 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -15,8 +15,8 @@ service Msg { // DepositToVault deposits funds into a vault. rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); - // UpdateParams updates the Params in state. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // UpdateDefaultQuotingParams updates the default quoting params in state. + rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) returns (MsgUpdateDefaultQuotingParamsResponse); } // MsgDepositToVault deposits the specified asset from the subaccount to the @@ -44,15 +44,15 @@ message MsgDepositToVault { // MsgDepositToVaultResponse is the Msg/DepositToVault response type. message MsgDepositToVaultResponse {} -// MsgUpdateParams is the Msg/UpdateParams request type. -message MsgUpdateParams { +// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request type. +message MsgUpdateDefaultQuotingParams { // Authority is the address that controls the module. option (cosmos.msg.v1.signer) = "authority"; string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // The parameters to update. Each field must be set. - Params params = 2 [ (gogoproto.nullable) = false ]; + // The quoting parameters to update to. Every field must be set. + QuotingParams default_quoting_params = 2 [ (gogoproto.nullable) = false ]; } -// MsgUpdateParamsResponse is the Msg/UpdateParams response type. -message MsgUpdateParamsResponse {} +// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams response type. +message MsgUpdateDefaultQuotingParamsResponse {} diff --git a/proto/dydxprotocol/vault/vault.proto b/proto/dydxprotocol/vault/vault.proto index 547ffcb95a..527c4c4938 100644 --- a/proto/dydxprotocol/vault/vault.proto +++ b/proto/dydxprotocol/vault/vault.proto @@ -1,10 +1,6 @@ syntax = "proto3"; package dydxprotocol.vault; -import "dydxprotocol/prices/market_price.proto"; -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; - option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; // VaultType represents different types of vaults. @@ -24,25 +20,3 @@ message VaultId { // Unique ID of the vault within above type. uint32 number = 2; } - -// NumShares represents the number of shares in a vault. -message NumShares { - // Number of shares. - bytes num_shares = 2 [ - (gogoproto.customtype) = - "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", - (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; -} - -// VaultParams is the individual parameters of a vault. -message VaultParams { - // Lagged price that the vault quotes at. - dydxprotocol.prices.MarketPrice lagged_price = 1; -} diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 66a8a9ec1c..2e5fdbf32e 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines `x/vault`'s genesis state. type GenesisState struct { - // The parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // The default quoting parameters for all vaults. + DefaultQuotingParams QuotingParams `protobuf:"bytes,1,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` // The vaults. Vaults []*Vault `protobuf:"bytes,2,rep,name=vaults,proto3" json:"vaults,omitempty"` } @@ -64,11 +64,11 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { +func (m *GenesisState) GetDefaultQuotingParams() QuotingParams { if m != nil { - return m.Params + return m.DefaultQuotingParams } - return Params{} + return QuotingParams{} } func (m *GenesisState) GetVaults() []*Vault { @@ -168,31 +168,32 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescriptor_4be4a747b209e41c) } var fileDescriptor_4be4a747b209e41c = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xbd, 0x6e, 0xdb, 0x30, - 0x14, 0x85, 0x25, 0xff, 0xb5, 0xa0, 0xd4, 0x85, 0x2d, 0x0a, 0x57, 0x45, 0x69, 0xc1, 0x93, 0x97, - 0x4a, 0xa8, 0x5d, 0xb4, 0x1d, 0x1b, 0x67, 0x08, 0xbc, 0xe4, 0x87, 0x06, 0x32, 0x64, 0x11, 0x64, - 0x89, 0x90, 0x05, 0x48, 0xa2, 0x21, 0xd2, 0x8e, 0x8d, 0xbc, 0x44, 0x5e, 0x28, 0xbb, 0x47, 0x8f, - 0x99, 0x82, 0xc0, 0x7e, 0x91, 0x40, 0x97, 0x8a, 0x93, 0x20, 0xf2, 0x42, 0x91, 0xe7, 0x7c, 0xe7, - 0xde, 0x2b, 0x82, 0xc8, 0x0e, 0x57, 0xe1, 0x72, 0x96, 0x73, 0xc9, 0x03, 0x9e, 0xb8, 0x0b, 0x7f, - 0x9e, 0x48, 0x37, 0x62, 0x19, 0x13, 0xb1, 0x70, 0x40, 0xc6, 0xf8, 0x35, 0xe1, 0x00, 0x61, 0x7d, - 0x89, 0x78, 0xc4, 0x41, 0x73, 0x8b, 0x9d, 0x22, 0xad, 0x4e, 0x45, 0xad, 0x99, 0x9f, 0xfb, 0x69, - 0x59, 0xca, 0x22, 0x15, 0x00, 0xac, 0xca, 0xef, 0xde, 0x20, 0xf3, 0x44, 0xf5, 0x1e, 0x4b, 0x5f, - 0x32, 0xfc, 0x0f, 0xb5, 0x54, 0xbe, 0xad, 0xdb, 0x7a, 0xcf, 0xe8, 0x5b, 0xce, 0xfb, 0x59, 0x9c, - 0x73, 0x20, 0x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xed, 0x0b, 0xf8, 0xfd, 0x33, 0x98, 0xfa, 0x71, - 0xe6, 0xee, 0x95, 0x65, 0xf9, 0x2a, 0xe4, 0x6a, 0xc6, 0xc4, 0xa4, 0x05, 0xfa, 0xe0, 0x29, 0x00, - 0x00, 0xff, 0xff, 0x85, 0x9d, 0xbd, 0xf3, 0xa5, 0x02, 0x00, 0x00, + // 397 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcf, 0xee, 0xd2, 0x30, + 0x1c, 0xdf, 0x7e, 0xfc, 0xd1, 0x74, 0xf3, 0x52, 0x09, 0x41, 0x8c, 0x65, 0x72, 0xe2, 0xe2, 0x16, + 0xc1, 0xe8, 0x55, 0xf1, 0x60, 0xb8, 0xa8, 0x94, 0xc4, 0x83, 0x89, 0x59, 0xc6, 0x56, 0xc7, 0x92, + 0x6d, 0xc5, 0xb5, 0x43, 0x78, 0x0b, 0x1f, 0xc1, 0x17, 0xf1, 0xce, 0x91, 0xa3, 0x27, 0x63, 0xe0, + 0x45, 0x4c, 0xbf, 0x9d, 0x28, 0x71, 0x78, 0xe9, 0xda, 0xcf, 0xbf, 0x7e, 0xf6, 0x4d, 0x91, 0x13, + 0xed, 0xa2, 0xed, 0xba, 0xe0, 0x92, 0x87, 0x3c, 0xf5, 0x36, 0x41, 0x99, 0x4a, 0x2f, 0x66, 0x39, + 0x13, 0x89, 0x70, 0x01, 0xc6, 0xf8, 0x6f, 0x85, 0x0b, 0x8a, 0x7e, 0x27, 0xe6, 0x31, 0x07, 0xcc, + 0x53, 0x3b, 0xad, 0xec, 0x0f, 0x6a, 0xb2, 0xd6, 0x41, 0x11, 0x64, 0x55, 0x54, 0x9f, 0xd4, 0x08, + 0xc4, 0x2a, 0x28, 0xd8, 0x7f, 0x78, 0x58, 0x35, 0x3f, 0xfc, 0x6a, 0x22, 0xfb, 0x95, 0x2e, 0xb7, + 0x90, 0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0x6e, 0x16, 0x89, 0xe9, 0x7c, 0x7f, 0x24, 0xe6, 0xe1, + 0x48, 0xcc, 0x9f, 0x47, 0x62, 0x7e, 0x39, 0x11, 0xe3, 0x70, 0x22, 0xc6, 0xf7, 0x13, 0x31, 0xde, + 0x3f, 0x8b, 0x13, 0xb9, 0x2a, 0x97, 0x6e, 0xc8, 0x33, 0xef, 0xf2, 0x9d, 0x3c, 0x79, 0x14, 0xae, + 0x82, 0x24, 0xf7, 0xce, 0xc8, 0xb6, 0x7a, 0x3b, 0x72, 0xb7, 0x66, 0x62, 0xd9, 0x06, 0x7c, 0xf2, + 0x2b, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x97, 0xc5, 0x76, 0xeb, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -230,7 +231,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DefaultQuotingParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -350,7 +351,7 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() + l = m.DefaultQuotingParams.Size() n += 1 + l + sovGenesis(uint64(l)) if len(m.Vaults) > 0 { for _, e := range m.Vaults { @@ -432,7 +433,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -459,7 +460,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DefaultQuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/protocol/x/vault/types/params.pb.go b/protocol/x/vault/types/params.pb.go index af75318148..c0cb987a96 100644 --- a/protocol/x/vault/types/params.pb.go +++ b/protocol/x/vault/types/params.pb.go @@ -24,8 +24,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params stores `x/vault` parameters. -type Params struct { +// QuotingParams stores vault quoting parameters. +type QuotingParams struct { // The number of layers of orders a vault places. For example if // `layers=2`, a vault places 2 asks and 2 bids. Layers uint32 `protobuf:"varint,1,opt,name=layers,proto3" json:"layers,omitempty"` @@ -48,18 +48,18 @@ type Params struct { ActivationThresholdQuoteQuantums github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,7,opt,name=activation_threshold_quote_quantums,json=activationThresholdQuoteQuantums,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"activation_threshold_quote_quantums"` } -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { +func (m *QuotingParams) Reset() { *m = QuotingParams{} } +func (m *QuotingParams) String() string { return proto.CompactTextString(m) } +func (*QuotingParams) ProtoMessage() {} +func (*QuotingParams) Descriptor() ([]byte, []int) { return fileDescriptor_6043e0b8bfdbca9f, []int{0} } -func (m *Params) XXX_Unmarshal(b []byte) error { +func (m *QuotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) + return xxx_messageInfo_QuotingParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -69,96 +69,146 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) +func (m *QuotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuotingParams.Merge(m, src) } -func (m *Params) XXX_Size() int { +func (m *QuotingParams) XXX_Size() int { return m.Size() } -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) +func (m *QuotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_QuotingParams.DiscardUnknown(m) } -var xxx_messageInfo_Params proto.InternalMessageInfo +var xxx_messageInfo_QuotingParams proto.InternalMessageInfo -func (m *Params) GetLayers() uint32 { +func (m *QuotingParams) GetLayers() uint32 { if m != nil { return m.Layers } return 0 } -func (m *Params) GetSpreadMinPpm() uint32 { +func (m *QuotingParams) GetSpreadMinPpm() uint32 { if m != nil { return m.SpreadMinPpm } return 0 } -func (m *Params) GetSpreadBufferPpm() uint32 { +func (m *QuotingParams) GetSpreadBufferPpm() uint32 { if m != nil { return m.SpreadBufferPpm } return 0 } -func (m *Params) GetSkewFactorPpm() uint32 { +func (m *QuotingParams) GetSkewFactorPpm() uint32 { if m != nil { return m.SkewFactorPpm } return 0 } -func (m *Params) GetOrderSizePctPpm() uint32 { +func (m *QuotingParams) GetOrderSizePctPpm() uint32 { if m != nil { return m.OrderSizePctPpm } return 0 } -func (m *Params) GetOrderExpirationSeconds() uint32 { +func (m *QuotingParams) GetOrderExpirationSeconds() uint32 { if m != nil { return m.OrderExpirationSeconds } return 0 } +// VaultParams stores individual parameters of a vault. +type VaultParams struct { + // The quoting parameters specific to this vault. + QuotingParams QuotingParams `protobuf:"bytes,1,opt,name=quoting_params,json=quotingParams,proto3" json:"quoting_params"` +} + +func (m *VaultParams) Reset() { *m = VaultParams{} } +func (m *VaultParams) String() string { return proto.CompactTextString(m) } +func (*VaultParams) ProtoMessage() {} +func (*VaultParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6043e0b8bfdbca9f, []int{1} +} +func (m *VaultParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VaultParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VaultParams.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 *VaultParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VaultParams.Merge(m, src) +} +func (m *VaultParams) XXX_Size() int { + return m.Size() +} +func (m *VaultParams) XXX_DiscardUnknown() { + xxx_messageInfo_VaultParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VaultParams proto.InternalMessageInfo + +func (m *VaultParams) GetQuotingParams() QuotingParams { + if m != nil { + return m.QuotingParams + } + return QuotingParams{} +} + func init() { - proto.RegisterType((*Params)(nil), "dydxprotocol.vault.Params") + proto.RegisterType((*QuotingParams)(nil), "dydxprotocol.vault.QuotingParams") + proto.RegisterType((*VaultParams)(nil), "dydxprotocol.vault.VaultParams") } func init() { proto.RegisterFile("dydxprotocol/vault/params.proto", fileDescriptor_6043e0b8bfdbca9f) } var fileDescriptor_6043e0b8bfdbca9f = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x3f, 0x8f, 0xd3, 0x30, - 0x18, 0xc6, 0x13, 0x0a, 0x41, 0xb2, 0x5a, 0x2a, 0x22, 0x54, 0x45, 0x0c, 0x69, 0x05, 0x08, 0x55, - 0x20, 0x92, 0x01, 0x24, 0x18, 0x51, 0x25, 0x10, 0x0c, 0x48, 0xfd, 0xc3, 0xc4, 0x62, 0x39, 0x8e, - 0xdb, 0x58, 0x24, 0xb1, 0x6b, 0x3b, 0xa5, 0xed, 0xa7, 0x60, 0x63, 0xe0, 0x0b, 0x75, 0xec, 0x88, - 0x18, 0xaa, 0x53, 0xfb, 0x45, 0x4e, 0x79, 0x9d, 0xeb, 0xdd, 0x6d, 0xb7, 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0xf0, 0x95, 0x1d, 0x32, 0x99, 0x62, 0x3a, 0x13, 0x79, 0x8a, 0x97, 0x95, 0x30, 0x0c, - 0x2f, 0x2b, 0x52, 0x9a, 0xaa, 0xd0, 0xc1, 0xc3, 0x81, 0x3b, 0x6c, 0x8f, 0xbe, 0xec, 0x0e, 0x7d, - 0xe7, 0xff, 0xa1, 0xff, 0x71, 0xc1, 0x4d, 0x56, 0x25, 0x11, 0x15, 0x45, 0x7c, 0xfb, 0x3d, 0xde, - 0xbd, 0xa1, 0x19, 0xe1, 0x65, 0x7c, 0x26, 0xa9, 0xd9, 0x48, 0xa6, 0xa3, 0x19, 0x53, 0x9c, 0xe4, - 0x7c, 0x4b, 0x92, 0x9c, 0x7d, 0x2d, 0xcd, 0x74, 0x70, 0x5d, 0xfa, 0xfd, 0xaa, 0x73, 0x52, 0x57, - 0x4e, 0x9a, 0xc6, 0xd1, 0x64, 0x77, 0x0c, 0xdd, 0xfd, 0x31, 0x74, 0x2f, 0x8e, 0xa1, 0xfb, 0xfb, - 0x14, 0x3a, 0xfb, 0x53, 0xe8, 0xfc, 0x3b, 0x85, 0xce, 0x8f, 0xf7, 0x77, 0x6f, 0x5f, 0x37, 0x3f, - 0x04, 0x2e, 0x91, 0x78, 0xc0, 0xdf, 0x5e, 0x06, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x00, 0xa7, 0x50, - 0x44, 0x02, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x8b, 0xd4, 0x30, + 0x18, 0xc6, 0xa7, 0xee, 0x3a, 0x42, 0x76, 0x67, 0x17, 0x8b, 0x2c, 0xc5, 0x43, 0x67, 0x5c, 0x45, + 0x16, 0xc5, 0x16, 0x54, 0xd0, 0xa3, 0x0c, 0x28, 0x7a, 0x50, 0xe6, 0x8f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5, 0xe5, 0x16, 0xed, 0x7f, 0x08, 0x3b, 0xce, + 0xba, 0x90, 0x3f, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xd1, 0x51, 0x65, 0xaa, 0x02, 0x00, + 0x00, +} + +func (m *QuotingParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -168,12 +218,12 @@ func (m *Params) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Params) MarshalTo(dAtA []byte) (int, error) { +func (m *QuotingParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -221,6 +271,39 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *VaultParams) 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 *VaultParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VaultParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.QuotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -232,7 +315,7 @@ func encodeVarintParams(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *Params) Size() (n int) { +func (m *QuotingParams) Size() (n int) { if m == nil { return 0 } @@ -261,13 +344,24 @@ func (m *Params) Size() (n int) { return n } +func (m *VaultParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.QuotingParams.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozParams(x uint64) (n int) { return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *Params) Unmarshal(dAtA []byte) error { +func (m *QuotingParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -290,10 +384,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") + return fmt.Errorf("proto: QuotingParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuotingParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -464,6 +558,89 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *VaultParams) 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 ErrIntOverflowParams + } + 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: VaultParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VaultParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuotingParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.QuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/vault/types/query.pb.go b/protocol/x/vault/types/query.pb.go index b6beacb3ee..34a087164b 100644 --- a/protocol/x/vault/types/query.pb.go +++ b/protocol/x/vault/types/query.pb.go @@ -71,7 +71,7 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is a response type for the Params RPC method. type QueryParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + DefaultQuotingParams QuotingParams `protobuf:"bytes,1,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -107,11 +107,11 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetParams() Params { +func (m *QueryParamsResponse) GetDefaultQuotingParams() QuotingParams { if m != nil { - return m.Params + return m.DefaultQuotingParams } - return Params{} + return QuotingParams{} } // QueryVaultRequest is a request type for the Vault RPC method. @@ -456,55 +456,57 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/query.proto", fileDescriptor_478fb8dc0ff21ea6) } var fileDescriptor_478fb8dc0ff21ea6 = []byte{ - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4b, 0x6f, 0xd3, 0x4a, - 0x18, 0x8d, 0x9b, 0x34, 0xf7, 0x76, 0x92, 0x5e, 0xe9, 0xce, 0xed, 0x2d, 0xc1, 0x2d, 0x6e, 0xb1, - 0x44, 0x9f, 0xe0, 0x21, 0x01, 0x89, 0x2e, 0x10, 0xa2, 0x5d, 0x14, 0xba, 0xa1, 0xad, 0x8b, 0x58, - 0xb0, 0xa0, 0x8c, 0x93, 0xc1, 0xb5, 0xe4, 0x78, 0x5c, 0x7b, 0x1c, 0x1a, 0xaa, 0x6e, 0x90, 0x58, - 0xb0, 0x43, 0xe2, 0x17, 0xc0, 0x82, 0x15, 0x7b, 0x96, 0x6c, 0xbb, 0xac, 0xc4, 0x06, 0xb1, 0xa8, - 0x50, 0xcb, 0x0f, 0x41, 0x9e, 0x99, 0x26, 0xce, 0xc3, 0x6a, 0x84, 0xba, 0x89, 0x26, 0xdf, 0x9c, - 0xef, 0x9c, 0xe3, 0xef, 0x31, 0x40, 0xab, 0x35, 0x6b, 0x7b, 0x7e, 0x40, 0x19, 0xad, 0x52, 0x17, - 0x35, 0x70, 0xe4, 0x32, 0xb4, 0x1b, 0x91, 0xa0, 0x69, 0xf0, 0x20, 0x84, 0xc9, 0x7b, 0x83, 0xdf, - 0xab, 0x63, 0x36, 0xb5, 0x29, 0x8f, 0xa1, 0xf8, 0x24, 0x90, 0xea, 0xa4, 0x4d, 0xa9, 0xed, 0x12, - 0x84, 0x7d, 0x07, 0x61, 0xcf, 0xa3, 0x0c, 0x33, 0x87, 0x7a, 0xa1, 0xbc, 0x5d, 0xa8, 0xd2, 0xb0, - 0x4e, 0x43, 0x64, 0xe1,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 0xe4, 0xb4, 0x76, 0x17, 0x6b, 0x65, 0xf3, 0xf0, 0x44, 0x53, 0x8e, 0x4e, - 0x34, 0xe5, 0xe7, 0x89, 0xa6, 0xbc, 0x3b, 0xd5, 0x32, 0x47, 0xa7, 0x5a, 0xe6, 0xfb, 0xa9, 0x96, - 0x79, 0x7a, 0x67, 0xf0, 0xd7, 0x74, 0x4f, 0x2a, 0xf1, 0x47, 0xd5, 0xca, 0xf3, 0xf8, 0xad, 0xdf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x91, 0x1e, 0x58, 0x7b, 0x08, 0x00, 0x00, + // 788 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4f, + 0x14, 0xef, 0xd2, 0xd2, 0xef, 0x97, 0x69, 0x31, 0x71, 0x44, 0xac, 0x05, 0x17, 0xd8, 0x44, 0x7e, + 0xea, 0x8e, 0xad, 0x26, 0x7a, 0x30, 0x46, 0x38, 0xa0, 0x5c, 0x94, 0x2e, 0xc6, 0x83, 0x89, 0xd6, + 0x69, 0x3b, 0x2c, 0x9b, 0x6c, 0x77, 0xda, 0xdd, 0xd9, 0x4a, 0x25, 0x5c, 0x4c, 0x3c, 0x78, 0x33, + 0xf1, 0x2f, 0xd0, 0x83, 0x27, 0xef, 0x1e, 0xbd, 0x72, 0x24, 0xf1, 0x62, 0x3c, 0x10, 0x03, 0xfe, + 0x21, 0x66, 0x67, 0xa6, 0xed, 0xf6, 0xc7, 0x4a, 0x63, 0xb8, 0x90, 0xed, 0x7b, 0x6f, 0x3e, 0x9f, + 0xcf, 0xbc, 0xf7, 0x79, 0x03, 0x50, 0x2b, 0xcd, 0xca, 0x6e, 0xcd, 0xa5, 0x8c, 0x96, 0xa9, 0x8d, + 0x1a, 0xd8, 0xb7, 0x19, 0xaa, 0xfb, 0xc4, 0x6d, 0xea, 0x3c, 0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, + 0x78, 0x62, 0x1f, 0xed, 0x09, 0x13, 0xec, 0xc3, 0xb7, 0x0a, 0x18, 0x6b, 0xef, 0x02, 0x5c, 0x8a, + 0x24, 0xea, 0xdd, 0xc8, 0xec, 0xf2, 0x30, 0xa5, 0x52, 0xd7, 0x1c, 0xd7, 0x35, 0x05, 0x2f, 0x47, + 0xea, 0x82, 0x9f, 0x14, 0x90, 0x0a, 0x19, 0x08, 0xae, 0x44, 0xc2, 0xf7, 0x6f, 0x45, 0xf6, 0xda, + 0x70, 0xc5, 0x52, 0xcd, 0x1d, 0xae, 0x26, 0x0f, 0x6f, 0x0c, 0x52, 0x13, 0x76, 0x6b, 0x6f, 0xb3, + 0xd6, 0x0a, 0x07, 0xc7, 0xaa, 0x72, 0x78, 0xac, 0x2a, 0xbf, 0x8e, 0x55, 0xe5, 0xfd, 0x89, 0x1a, + 0x3b, 0x3c, 0x51, 0x63, 0x3f, 0x4e, 0xd4, 0xd8, 0xb3, 0xdb, 0xc3, 0xbf, 0xa6, 0xbb, 0x92, 0x89, + 0x3f, 0xaa, 0xa5, 0x24, 0x8f, 0xdf, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x73, 0x54, 0x73, 0x3c, + 0xc0, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -747,7 +749,7 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DefaultQuotingParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1069,7 +1071,7 @@ func (m *QueryParamsResponse) Size() (n int) { } var l int _ = l - l = m.Params.Size() + l = m.DefaultQuotingParams.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -1265,7 +1267,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1292,7 +1294,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DefaultQuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/protocol/x/vault/types/share.pb.go b/protocol/x/vault/types/share.pb.go new file mode 100644 index 0000000000..0dee7e8a42 --- /dev/null +++ b/protocol/x/vault/types/share.pb.go @@ -0,0 +1,553 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/vault/share.proto + +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" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// NumShares represents the number of shares in a vault. +type NumShares struct { + // Number of shares. + NumShares github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=num_shares,json=numShares,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"num_shares"` +} + +func (m *NumShares) Reset() { *m = NumShares{} } +func (m *NumShares) String() string { return proto.CompactTextString(m) } +func (*NumShares) ProtoMessage() {} +func (*NumShares) Descriptor() ([]byte, []int) { + return fileDescriptor_b65bab3182bbf56c, []int{0} +} +func (m *NumShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NumShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NumShares.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 *NumShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_NumShares.Merge(m, src) +} +func (m *NumShares) XXX_Size() int { + return m.Size() +} +func (m *NumShares) XXX_DiscardUnknown() { + xxx_messageInfo_NumShares.DiscardUnknown(m) +} + +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_b65bab3182bbf56c, []int{1} +} +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.RegisterType((*NumShares)(nil), "dydxprotocol.vault.NumShares") + proto.RegisterType((*OwnerShare)(nil), "dydxprotocol.vault.OwnerShare") +} + +func init() { proto.RegisterFile("dydxprotocol/vault/share.proto", fileDescriptor_b65bab3182bbf56c) } + +var fileDescriptor_b65bab3182bbf56c = []byte{ + // 286 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, 0xd1, 0x2f, + 0xce, 0x48, 0x2c, 0x4a, 0xd5, 0x03, 0x0b, 0x0a, 0x09, 0x21, 0xcb, 0xeb, 0x81, 0xe5, 0xa5, 0x44, + 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0xa5, 0x94, 0x64, 0x72, 0x7e, 0x71, + 0x6e, 0x7e, 0x71, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x48, 0x29, 0x95, 0x70, 0x71, 0xfa, 0x95, 0xe6, + 0x06, 0x83, 0x8c, 0x2d, 0x16, 0x4a, 0xe7, 0xe2, 0xca, 0x2b, 0xcd, 0x8d, 0x07, 0x5b, 0x52, 0x2c, + 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0xe3, 0xe4, 0x71, 0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, 0xf2, 0x0e, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xa8, 0x0e, 0x33, 0xd1, 0x4d, + 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x87, 0x8b, 0xa4, 0x94, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x05, 0xa7, + 0x16, 0x65, 0x26, 0xe6, 0x64, 0x56, 0x25, 0x26, 0xe5, 0xa4, 0x7a, 0xe6, 0x95, 0x04, 0x71, 0xe6, + 0xc1, 0x2c, 0x52, 0x2a, 0xe6, 0xe2, 0xf2, 0x2f, 0xcf, 0x4b, 0x2d, 0x02, 0x73, 0x85, 0xf4, 0xb8, + 0x58, 0xf3, 0x41, 0x3c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x89, 0x4b, 0x5b, 0x74, 0x45, + 0xa0, 0x8e, 0x74, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, + 0x82, 0x28, 0x13, 0x32, 0xe5, 0x62, 0x43, 0x72, 0x22, 0xb7, 0x91, 0xac, 0x1e, 0x66, 0x48, 0xe8, + 0xc1, 0x7d, 0x15, 0x04, 0x55, 0xec, 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, 0xfb, 0xad, 0x02, 0x1a, 0x11, 0x60, 0x2f, 0x26, 0xb1, 0x81, 0xc5, 0x8d, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x11, 0x60, 0xb8, 0x3e, 0xab, 0x01, 0x00, 0x00, +} + +func (m *NumShares) 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 *NumShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NumShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NumShares.Size() + i -= size + if _, err := m.NumShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintShare(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + 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 = encodeVarintShare(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintShare(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintShare(dAtA []byte, offset int, v uint64) int { + offset -= sovShare(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NumShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NumShares.Size() + n += 1 + l + sovShare(uint64(l)) + 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 + sovShare(uint64(l)) + } + if m.Shares != nil { + l = m.Shares.Size() + n += 1 + l + sovShare(uint64(l)) + } + return n +} + +func sovShare(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozShare(x uint64) (n int) { + return sovShare(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NumShares) 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 ErrIntOverflowShare + } + 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: NumShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NumShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NumShares", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShare + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthShare + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthShare + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NumShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipShare(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShare + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + 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 ErrIntOverflowShare + } + 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 ErrIntOverflowShare + } + 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 ErrInvalidLengthShare + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthShare + } + 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 ErrIntOverflowShare + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthShare + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthShare + } + 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 := skipShare(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthShare + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipShare(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShare + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShare + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowShare + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthShare + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupShare + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthShare + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthShare = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowShare = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupShare = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/vault/types/tx.pb.go b/protocol/x/vault/types/tx.pb.go index 7b407301fb..7de57c637a 100644 --- a/protocol/x/vault/types/tx.pb.go +++ b/protocol/x/vault/types/tx.pb.go @@ -127,25 +127,25 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo -// MsgUpdateParams is the Msg/UpdateParams request type. -type MsgUpdateParams struct { +// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request type. +type MsgUpdateDefaultQuotingParams struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // The parameters to update. Each field must be set. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + // The quoting parameters to update to. Every field must be set. + DefaultQuotingParams QuotingParams `protobuf:"bytes,2,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` } -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { +func (m *MsgUpdateDefaultQuotingParams) Reset() { *m = MsgUpdateDefaultQuotingParams{} } +func (m *MsgUpdateDefaultQuotingParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateDefaultQuotingParams) ProtoMessage() {} +func (*MsgUpdateDefaultQuotingParams) Descriptor() ([]byte, []int) { return fileDescriptor_ced574c6017ce006, []int{2} } -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateDefaultQuotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateDefaultQuotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateDefaultQuotingParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -155,48 +155,48 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) +func (m *MsgUpdateDefaultQuotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateDefaultQuotingParams.Merge(m, src) } -func (m *MsgUpdateParams) XXX_Size() int { +func (m *MsgUpdateDefaultQuotingParams) XXX_Size() int { return m.Size() } -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +func (m *MsgUpdateDefaultQuotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateDefaultQuotingParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateDefaultQuotingParams proto.InternalMessageInfo -func (m *MsgUpdateParams) GetAuthority() string { +func (m *MsgUpdateDefaultQuotingParams) GetAuthority() string { if m != nil { return m.Authority } return "" } -func (m *MsgUpdateParams) GetParams() Params { +func (m *MsgUpdateDefaultQuotingParams) GetDefaultQuotingParams() QuotingParams { if m != nil { - return m.Params + return m.DefaultQuotingParams } - return Params{} + return QuotingParams{} } -// MsgUpdateParamsResponse is the Msg/UpdateParams response type. -type MsgUpdateParamsResponse struct { +// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams response type. +type MsgUpdateDefaultQuotingParamsResponse struct { } -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateDefaultQuotingParamsResponse) Reset() { *m = MsgUpdateDefaultQuotingParamsResponse{} } +func (m *MsgUpdateDefaultQuotingParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateDefaultQuotingParamsResponse) ProtoMessage() {} +func (*MsgUpdateDefaultQuotingParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_ced574c6017ce006, []int{3} } -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -206,61 +206,63 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse.Merge(m, src) } -func (m *MsgUpdateParamsResponse) XXX_Size() int { +func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgDepositToVault)(nil), "dydxprotocol.vault.MsgDepositToVault") proto.RegisterType((*MsgDepositToVaultResponse)(nil), "dydxprotocol.vault.MsgDepositToVaultResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "dydxprotocol.vault.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateParamsResponse") + proto.RegisterType((*MsgUpdateDefaultQuotingParams)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParams") + proto.RegisterType((*MsgUpdateDefaultQuotingParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse") } 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, 0xde, 0xec, 0x7b, 0xf3, 0x76, 0x8c, 0xea, 0x74, - 0x4a, 0x27, 0x7e, 0xc0, 0x05, 0xb7, 0xf8, 0xc8, 0x18, 0x93, 0x70, 0x24, 0x0c, 0x31, 0xd1, 0x65, - 0x06, 0xe3, 0x6c, 0x51, 0x97, 0x45, 0xb5, 0x66, 0x71, 0x70, 0x39, 0xf4, 0x65, 0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xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x67, 0x36, 0x31, 0xb6, 0x02, 0x04, 0x00, 0x00, + // 529 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x8d, 0x5b, 0x04, 0x74, 0x69, 0x23, 0xb1, 0x8a, 0x20, 0x75, 0x84, 0x53, 0x22, 0x15, 0x0a, + 0x52, 0x6c, 0xb5, 0xa0, 0x22, 0x7a, 0x82, 0xa8, 0x07, 0x22, 0x14, 0x89, 0x38, 0xc0, 0x01, 0x09, + 0x59, 0x1b, 0xef, 0xd6, 0xb1, 0x14, 0x7b, 0x1d, 0xef, 0x3a, 0x4a, 0x38, 0x72, 0xe4, 0xc4, 0x0f, + 0xf0, 0x0f, 0x1c, 0xf8, 0x06, 0xd4, 0x63, 0xc5, 0x09, 0x71, 0xa8, 0x50, 0x72, 0xe0, 0x1f, 0x38, + 0x21, 0xef, 0xda, 0x4d, 0x4c, 0xdc, 0x2a, 0xbd, 0x24, 0xb3, 0x33, 0xf3, 0x66, 0xe6, 0xbd, 0x19, + 0x19, 0x54, 0xf0, 0x18, 0x8f, 0x82, 0x90, 0x72, 0x6a, 0xd3, 0xbe, 0x31, 0x44, 0x51, 0x9f, 0x1b, + 0x7c, 0xa4, 0x0b, 0x0f, 0x84, 0xf3, 0x41, 0x5d, 0x04, 0xd5, 0x4d, 0x9b, 0x32, 0x8f, 0x32, 0x4b, + 0xb8, 0x0d, 0xf9, 0x90, 0xe9, 0xea, 0x6d, 0xf9, 0x32, 0x3c, 0xe6, 0x18, 0xc3, 0xdd, 0xf8, 0x2f, + 0x09, 0x3c, 0xc8, 0x34, 0x61, 0x51, 0x17, 0xd9, 0x36, 0x8d, 0x7c, 0xce, 0xe6, 0xec, 0x24, 0xb5, + 0x9a, 0x33, 0x4f, 0x80, 0x42, 0xe4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x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -277,8 +279,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // DepositToVault deposits funds into a vault. DepositToVault(ctx context.Context, in *MsgDepositToVault, opts ...grpc.CallOption) (*MsgDepositToVaultResponse, error) - // UpdateParams updates the Params in state. - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // UpdateDefaultQuotingParams updates the default quoting params in state. + UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) } type msgClient struct { @@ -298,9 +300,9 @@ func (c *msgClient) DepositToVault(ctx context.Context, in *MsgDepositToVault, o 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...) +func (c *msgClient) UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) { + out := new(MsgUpdateDefaultQuotingParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.vault.Msg/UpdateDefaultQuotingParams", in, out, opts...) if err != nil { return nil, err } @@ -311,8 +313,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) - // UpdateParams updates the Params in state. - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // UpdateDefaultQuotingParams updates the default quoting params in state. + UpdateDefaultQuotingParams(context.Context, *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -322,8 +324,8 @@ 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) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +func (*UnimplementedMsgServer) UpdateDefaultQuotingParams(ctx context.Context, req *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateDefaultQuotingParams not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -348,20 +350,20 @@ func _Msg_DepositToVault_Handler(srv interface{}, ctx context.Context, dec func( 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) +func _Msg_UpdateDefaultQuotingParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateDefaultQuotingParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) + return srv.(MsgServer).UpdateDefaultQuotingParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/dydxprotocol.vault.Msg/UpdateParams", + FullMethod: "/dydxprotocol.vault.Msg/UpdateDefaultQuotingParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + return srv.(MsgServer).UpdateDefaultQuotingParams(ctx, req.(*MsgUpdateDefaultQuotingParams)) } return interceptor(ctx, in, info, handler) } @@ -375,8 +377,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_DepositToVault_Handler, }, { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, + MethodName: "UpdateDefaultQuotingParams", + Handler: _Msg_UpdateDefaultQuotingParams_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -463,7 +465,7 @@ func (m *MsgDepositToVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateDefaultQuotingParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -473,18 +475,18 @@ func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateDefaultQuotingParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateDefaultQuotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.DefaultQuotingParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -503,7 +505,7 @@ func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateDefaultQuotingParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -513,12 +515,12 @@ func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateDefaultQuotingParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateDefaultQuotingParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -565,7 +567,7 @@ func (m *MsgDepositToVaultResponse) Size() (n int) { return n } -func (m *MsgUpdateParams) Size() (n int) { +func (m *MsgUpdateDefaultQuotingParams) Size() (n int) { if m == nil { return 0 } @@ -575,12 +577,12 @@ func (m *MsgUpdateParams) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.Params.Size() + l = m.DefaultQuotingParams.Size() n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgUpdateParamsResponse) Size() (n int) { +func (m *MsgUpdateDefaultQuotingParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -800,7 +802,7 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateDefaultQuotingParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -823,10 +825,10 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateDefaultQuotingParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateDefaultQuotingParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -863,7 +865,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -890,7 +892,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.DefaultQuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -915,7 +917,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateDefaultQuotingParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -938,10 +940,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateDefaultQuotingParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateDefaultQuotingParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/protocol/x/vault/types/vault.pb.go b/protocol/x/vault/types/vault.pb.go index 12b6c3d190..99577b61fe 100644 --- a/protocol/x/vault/types/vault.pb.go +++ b/protocol/x/vault/types/vault.pb.go @@ -5,11 +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" - types "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" io "io" math "math" math_bits "math/bits" @@ -109,184 +105,29 @@ func (m *VaultId) GetNumber() uint32 { return 0 } -// NumShares represents the number of shares in a vault. -type NumShares struct { - // Number of shares. - NumShares github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=num_shares,json=numShares,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"num_shares"` -} - -func (m *NumShares) Reset() { *m = NumShares{} } -func (m *NumShares) String() string { return proto.CompactTextString(m) } -func (*NumShares) ProtoMessage() {} -func (*NumShares) Descriptor() ([]byte, []int) { - return fileDescriptor_32accb5830bb2860, []int{1} -} -func (m *NumShares) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NumShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NumShares.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 *NumShares) XXX_Merge(src proto.Message) { - xxx_messageInfo_NumShares.Merge(m, src) -} -func (m *NumShares) XXX_Size() int { - return m.Size() -} -func (m *NumShares) XXX_DiscardUnknown() { - xxx_messageInfo_NumShares.DiscardUnknown(m) -} - -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 -} - -// VaultParams is the individual parameters of a vault. -type VaultParams struct { - // Lagged price that the vault quotes at. - LaggedPrice *types.MarketPrice `protobuf:"bytes,1,opt,name=lagged_price,json=laggedPrice,proto3" json:"lagged_price,omitempty"` -} - -func (m *VaultParams) Reset() { *m = VaultParams{} } -func (m *VaultParams) String() string { return proto.CompactTextString(m) } -func (*VaultParams) ProtoMessage() {} -func (*VaultParams) Descriptor() ([]byte, []int) { - return fileDescriptor_32accb5830bb2860, []int{3} -} -func (m *VaultParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VaultParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VaultParams.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 *VaultParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_VaultParams.Merge(m, src) -} -func (m *VaultParams) XXX_Size() int { - return m.Size() -} -func (m *VaultParams) XXX_DiscardUnknown() { - xxx_messageInfo_VaultParams.DiscardUnknown(m) -} - -var xxx_messageInfo_VaultParams proto.InternalMessageInfo - -func (m *VaultParams) GetLaggedPrice() *types.MarketPrice { - if m != nil { - return m.LaggedPrice - } - 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") - proto.RegisterType((*VaultParams)(nil), "dydxprotocol.vault.VaultParams") } func init() { proto.RegisterFile("dydxprotocol/vault/vault.proto", fileDescriptor_32accb5830bb2860) } var fileDescriptor_32accb5830bb2860 = []byte{ - // 439 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xb5, 0x11, 0x04, 0x65, 0x52, 0xa0, 0x5a, 0xaa, 0x2a, 0x44, 0xc2, 0x8d, 0x72, 0x40, 0x15, - 0x52, 0xd7, 0xa2, 0x80, 0xb8, 0x70, 0xa0, 0x09, 0x41, 0x44, 0x2a, 0x6d, 0x70, 0xd2, 0x4a, 0x70, - 0xb1, 0x36, 0xf6, 0xca, 0xb1, 0xb0, 0xbd, 0xd6, 0xee, 0x1a, 0x1a, 0xbe, 0x82, 0x8f, 0xe1, 0x23, - 0x7a, 0xac, 0x38, 0x21, 0x0e, 0x11, 0x4a, 0x7e, 0x04, 0x79, 0xd6, 0x44, 0x89, 0xe0, 0xd0, 0x8b, - 0xb5, 0x6f, 0xde, 0x1b, 0xbf, 0x9d, 0x37, 0x0b, 0x4e, 0x38, 0x0b, 0x2f, 0x72, 0x29, 0xb4, 0x08, - 0x44, 0xe2, 0x7e, 0x66, 0x45, 0xa2, 0xcd, 0x97, 0x62, 0x91, 0x90, 0x75, 0x9e, 0x22, 0xd3, 0x7a, - 0xb4, 0xd1, 0x93, 0xcb, 0x38, 0xe0, 0xca, 0x4d, 0x99, 0xfc, 0xc4, 0xb5, 0x8f, 0xc8, 0xf4, 0xb6, - 0x76, 0x22, 0x11, 0x09, 0x3c, 0x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x65, 0xc8, 0x24, 0x4b, 0x15, 0xe9, - 0xc1, 0x56, 0xc2, 0xa2, 0x88, 0x87, 0x66, 0x2d, 0x68, 0xde, 0x38, 0x6c, 0x6f, 0xfe, 0xcb, 0xec, - 0x8f, 0xbe, 0xc3, 0xfd, 0x0d, 0x4b, 0xe0, 0x35, 0x4c, 0x17, 0x82, 0xc7, 0x2f, 0xa1, 0xbe, 0x4a, - 0x9a, 0xb4, 0x60, 0xf7, 0xfc, 0xe8, 0xec, 0x78, 0xec, 0x8f, 0x3f, 0x0c, 0xfb, 0xfe, 0xd9, 0xc9, - 0x68, 0xd8, 0xef, 0x0d, 0xde, 0x0c, 0xfa, 0xaf, 0xb7, 0x2d, 0x72, 0x1f, 0xee, 0xad, 0x71, 0xbd, - 0xe3, 0xd3, 0xee, 0xb6, 0xdd, 0x7d, 0x7f, 0xb9, 0x70, 0xec, 0xab, 0x85, 0x63, 0xff, 0x5e, 0x38, - 0xf6, 0xb7, 0xa5, 0x63, 0x5d, 0x2d, 0x1d, 0xeb, 0xe7, 0xd2, 0xb1, 0x3e, 0xbe, 0xb8, 0x7e, 0xda, - 0x17, 0xd5, 0xc3, 0xc4, 0xd0, 0x27, 0x35, 0xac, 0x3f, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x5e, - 0x16, 0x11, 0xfd, 0xbb, 0x02, 0x00, 0x00, + // 222 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, 0x52, 0x08, 0x17, 0x7b, 0x18, 0x88, + 0xe1, 0x99, 0x22, 0x64, 0xc8, 0xc5, 0x52, 0x52, 0x59, 0x90, 0x2a, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x67, 0x24, 0xab, 0x87, 0xa9, 0x5a, 0x0f, 0xac, 0x34, 0xa4, 0xb2, 0x20, 0x35, 0x08, 0xac, 0x54, + 0x48, 0x8c, 0x8b, 0x2d, 0xaf, 0x34, 0x37, 0x29, 0xb5, 0x48, 0x82, 0x49, 0x81, 0x51, 0x83, 0x37, + 0x08, 0xca, 0xd3, 0xb2, 0xe1, 0xe2, 0x84, 0x2b, 0x15, 0x92, 0xe2, 0x12, 0x0b, 0x73, 0x0c, 0xf5, + 0x09, 0x89, 0x0f, 0x89, 0x0c, 0x70, 0x8d, 0x0f, 0xf5, 0x0b, 0x0e, 0x70, 0x75, 0xf6, 0x74, 0xf3, + 0x74, 0x75, 0x11, 0x60, 0x10, 0x12, 0xe6, 0xe2, 0x47, 0x92, 0x73, 0xf6, 0xf1, 0x77, 0x12, 0x60, + 0x74, 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, 0x54, 0xcf, 0x9a, 0xe8, 0x26, 0x67, 0x24, + 0x66, 0xe6, 0xe9, 0xc3, 0x45, 0x2a, 0xa0, 0x01, 0x00, 0x72, 0x67, 0x71, 0x12, 0x1b, 0x58, 0xdc, + 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x06, 0x99, 0xfd, 0x23, 0x01, 0x00, 0x00, } func (m *VaultId) Marshal() (dAtA []byte, err error) { @@ -322,116 +163,6 @@ func (m *VaultId) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *NumShares) 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 *NumShares) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NumShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.NumShares.Size() - i -= size - if _, err := m.NumShares.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintVault(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - 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 (m *VaultParams) 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 *VaultParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VaultParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LaggedPrice != nil { - { - size, err := m.LaggedPrice.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVault(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintVault(dAtA []byte, offset int, v uint64) int { offset -= sovVault(v) base := offset @@ -458,47 +189,6 @@ func (m *VaultId) Size() (n int) { return n } -func (m *NumShares) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NumShares.Size() - n += 1 + l + sovVault(uint64(l)) - 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 (m *VaultParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LaggedPrice != nil { - l = m.LaggedPrice.Size() - n += 1 + l + sovVault(uint64(l)) - } - return n -} - func sovVault(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -593,293 +283,6 @@ func (m *VaultId) Unmarshal(dAtA []byte) error { } return nil } -func (m *NumShares) 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: NumShares: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NumShares: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NumShares", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVault - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthVault - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthVault - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NumShares.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 (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 (m *VaultParams) 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: VaultParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VaultParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LaggedPrice", 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.LaggedPrice == nil { - m.LaggedPrice = &types.MarketPrice{} - } - if err := m.LaggedPrice.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 From 8e4009d84195cef63778d46d3a001d55ff2aa7b4 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Thu, 1 Aug 2024 14:14:56 -0400 Subject: [PATCH 02/10] implementation --- .../src/codegen/dydxprotocol/bundle.ts | 234 +++++++++--------- .../src/codegen/dydxprotocol/vault/genesis.ts | 41 +-- .../src/codegen/dydxprotocol/vault/params.ts | 22 +- .../src/codegen/dydxprotocol/vault/query.ts | 19 +- .../src/codegen/dydxprotocol/vault/share.ts | 126 ++++++++++ .../codegen/dydxprotocol/vault/tx.rpc.msg.ts | 16 +- .../src/codegen/dydxprotocol/vault/tx.ts | 76 +++--- .../src/codegen/dydxprotocol/vault/vault.ts | 182 -------------- .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 22 +- proto/dydxprotocol/vault/genesis.proto | 4 +- proto/dydxprotocol/vault/params.proto | 6 - proto/dydxprotocol/vault/tx.proto | 9 +- protocol/app/msgs/internal_msgs.go | 4 +- .../app/testdata/default_genesis_state.json | 2 +- protocol/app/upgrades/v5.0.0/upgrade.go | 6 +- protocol/app/upgrades/v5.2.0/upgrade.go | 21 +- protocol/lib/ante/internal_msg.go | 2 +- protocol/mocks/VaultKeeper.go | 20 +- .../scripts/genesis/sample_pregenesis.json | 2 +- protocol/testing/genesis.sh | 2 +- protocol/testutil/constants/genesis.go | 2 +- protocol/x/vault/client/cli/query_test.go | 2 +- protocol/x/vault/genesis.go | 13 +- protocol/x/vault/keeper/grpc_query.go | 4 +- protocol/x/vault/keeper/grpc_query_test.go | 2 +- ...g_server_update_default_quoting_params.go} | 12 +- ...ver_update_default_quoting_params_test.go} | 40 ++- protocol/x/vault/keeper/orders.go | 26 +- protocol/x/vault/keeper/orders_test.go | 82 +++--- protocol/x/vault/keeper/params.go | 46 ++-- protocol/x/vault/keeper/params_test.go | 71 +++--- protocol/x/vault/keeper/vault.go | 4 +- protocol/x/vault/keeper/vault_test.go | 4 +- protocol/x/vault/types/genesis.go | 9 +- protocol/x/vault/types/genesis.pb.go | 74 +++--- protocol/x/vault/types/keys.go | 10 +- protocol/x/vault/types/params.go | 13 +- protocol/x/vault/types/params.pb.go | 229 ++--------------- protocol/x/vault/types/params_test.go | 16 +- protocol/x/vault/types/tx.pb.go | 6 +- protocol/x/vault/types/types.go | 8 +- 42 files changed, 652 insertions(+), 841 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/share.ts rename protocol/x/vault/keeper/{msg_server_update_params.go => msg_server_update_default_quoting_params.go} (56%) rename protocol/x/vault/keeper/{msg_server_update_params_test.go => msg_server_update_default_quoting_params_test.go} (54%) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index e8a9124f45..21e5cb3e3c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -102,66 +102,67 @@ import * as _105 from "./subaccounts/subaccount"; import * as _106 from "./vault/genesis"; import * as _107 from "./vault/params"; import * as _108 from "./vault/query"; -import * as _109 from "./vault/tx"; -import * as _110 from "./vault/vault"; -import * as _111 from "./vest/genesis"; -import * as _112 from "./vest/query"; -import * as _113 from "./vest/tx"; -import * as _114 from "./vest/vest_entry"; -import * as _122 from "./assets/query.lcd"; -import * as _123 from "./blocktime/query.lcd"; -import * as _124 from "./bridge/query.lcd"; -import * as _125 from "./clob/query.lcd"; -import * as _126 from "./delaymsg/query.lcd"; -import * as _127 from "./epochs/query.lcd"; -import * as _128 from "./feetiers/query.lcd"; -import * as _129 from "./perpetuals/query.lcd"; -import * as _130 from "./prices/query.lcd"; -import * as _131 from "./ratelimit/query.lcd"; -import * as _132 from "./revshare/query.lcd"; -import * as _133 from "./rewards/query.lcd"; -import * as _134 from "./stats/query.lcd"; -import * as _135 from "./subaccounts/query.lcd"; -import * as _136 from "./vault/query.lcd"; -import * as _137 from "./vest/query.lcd"; -import * as _138 from "./assets/query.rpc.Query"; -import * as _139 from "./blocktime/query.rpc.Query"; -import * as _140 from "./bridge/query.rpc.Query"; -import * as _141 from "./clob/query.rpc.Query"; -import * as _142 from "./delaymsg/query.rpc.Query"; -import * as _143 from "./epochs/query.rpc.Query"; -import * as _144 from "./feetiers/query.rpc.Query"; -import * as _145 from "./govplus/query.rpc.Query"; -import * as _146 from "./listing/query.rpc.Query"; -import * as _147 from "./perpetuals/query.rpc.Query"; -import * as _148 from "./prices/query.rpc.Query"; -import * as _149 from "./ratelimit/query.rpc.Query"; -import * as _150 from "./revshare/query.rpc.Query"; -import * as _151 from "./rewards/query.rpc.Query"; -import * as _152 from "./sending/query.rpc.Query"; -import * as _153 from "./stats/query.rpc.Query"; -import * as _154 from "./subaccounts/query.rpc.Query"; -import * as _155 from "./vault/query.rpc.Query"; -import * as _156 from "./vest/query.rpc.Query"; -import * as _157 from "./blocktime/tx.rpc.msg"; -import * as _158 from "./bridge/tx.rpc.msg"; -import * as _159 from "./clob/tx.rpc.msg"; -import * as _160 from "./delaymsg/tx.rpc.msg"; -import * as _161 from "./feetiers/tx.rpc.msg"; -import * as _162 from "./govplus/tx.rpc.msg"; -import * as _163 from "./listing/tx.rpc.msg"; -import * as _164 from "./perpetuals/tx.rpc.msg"; -import * as _165 from "./prices/tx.rpc.msg"; -import * as _166 from "./ratelimit/tx.rpc.msg"; -import * as _167 from "./revshare/tx.rpc.msg"; -import * as _168 from "./rewards/tx.rpc.msg"; -import * as _169 from "./sending/tx.rpc.msg"; -import * as _170 from "./stats/tx.rpc.msg"; -import * as _171 from "./vault/tx.rpc.msg"; -import * as _172 from "./vest/tx.rpc.msg"; -import * as _173 from "./lcd"; -import * as _174 from "./rpc.query"; -import * as _175 from "./rpc.tx"; +import * as _109 from "./vault/share"; +import * as _110 from "./vault/tx"; +import * as _111 from "./vault/vault"; +import * as _112 from "./vest/genesis"; +import * as _113 from "./vest/query"; +import * as _114 from "./vest/tx"; +import * as _115 from "./vest/vest_entry"; +import * as _123 from "./assets/query.lcd"; +import * as _124 from "./blocktime/query.lcd"; +import * as _125 from "./bridge/query.lcd"; +import * as _126 from "./clob/query.lcd"; +import * as _127 from "./delaymsg/query.lcd"; +import * as _128 from "./epochs/query.lcd"; +import * as _129 from "./feetiers/query.lcd"; +import * as _130 from "./perpetuals/query.lcd"; +import * as _131 from "./prices/query.lcd"; +import * as _132 from "./ratelimit/query.lcd"; +import * as _133 from "./revshare/query.lcd"; +import * as _134 from "./rewards/query.lcd"; +import * as _135 from "./stats/query.lcd"; +import * as _136 from "./subaccounts/query.lcd"; +import * as _137 from "./vault/query.lcd"; +import * as _138 from "./vest/query.lcd"; +import * as _139 from "./assets/query.rpc.Query"; +import * as _140 from "./blocktime/query.rpc.Query"; +import * as _141 from "./bridge/query.rpc.Query"; +import * as _142 from "./clob/query.rpc.Query"; +import * as _143 from "./delaymsg/query.rpc.Query"; +import * as _144 from "./epochs/query.rpc.Query"; +import * as _145 from "./feetiers/query.rpc.Query"; +import * as _146 from "./govplus/query.rpc.Query"; +import * as _147 from "./listing/query.rpc.Query"; +import * as _148 from "./perpetuals/query.rpc.Query"; +import * as _149 from "./prices/query.rpc.Query"; +import * as _150 from "./ratelimit/query.rpc.Query"; +import * as _151 from "./revshare/query.rpc.Query"; +import * as _152 from "./rewards/query.rpc.Query"; +import * as _153 from "./sending/query.rpc.Query"; +import * as _154 from "./stats/query.rpc.Query"; +import * as _155 from "./subaccounts/query.rpc.Query"; +import * as _156 from "./vault/query.rpc.Query"; +import * as _157 from "./vest/query.rpc.Query"; +import * as _158 from "./blocktime/tx.rpc.msg"; +import * as _159 from "./bridge/tx.rpc.msg"; +import * as _160 from "./clob/tx.rpc.msg"; +import * as _161 from "./delaymsg/tx.rpc.msg"; +import * as _162 from "./feetiers/tx.rpc.msg"; +import * as _163 from "./govplus/tx.rpc.msg"; +import * as _164 from "./listing/tx.rpc.msg"; +import * as _165 from "./perpetuals/tx.rpc.msg"; +import * as _166 from "./prices/tx.rpc.msg"; +import * as _167 from "./ratelimit/tx.rpc.msg"; +import * as _168 from "./revshare/tx.rpc.msg"; +import * as _169 from "./rewards/tx.rpc.msg"; +import * as _170 from "./sending/tx.rpc.msg"; +import * as _171 from "./stats/tx.rpc.msg"; +import * as _172 from "./vault/tx.rpc.msg"; +import * as _173 from "./vest/tx.rpc.msg"; +import * as _174 from "./lcd"; +import * as _175 from "./rpc.query"; +import * as _176 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, ..._6 @@ -170,17 +171,17 @@ export namespace dydxprotocol { ..._8, ..._9, ..._10, - ..._122, - ..._138 + ..._123, + ..._139 }; export const blocktime = { ..._11, ..._12, ..._13, ..._14, ..._15, - ..._123, - ..._139, - ..._157 + ..._124, + ..._140, + ..._158 }; export const bridge = { ..._16, ..._17, @@ -188,9 +189,9 @@ export namespace dydxprotocol { ..._19, ..._20, ..._21, - ..._124, - ..._140, - ..._158 + ..._125, + ..._141, + ..._159 }; export const clob = { ..._22, ..._23, @@ -206,9 +207,9 @@ export namespace dydxprotocol { ..._33, ..._34, ..._35, - ..._125, - ..._141, - ..._159 + ..._126, + ..._142, + ..._160 }; export namespace daemons { export const bridge = { ..._36 @@ -223,29 +224,29 @@ export namespace dydxprotocol { ..._41, ..._42, ..._43, - ..._126, - ..._142, - ..._160 + ..._127, + ..._143, + ..._161 }; export const epochs = { ..._44, ..._45, ..._46, - ..._127, - ..._143 + ..._128, + ..._144 }; export const feetiers = { ..._47, ..._48, ..._49, ..._50, - ..._128, - ..._144, - ..._161 + ..._129, + ..._145, + ..._162 }; export const govplus = { ..._51, ..._52, ..._53, - ..._145, - ..._162 + ..._146, + ..._163 }; export namespace indexer { export const events = { ..._54 @@ -270,26 +271,26 @@ export namespace dydxprotocol { export const listing = { ..._63, ..._64, ..._65, - ..._146, - ..._163 + ..._147, + ..._164 }; export const perpetuals = { ..._66, ..._67, ..._68, ..._69, ..._70, - ..._129, - ..._147, - ..._164 + ..._130, + ..._148, + ..._165 }; export const prices = { ..._71, ..._72, ..._73, ..._74, ..._75, - ..._130, - ..._148, - ..._165 + ..._131, + ..._149, + ..._166 }; export const ratelimit = { ..._76, ..._77, @@ -297,71 +298,72 @@ export namespace dydxprotocol { ..._79, ..._80, ..._81, - ..._131, - ..._149, - ..._166 + ..._132, + ..._150, + ..._167 }; export const revshare = { ..._82, ..._83, ..._84, ..._85, ..._86, - ..._132, - ..._150, - ..._167 + ..._133, + ..._151, + ..._168 }; export const rewards = { ..._87, ..._88, ..._89, ..._90, ..._91, - ..._133, - ..._151, - ..._168 + ..._134, + ..._152, + ..._169 }; export const sending = { ..._92, ..._93, ..._94, ..._95, - ..._152, - ..._169 + ..._153, + ..._170 }; export const stats = { ..._96, ..._97, ..._98, ..._99, ..._100, - ..._134, - ..._153, - ..._170 + ..._135, + ..._154, + ..._171 }; export const subaccounts = { ..._101, ..._102, ..._103, ..._104, ..._105, - ..._135, - ..._154 + ..._136, + ..._155 }; export const vault = { ..._106, ..._107, ..._108, ..._109, ..._110, - ..._136, - ..._155, - ..._171 - }; - export const vest = { ..._111, - ..._112, - ..._113, - ..._114, + ..._111, ..._137, ..._156, ..._172 }; - export const ClientFactory = { ..._173, - ..._174, - ..._175 + export const vest = { ..._112, + ..._113, + ..._114, + ..._115, + ..._138, + ..._157, + ..._173 + }; + export const ClientFactory = { ..._174, + ..._175, + ..._176 }; } \ No newline at end of file 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 c36cf8b631..1db93c26ad 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts @@ -1,12 +1,13 @@ -import { Params, ParamsSDKType } from "./params"; -import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType, VaultParams, VaultParamsSDKType } from "./vault"; +import { QuotingParams, QuotingParamsSDKType } from "./params"; +import { VaultId, VaultIdSDKType } from "./vault"; +import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisState { - /** The parameters of the module. */ - params?: Params; + /** The default quoting parameters for all vaults. */ + defaultQuotingParams?: QuotingParams; /** The vaults. */ vaults: Vault[]; @@ -14,8 +15,8 @@ export interface GenesisState { /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisStateSDKType { - /** The parameters of the module. */ - params?: ParamsSDKType; + /** The default quoting parameters for all vaults. */ + default_quoting_params?: QuotingParamsSDKType; /** The vaults. */ vaults: VaultSDKType[]; @@ -31,9 +32,9 @@ export interface Vault { /** The shares of each owner in the vault. */ ownerShares: OwnerShare[]; - /** The individual parameters of the vault. */ + /** The quoting parameters of the vault. */ - vaultParams?: VaultParams; + quotingParams?: QuotingParams; /** The client IDs of the most recently placed orders of the vault. */ mostRecentClientIds: number[]; @@ -49,9 +50,9 @@ export interface VaultSDKType { /** The shares of each owner in the vault. */ owner_shares: OwnerShareSDKType[]; - /** The individual parameters of the vault. */ + /** The quoting parameters of the vault. */ - vault_params?: VaultParamsSDKType; + quoting_params?: QuotingParamsSDKType; /** The client IDs of the most recently placed orders of the vault. */ most_recent_client_ids: number[]; @@ -59,15 +60,15 @@ export interface VaultSDKType { function createBaseGenesisState(): GenesisState { return { - params: undefined, + defaultQuotingParams: undefined, vaults: [] }; } export const GenesisState = { encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + if (message.defaultQuotingParams !== undefined) { + QuotingParams.encode(message.defaultQuotingParams, writer.uint32(10).fork()).ldelim(); } for (const v of message.vaults) { @@ -87,7 +88,7 @@ export const GenesisState = { switch (tag >>> 3) { case 1: - message.params = Params.decode(reader, reader.uint32()); + message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); break; case 2: @@ -105,7 +106,7 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; message.vaults = object.vaults?.map(e => Vault.fromPartial(e)) || []; return message; } @@ -117,7 +118,7 @@ function createBaseVault(): Vault { vaultId: undefined, totalShares: undefined, ownerShares: [], - vaultParams: undefined, + quotingParams: undefined, mostRecentClientIds: [] }; } @@ -136,8 +137,8 @@ export const Vault = { OwnerShare.encode(v!, writer.uint32(26).fork()).ldelim(); } - if (message.vaultParams !== undefined) { - VaultParams.encode(message.vaultParams, writer.uint32(34).fork()).ldelim(); + if (message.quotingParams !== undefined) { + QuotingParams.encode(message.quotingParams, writer.uint32(34).fork()).ldelim(); } writer.uint32(42).fork(); @@ -172,7 +173,7 @@ export const Vault = { break; case 4: - message.vaultParams = VaultParams.decode(reader, reader.uint32()); + message.quotingParams = QuotingParams.decode(reader, reader.uint32()); break; case 5: @@ -202,7 +203,7 @@ export const Vault = { message.vaultId = object.vaultId !== undefined && object.vaultId !== null ? VaultId.fromPartial(object.vaultId) : undefined; message.totalShares = object.totalShares !== undefined && object.totalShares !== null ? NumShares.fromPartial(object.totalShares) : undefined; message.ownerShares = object.ownerShares?.map(e => OwnerShare.fromPartial(e)) || []; - message.vaultParams = object.vaultParams !== undefined && object.vaultParams !== null ? VaultParams.fromPartial(object.vaultParams) : undefined; + message.quotingParams = object.quotingParams !== undefined && object.quotingParams !== null ? QuotingParams.fromPartial(object.quotingParams) : undefined; message.mostRecentClientIds = object.mostRecentClientIds?.map(e => e) || []; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts index a134b265bf..c2a6e26e40 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts @@ -1,8 +1,8 @@ import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; -/** Params stores `x/vault` parameters. */ +/** QuotingParams stores vault quoting parameters. */ -export interface Params { +export interface QuotingParams { /** * The number of layers of orders a vault places. For example if * `layers=2`, a vault places 2 asks and 2 bids. @@ -36,9 +36,9 @@ export interface Params { activationThresholdQuoteQuantums: Uint8Array; } -/** Params stores `x/vault` parameters. */ +/** QuotingParams stores vault quoting parameters. */ -export interface ParamsSDKType { +export interface QuotingParamsSDKType { /** * The number of layers of orders a vault places. For example if * `layers=2`, a vault places 2 asks and 2 bids. @@ -73,7 +73,7 @@ export interface ParamsSDKType { activation_threshold_quote_quantums: Uint8Array; } -function createBaseParams(): Params { +function createBaseQuotingParams(): QuotingParams { return { layers: 0, spreadMinPpm: 0, @@ -85,8 +85,8 @@ function createBaseParams(): Params { }; } -export const Params = { - encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const QuotingParams = { + encode(message: QuotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.layers !== 0) { writer.uint32(8).uint32(message.layers); } @@ -118,10 +118,10 @@ export const Params = { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Params { + decode(input: _m0.Reader | Uint8Array, length?: number): QuotingParams { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParams(); + const message = createBaseQuotingParams(); while (reader.pos < end) { const tag = reader.uint32(); @@ -164,8 +164,8 @@ export const Params = { return message; }, - fromPartial(object: DeepPartial): Params { - const message = createBaseParams(); + fromPartial(object: DeepPartial): QuotingParams { + const message = createBaseQuotingParams(); message.layers = object.layers ?? 0; message.spreadMinPpm = object.spreadMinPpm ?? 0; message.spreadBufferPpm = object.spreadBufferPpm ?? 0; 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 2df1c39db1..8900bf4217 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts @@ -1,7 +1,8 @@ -import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType, NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./vault"; +import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType } from "./vault"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; -import { Params, ParamsSDKType } from "./params"; +import { QuotingParams, QuotingParamsSDKType } from "./params"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; +import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** QueryParamsRequest is a request type for the Params RPC method. */ @@ -13,12 +14,12 @@ export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is a response type for the Params RPC method. */ export interface QueryParamsResponse { - params?: Params; + defaultQuotingParams?: QuotingParams; } /** QueryParamsResponse is a response type for the Params RPC method. */ export interface QueryParamsResponseSDKType { - params?: ParamsSDKType; + default_quoting_params?: QuotingParamsSDKType; } /** QueryVaultRequest is a request type for the Vault RPC method. */ @@ -135,14 +136,14 @@ export const QueryParamsRequest = { function createBaseQueryParamsResponse(): QueryParamsResponse { return { - params: undefined + defaultQuotingParams: undefined }; } export const QueryParamsResponse = { encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + if (message.defaultQuotingParams !== undefined) { + QuotingParams.encode(message.defaultQuotingParams, writer.uint32(10).fork()).ldelim(); } return writer; @@ -158,7 +159,7 @@ export const QueryParamsResponse = { switch (tag >>> 3) { case 1: - message.params = Params.decode(reader, reader.uint32()); + message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); break; default: @@ -172,7 +173,7 @@ export const QueryParamsResponse = { fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/share.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/share.ts new file mode 100644 index 0000000000..33847a2ce1 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/share.ts @@ -0,0 +1,126 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** NumShares represents the number of shares in a vault. */ + +export interface NumShares { + /** Number of shares. */ + numShares: Uint8Array; +} +/** NumShares represents the number of shares in a vault. */ + +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 createBaseNumShares(): NumShares { + return { + numShares: new Uint8Array() + }; +} + +export const NumShares = { + encode(message: NumShares, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.numShares.length !== 0) { + writer.uint32(18).bytes(message.numShares); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NumShares { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNumShares(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 2: + message.numShares = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): NumShares { + const message = createBaseNumShares(); + message.numShares = object.numShares ?? new Uint8Array(); + 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/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..6f79eea71c 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,14 +1,14 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateDefaultQuotingParams, MsgUpdateDefaultQuotingParamsResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** DepositToVault deposits funds into a vault. */ depositToVault(request: MsgDepositToVault): Promise; - /** UpdateParams updates the Params in state. */ + /** UpdateDefaultQuotingParams updates the default quoting params in state. */ - updateParams(request: MsgUpdateParams): Promise; + updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -16,7 +16,7 @@ export class MsgClientImpl implements Msg { constructor(rpc: Rpc) { this.rpc = rpc; this.depositToVault = this.depositToVault.bind(this); - this.updateParams = this.updateParams.bind(this); + this.updateDefaultQuotingParams = this.updateDefaultQuotingParams.bind(this); } depositToVault(request: MsgDepositToVault): Promise { @@ -25,10 +25,10 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositToVaultResponse.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); - return promise.then(data => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise { + const data = MsgUpdateDefaultQuotingParams.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.vault.Msg", "UpdateDefaultQuotingParams", data); + return promise.then(data => MsgUpdateDefaultQuotingParamsResponse.decode(new _m0.Reader(data))); } } \ No newline at end of file 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 bf26ef337b..682b7c183e 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts @@ -1,6 +1,6 @@ import { VaultId, VaultIdSDKType } from "./vault"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; -import { Params, ParamsSDKType } from "./params"; +import { QuotingParams, QuotingParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** @@ -39,28 +39,40 @@ export interface MsgDepositToVaultResponse {} /** MsgDepositToVaultResponse is the Msg/DepositToVault response type. */ export interface MsgDepositToVaultResponseSDKType {} -/** MsgUpdateParams is the Msg/UpdateParams request type. */ +/** + * MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request + * type. + */ -export interface MsgUpdateParams { +export interface MsgUpdateDefaultQuotingParams { authority: string; - /** The parameters to update. Each field must be set. */ + /** The quoting parameters to update to. Every field must be set. */ - params?: Params; + defaultQuotingParams?: QuotingParams; } -/** MsgUpdateParams is the Msg/UpdateParams request type. */ +/** + * MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request + * type. + */ -export interface MsgUpdateParamsSDKType { +export interface MsgUpdateDefaultQuotingParamsSDKType { authority: string; - /** The parameters to update. Each field must be set. */ + /** The quoting parameters to update to. Every field must be set. */ - params?: ParamsSDKType; + default_quoting_params?: QuotingParamsSDKType; } -/** MsgUpdateParamsResponse is the Msg/UpdateParams response type. */ +/** + * MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams + * response type. + */ -export interface MsgUpdateParamsResponse {} -/** MsgUpdateParamsResponse is the Msg/UpdateParams response type. */ +export interface MsgUpdateDefaultQuotingParamsResponse {} +/** + * MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams + * response type. + */ -export interface MsgUpdateParamsResponseSDKType {} +export interface MsgUpdateDefaultQuotingParamsResponseSDKType {} function createBaseMsgDepositToVault(): MsgDepositToVault { return { @@ -161,30 +173,30 @@ export const MsgDepositToVaultResponse = { }; -function createBaseMsgUpdateParams(): MsgUpdateParams { +function createBaseMsgUpdateDefaultQuotingParams(): MsgUpdateDefaultQuotingParams { return { authority: "", - params: undefined + defaultQuotingParams: undefined }; } -export const MsgUpdateParams = { - encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateDefaultQuotingParams = { + encode(message: MsgUpdateDefaultQuotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.authority !== "") { writer.uint32(10).string(message.authority); } - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + if (message.defaultQuotingParams !== undefined) { + QuotingParams.encode(message.defaultQuotingParams, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateDefaultQuotingParams { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParams(); + const message = createBaseMsgUpdateDefaultQuotingParams(); while (reader.pos < end) { const tag = reader.uint32(); @@ -195,7 +207,7 @@ export const MsgUpdateParams = { break; case 2: - message.params = Params.decode(reader, reader.uint32()); + message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); break; default: @@ -207,28 +219,28 @@ export const MsgUpdateParams = { return message; }, - fromPartial(object: DeepPartial): MsgUpdateParams { - const message = createBaseMsgUpdateParams(); + fromPartial(object: DeepPartial): MsgUpdateDefaultQuotingParams { + const message = createBaseMsgUpdateDefaultQuotingParams(); message.authority = object.authority ?? ""; - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; return message; } }; -function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { +function createBaseMsgUpdateDefaultQuotingParamsResponse(): MsgUpdateDefaultQuotingParamsResponse { return {}; } -export const MsgUpdateParamsResponse = { - encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { +export const MsgUpdateDefaultQuotingParamsResponse = { + encode(_: MsgUpdateDefaultQuotingParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateDefaultQuotingParamsResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParamsResponse(); + const message = createBaseMsgUpdateDefaultQuotingParamsResponse(); while (reader.pos < end) { const tag = reader.uint32(); @@ -243,8 +255,8 @@ export const MsgUpdateParamsResponse = { return message; }, - fromPartial(_: DeepPartial): MsgUpdateParamsResponse { - const message = createBaseMsgUpdateParamsResponse(); + fromPartial(_: DeepPartial): MsgUpdateDefaultQuotingParamsResponse { + const message = createBaseMsgUpdateDefaultQuotingParamsResponse(); return message; } 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 19324e075d..631151db13 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/vault.ts @@ -1,4 +1,3 @@ -import { MarketPrice, MarketPriceSDKType } from "../prices/market_price"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** VaultType represents different types of vaults. */ @@ -68,42 +67,6 @@ export interface VaultIdSDKType { number: number; } -/** NumShares represents the number of shares in a vault. */ - -export interface NumShares { - /** Number of shares. */ - numShares: Uint8Array; -} -/** NumShares represents the number of shares in a vault. */ - -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; -} -/** VaultParams is the individual parameters of a vault. */ - -export interface VaultParams { - /** Lagged price that the vault quotes at. */ - laggedPrice?: MarketPrice; -} -/** VaultParams is the individual parameters of a vault. */ - -export interface VaultParamsSDKType { - /** Lagged price that the vault quotes at. */ - lagged_price?: MarketPriceSDKType; -} function createBaseVaultId(): VaultId { return { @@ -158,149 +121,4 @@ export const VaultId = { return message; } -}; - -function createBaseNumShares(): NumShares { - return { - numShares: new Uint8Array() - }; -} - -export const NumShares = { - encode(message: NumShares, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.numShares.length !== 0) { - writer.uint32(18).bytes(message.numShares); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): NumShares { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumShares(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 2: - message.numShares = reader.bytes(); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): NumShares { - const message = createBaseNumShares(); - message.numShares = object.numShares ?? new Uint8Array(); - 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; - } - -}; - -function createBaseVaultParams(): VaultParams { - return { - laggedPrice: undefined - }; -} - -export const VaultParams = { - encode(message: VaultParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.laggedPrice !== undefined) { - MarketPrice.encode(message.laggedPrice, writer.uint32(10).fork()).ldelim(); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VaultParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVaultParams(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.laggedPrice = MarketPrice.decode(reader, reader.uint32()); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): VaultParams { - const message = createBaseVaultParams(); - message.laggedPrice = object.laggedPrice !== undefined && object.laggedPrice !== null ? MarketPrice.fromPartial(object.laggedPrice) : undefined; - return message; - } - }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index bab2a6d4c7..709b81ce7c 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _115 from "./gogo"; -export const gogoproto = { ..._115 +import * as _116 from "./gogo"; +export const gogoproto = { ..._116 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index 93df913127..2cbfe8f57c 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _116 from "./api/annotations"; -import * as _117 from "./api/http"; -import * as _118 from "./protobuf/descriptor"; -import * as _119 from "./protobuf/duration"; -import * as _120 from "./protobuf/timestamp"; -import * as _121 from "./protobuf/any"; +import * as _117 from "./api/annotations"; +import * as _118 from "./api/http"; +import * as _119 from "./protobuf/descriptor"; +import * as _120 from "./protobuf/duration"; +import * as _121 from "./protobuf/timestamp"; +import * as _122 from "./protobuf/any"; export namespace google { - export const api = { ..._116, - ..._117 + export const api = { ..._117, + ..._118 }; - export const protobuf = { ..._118, - ..._119, + export const protobuf = { ..._119, ..._120, - ..._121 + ..._121, + ..._122 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index 44f621303f..2d60a5e7ad 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -24,8 +24,8 @@ message Vault { NumShares total_shares = 2; // The shares of each owner in the vault. repeated OwnerShare owner_shares = 3; - // The individual parameters of the vault. - VaultParams vault_params = 4; + // The quoting parameters of the vault. + QuotingParams quoting_params = 4; // The client IDs of the most recently placed orders of the vault. repeated uint32 most_recent_client_ids = 5; } diff --git a/proto/dydxprotocol/vault/params.proto b/proto/dydxprotocol/vault/params.proto index 258f9d911e..8fd02e1bb8 100644 --- a/proto/dydxprotocol/vault/params.proto +++ b/proto/dydxprotocol/vault/params.proto @@ -38,9 +38,3 @@ message QuotingParams { (gogoproto.nullable) = false ]; } - -// VaultParams stores individual parameters of a vault. -message VaultParams { - // The quoting parameters specific to this vault. - QuotingParams quoting_params = 1 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/dydxprotocol/vault/tx.proto b/proto/dydxprotocol/vault/tx.proto index 6f17fd0bdb..9ff3068552 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -16,7 +16,8 @@ service Msg { rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); // UpdateDefaultQuotingParams updates the default quoting params in state. - rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) returns (MsgUpdateDefaultQuotingParamsResponse); + rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) + returns (MsgUpdateDefaultQuotingParamsResponse); } // MsgDepositToVault deposits the specified asset from the subaccount to the @@ -44,7 +45,8 @@ message MsgDepositToVault { // MsgDepositToVaultResponse is the Msg/DepositToVault response type. message MsgDepositToVaultResponse {} -// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request type. +// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request +// type. message MsgUpdateDefaultQuotingParams { // Authority is the address that controls the module. option (cosmos.msg.v1.signer) = "authority"; @@ -54,5 +56,6 @@ message MsgUpdateDefaultQuotingParams { QuotingParams default_quoting_params = 2 [ (gogoproto.nullable) = false ]; } -// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams response type. +// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams +// response type. message MsgUpdateDefaultQuotingParamsResponse {} diff --git a/protocol/app/msgs/internal_msgs.go b/protocol/app/msgs/internal_msgs.go index a1a2889af0..9d43de6c6f 100644 --- a/protocol/app/msgs/internal_msgs.go +++ b/protocol/app/msgs/internal_msgs.go @@ -186,8 +186,8 @@ var ( "/dydxprotocol.stats.MsgUpdateParamsResponse": nil, // vault - "/dydxprotocol.vault.MsgUpdateParams": &vault.MsgUpdateParams{}, - "/dydxprotocol.vault.MsgUpdateParamsResponse": nil, + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": &vault.MsgUpdateDefaultQuotingParams{}, + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": nil, // vest "/dydxprotocol.vest.MsgSetVestEntry": &vest.MsgSetVestEntry{}, diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index cdcd06887a..c501b74aec 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -481,7 +481,7 @@ }, "upgrade": {}, "vault": { - "params": { + "default_quoting_params": { "layers": 2, "spread_min_ppm": 10000, "spread_buffer_ppm": 1500, diff --git a/protocol/app/upgrades/v5.0.0/upgrade.go b/protocol/app/upgrades/v5.0.0/upgrade.go index 5935fa19f2..5a74597eda 100644 --- a/protocol/app/upgrades/v5.0.0/upgrade.go +++ b/protocol/app/upgrades/v5.0.0/upgrade.go @@ -292,9 +292,9 @@ func initializeVaultModuleParams( ctx sdk.Context, vaultKeeper vaulttypes.VaultKeeper, ) { - // Set vault module parameters to default values. - vaultParams := vaulttypes.DefaultParams() - if err := vaultKeeper.SetParams(ctx, vaultParams); err != nil { + // Set vault module quoting parameters to default values. + defaultQuotingParams := vaulttypes.DefaultQuotingParams() + if err := vaultKeeper.SetDefaultQuotingParams(ctx, defaultQuotingParams); err != nil { panic(fmt.Sprintf("failed to set vault module parameters: %s", err)) } ctx.Logger().Info("Successfully set vault module parameters") diff --git a/protocol/app/upgrades/v5.2.0/upgrade.go b/protocol/app/upgrades/v5.2.0/upgrade.go index b79c82be76..9502d84705 100644 --- a/protocol/app/upgrades/v5.2.0/upgrade.go +++ b/protocol/app/upgrades/v5.2.0/upgrade.go @@ -44,18 +44,19 @@ func addAllVaultsToVaultAddressStore( } } -// setVaultOrderExpirationSecondsToSixty sets vault module param `OrderExpirationSeconds` to 60. +// Deprecated: setVaultOrderExpirationSecondsToSixty sets vault module param `OrderExpirationSeconds` to 60. +// This function is deprecated because `Params` in `x/vault` is replaced with `DefaultQuotingParams` in v6.x. func setVaultOrderExpirationSecondsToSixty( ctx sdk.Context, vaultKeeper vaultkeeper.Keeper, ) { - params := vaultKeeper.GetParams(ctx) - params.OrderExpirationSeconds = 60 - err := vaultKeeper.SetParams( - ctx, - params, - ) - if err != nil { - panic(err) - } + // params := vaultKeeper.GetParams(ctx) + // params.OrderExpirationSeconds = 60 + // err := vaultKeeper.SetParams( + // ctx, + // params, + // ) + // if err != nil { + // panic(err) + // } } diff --git a/protocol/lib/ante/internal_msg.go b/protocol/lib/ante/internal_msg.go index 767732576f..a0951c5d8c 100644 --- a/protocol/lib/ante/internal_msg.go +++ b/protocol/lib/ante/internal_msg.go @@ -126,7 +126,7 @@ func IsInternalMsg(msg sdk.Msg) bool { *stats.MsgUpdateParams, // vault - *vault.MsgUpdateParams, + *vault.MsgUpdateDefaultQuotingParams, // vest *vest.MsgDeleteVestEntry, diff --git a/protocol/mocks/VaultKeeper.go b/protocol/mocks/VaultKeeper.go index 1489fc65be..b2af9b08f1 100644 --- a/protocol/mocks/VaultKeeper.go +++ b/protocol/mocks/VaultKeeper.go @@ -18,19 +18,19 @@ type VaultKeeper struct { mock.Mock } -// GetParams provides a mock function with given fields: ctx -func (_m *VaultKeeper) GetParams(ctx types.Context) vaulttypes.Params { +// GetDefaultQuotingParams provides a mock function with given fields: ctx +func (_m *VaultKeeper) GetDefaultQuotingParams(ctx types.Context) vaulttypes.QuotingParams { ret := _m.Called(ctx) if len(ret) == 0 { - panic("no return value specified for GetParams") + panic("no return value specified for GetDefaultQuotingParams") } - var r0 vaulttypes.Params - if rf, ok := ret.Get(0).(func(types.Context) vaulttypes.Params); ok { + var r0 vaulttypes.QuotingParams + if rf, ok := ret.Get(0).(func(types.Context) vaulttypes.QuotingParams); ok { r0 = rf(ctx) } else { - r0 = ret.Get(0).(vaulttypes.Params) + r0 = ret.Get(0).(vaulttypes.QuotingParams) } return r0 @@ -183,16 +183,16 @@ func (_m *VaultKeeper) RefreshVaultClobOrders(ctx types.Context, vaultId vaultty return r0 } -// SetParams provides a mock function with given fields: ctx, params -func (_m *VaultKeeper) SetParams(ctx types.Context, params vaulttypes.Params) error { +// SetDefaultQuotingParams provides a mock function with given fields: ctx, params +func (_m *VaultKeeper) SetDefaultQuotingParams(ctx types.Context, params vaulttypes.QuotingParams) error { ret := _m.Called(ctx, params) if len(ret) == 0 { - panic("no return value specified for SetParams") + panic("no return value specified for SetDefaultQuotingParams") } var r0 error - if rf, ok := ret.Get(0).(func(types.Context, vaulttypes.Params) error); ok { + if rf, ok := ret.Get(0).(func(types.Context, vaulttypes.QuotingParams) error); ok { r0 = rf(ctx, params) } else { r0 = ret.Error(0) diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index bac8d0d185..dd13b8592a 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -3902,7 +3902,7 @@ }, "upgrade": {}, "vault": { - "params": { + "default_quoting_params": { "activation_threshold_quote_quantums": "1000000000", "layers": 2, "order_expiration_seconds": 60, diff --git a/protocol/testing/genesis.sh b/protocol/testing/genesis.sh index b6fe2ea02e..1a18ba1694 100755 --- a/protocol/testing/genesis.sh +++ b/protocol/testing/genesis.sh @@ -2234,7 +2234,7 @@ function edit_genesis() { # Vaults # Set vault params. - dasel put -t int -f "$GENESIS" ".app_state.vault.params.spread_min_ppm" -v '3000' + dasel put -t int -f "$GENESIS" ".app_state.vault.default_quoting_params.spread_min_ppm" -v '3000' # Set total shares and owner shares of each vault. vault_idx=0 if [ -z "${INPUT_TEST_ACCOUNTS[0]}" ]; then diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index fd3231fa60..5b9260cb31 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -4514,7 +4514,7 @@ const GenesisState = `{ }, "upgrade": {}, "vault": { - "params": { + "default_quoting_params": { "layers": 2, "spread_min_ppm": 10000, "spread_buffer_ppm": 1500, diff --git a/protocol/x/vault/client/cli/query_test.go b/protocol/x/vault/client/cli/query_test.go index 3811612cb5..c192cf25f6 100644 --- a/protocol/x/vault/client/cli/query_test.go +++ b/protocol/x/vault/client/cli/query_test.go @@ -50,5 +50,5 @@ func TestQueryParams(t *testing.T) { require.NoError(t, err) var resp types.QueryParamsResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.Equal(t, types.DefaultGenesis().Params, resp.Params) + require.Equal(t, types.DefaultGenesis().DefaultQuotingParams, resp.DefaultQuotingParams) } diff --git a/protocol/x/vault/genesis.go b/protocol/x/vault/genesis.go index d3bcba48cb..45bceb2fcd 100644 --- a/protocol/x/vault/genesis.go +++ b/protocol/x/vault/genesis.go @@ -10,15 +10,16 @@ import ( func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { k.InitializeForGenesis(ctx) - // Set params. - if err := k.SetParams(ctx, genState.Params); err != nil { + // Set default quoting params. + if err := k.SetDefaultQuotingParams(ctx, &genState.DefaultQuotingParams); err != nil { panic(err) } // For each vault: // 1. Set total shares // 2. Set owner shares // 3. Set vault params - // 4. Add to address store + // 4. Set most recent client ids + // 5. Add to address store for _, vault := range genState.Vaults { if err := k.SetTotalShares(ctx, *vault.VaultId, *vault.TotalShares); err != nil { panic(err) @@ -28,8 +29,8 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) panic(err) } } - if vault.VaultParams != nil { - if err := k.SetVaultParams(ctx, *vault.VaultId, *vault.VaultParams); err != nil { + if vault.QuotingParams != nil { + if err := k.SetVaultQuotingParams(ctx, *vault.VaultId, vault.QuotingParams); err != nil { panic(err) } } @@ -43,7 +44,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() // Export params. - genesis.Params = k.GetParams(ctx) + genesis.DefaultQuotingParams = k.GetDefaultQuotingParams(ctx) // Export vaults. genesis.Vaults = k.GetAllVaults(ctx) diff --git a/protocol/x/vault/keeper/grpc_query.go b/protocol/x/vault/keeper/grpc_query.go index dd9c7c4624..bb5a84e3ae 100644 --- a/protocol/x/vault/keeper/grpc_query.go +++ b/protocol/x/vault/keeper/grpc_query.go @@ -17,5 +17,7 @@ func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*t } ctx := lib.UnwrapSDKContext(goCtx, types.ModuleName) - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + return &types.QueryParamsResponse{ + DefaultQuotingParams: k.GetDefaultQuotingParams(ctx), + }, nil } diff --git a/protocol/x/vault/keeper/grpc_query_test.go b/protocol/x/vault/keeper/grpc_query_test.go index 95d8f840c0..f7c90fc426 100644 --- a/protocol/x/vault/keeper/grpc_query_test.go +++ b/protocol/x/vault/keeper/grpc_query_test.go @@ -23,7 +23,7 @@ func TestQueryParams(t *testing.T) { "Success": { req: &types.QueryParamsRequest{}, res: &types.QueryParamsResponse{ - Params: types.DefaultGenesis().Params, + DefaultQuotingParams: types.DefaultQuotingParams(), }, err: nil, }, diff --git a/protocol/x/vault/keeper/msg_server_update_params.go b/protocol/x/vault/keeper/msg_server_update_default_quoting_params.go similarity index 56% rename from protocol/x/vault/keeper/msg_server_update_params.go rename to protocol/x/vault/keeper/msg_server_update_default_quoting_params.go index 4f987f5da2..5e3222d55e 100644 --- a/protocol/x/vault/keeper/msg_server_update_params.go +++ b/protocol/x/vault/keeper/msg_server_update_default_quoting_params.go @@ -10,11 +10,11 @@ import ( "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" ) -// UpdateParams updates the parameters of the vault module. -func (k msgServer) UpdateParams( +// UpdateDefaultQuotingParams updates the default quoting parameters of the vault module. +func (k msgServer) UpdateDefaultQuotingParams( goCtx context.Context, - msg *types.MsgUpdateParams, -) (*types.MsgUpdateParamsResponse, error) { + msg *types.MsgUpdateDefaultQuotingParams, +) (*types.MsgUpdateDefaultQuotingParamsResponse, error) { if !k.HasAuthority(msg.Authority) { return nil, errorsmod.Wrapf( govtypes.ErrInvalidSigner, @@ -24,9 +24,9 @@ func (k msgServer) UpdateParams( } ctx := lib.UnwrapSDKContext(goCtx, types.ModuleName) - if err := k.SetParams(ctx, msg.Params); err != nil { + if err := k.SetDefaultQuotingParams(ctx, &msg.DefaultQuotingParams); err != nil { return nil, err } - return &types.MsgUpdateParamsResponse{}, nil + return &types.MsgUpdateDefaultQuotingParamsResponse{}, nil } diff --git a/protocol/x/vault/keeper/msg_server_update_params_test.go b/protocol/x/vault/keeper/msg_server_update_default_quoting_params_test.go similarity index 54% rename from protocol/x/vault/keeper/msg_server_update_params_test.go rename to protocol/x/vault/keeper/msg_server_update_default_quoting_params_test.go index 39843f9945..64da998a17 100644 --- a/protocol/x/vault/keeper/msg_server_update_params_test.go +++ b/protocol/x/vault/keeper/msg_server_update_default_quoting_params_test.go @@ -14,30 +14,44 @@ import ( "github.com/stretchr/testify/require" ) -func TestMsgUpdateParams(t *testing.T) { +func TestMsgUpdateDefaultQuotingParams(t *testing.T) { tests := map[string]struct { // Msg. - msg *types.MsgUpdateParams + msg *types.MsgUpdateDefaultQuotingParams // Expected error expectedErr string }{ - "Success": { - msg: &types.MsgUpdateParams{ + "Success. Update to default": { + msg: &types.MsgUpdateDefaultQuotingParams{ + Authority: lib.GovModuleAddress.String(), + DefaultQuotingParams: types.DefaultQuotingParams(), + }, + }, + "Success. Update to non-default": { + msg: &types.MsgUpdateDefaultQuotingParams{ Authority: lib.GovModuleAddress.String(), - Params: types.DefaultParams(), + DefaultQuotingParams: types.QuotingParams{ + Layers: 3, + SpreadMinPpm: 234_567, + SpreadBufferPpm: 6_789, + SkewFactorPpm: 321_123, + OrderSizePctPpm: 255_678, + OrderExpirationSeconds: 120, + ActivationThresholdQuoteQuantums: dtypes.NewInt(2_121_343_787), + }, }, }, "Failure - Invalid Authority": { - msg: &types.MsgUpdateParams{ - Authority: constants.AliceAccAddress.String(), - Params: types.DefaultParams(), + msg: &types.MsgUpdateDefaultQuotingParams{ + Authority: constants.AliceAccAddress.String(), + DefaultQuotingParams: types.DefaultQuotingParams(), }, expectedErr: "invalid authority", }, "Failure - Invalid Params": { - msg: &types.MsgUpdateParams{ + msg: &types.MsgUpdateDefaultQuotingParams{ Authority: lib.GovModuleAddress.String(), - Params: types.Params{ + DefaultQuotingParams: types.QuotingParams{ Layers: 3, SpreadMinPpm: 4_000, SpreadBufferPpm: 2_000, @@ -58,13 +72,13 @@ func TestMsgUpdateParams(t *testing.T) { k := tApp.App.VaultKeeper ms := keeper.NewMsgServerImpl(k) - _, err := ms.UpdateParams(ctx, tc.msg) + _, err := ms.UpdateDefaultQuotingParams(ctx, tc.msg) if tc.expectedErr != "" { require.ErrorContains(t, err, tc.expectedErr) - require.Equal(t, types.DefaultParams(), k.GetParams(ctx)) + require.Equal(t, types.DefaultQuotingParams(), k.GetDefaultQuotingParams(ctx)) } else { require.NoError(t, err) - require.Equal(t, tc.msg.Params, k.GetParams(ctx)) + require.Equal(t, tc.msg.DefaultQuotingParams, k.GetDefaultQuotingParams(ctx)) } }) } diff --git a/protocol/x/vault/keeper/orders.go b/protocol/x/vault/keeper/orders.go index 990867eb55..76d2651b02 100644 --- a/protocol/x/vault/keeper/orders.go +++ b/protocol/x/vault/keeper/orders.go @@ -20,7 +20,6 @@ import ( // 2. Placing new orders. func (k Keeper) RefreshAllVaultOrders(ctx sdk.Context) { // Iterate through all vaults. - params := k.GetParams(ctx) numActiveVaults := 0 totalSharesIterator := k.getTotalSharesIterator(ctx) defer totalSharesIterator.Close() @@ -41,7 +40,8 @@ func (k Keeper) RefreshAllVaultOrders(ctx sdk.Context) { // Skip if vault has no perpetual positions and strictly less than `activation_threshold_quote_quantums` USDC. vault := k.subaccountsKeeper.GetSubaccount(ctx, *vaultId.ToSubaccountId()) if vault.PerpetualPositions == nil || len(vault.PerpetualPositions) == 0 { - if vault.GetUsdcPosition().Cmp(params.ActivationThresholdQuoteQuantums.BigInt()) == -1 { + quotingParams := k.GetVaultQuotingParams(ctx, *vaultId) + if vault.GetUsdcPosition().Cmp(quotingParams.ActivationThresholdQuoteQuantums.BigInt()) == -1 { continue } } @@ -207,11 +207,11 @@ func (k Keeper) GetVaultClobOrders( leveragePpm := new(big.Int).Mul(openNotional, lib.BigIntOneMillion()) leveragePpm.Quo(leveragePpm, equity) - // Get parameters. - params := k.GetParams(ctx) + // Get quoting parameters. + quotingParams := k.GetVaultQuotingParams(ctx, vaultId) // Calculate order size (in base quantums). - orderSizePctPpm := lib.BigU(params.OrderSizePctPpm) + orderSizePctPpm := lib.BigU(quotingParams.OrderSizePctPpm) orderSize := lib.QuoteToBaseQuantums( new(big.Int).Mul(equity, orderSizePctPpm), perpetual.Params.AtomicResolution, @@ -241,8 +241,8 @@ func (k Keeper) GetVaultClobOrders( // Calculate spread. spreadPpm := lib.BigU(lib.Max( - params.SpreadMinPpm, - params.SpreadBufferPpm+marketParam.MinPriceChangePpm, + quotingParams.SpreadMinPpm, + quotingParams.SpreadBufferPpm+marketParam.MinPriceChangePpm, )) // Get oracle price in subticks. oracleSubticks := clobtypes.PriceToSubticks( @@ -253,9 +253,9 @@ func (k Keeper) GetVaultClobOrders( ) // Get order expiration time. goodTilBlockTime := &clobtypes.Order_GoodTilBlockTime{ - GoodTilBlockTime: uint32(ctx.BlockTime().Unix()) + params.OrderExpirationSeconds, + GoodTilBlockTime: uint32(ctx.BlockTime().Unix()) + quotingParams.OrderExpirationSeconds, } - skewFactorPpm := lib.BigU(params.SkewFactorPpm) + skewFactorPpm := lib.BigU(quotingParams.SkewFactorPpm) // Construct one ask and one bid for each layer. constructOrder := func( @@ -353,8 +353,8 @@ func (k Keeper) GetVaultClobOrders( if err != nil { return orders, err } - orders = make([]*clobtypes.Order, 2*params.Layers) - for i := uint32(0); i < params.Layers; i++ { + orders = make([]*clobtypes.Order, 2*quotingParams.Layers) + for i := uint32(0); i < quotingParams.Layers; i++ { // Construct ask at this layer. orders[2*i] = constructOrder(clobtypes.Order_SIDE_SELL, i, orderIds[2*i]) @@ -393,7 +393,7 @@ func (k Keeper) GetVaultClobOrderIds( } } - layers := k.GetParams(ctx).Layers + layers := k.GetVaultQuotingParams(ctx, vaultId).Layers orderIds = make([]*clobtypes.OrderId, 2*layers) for i := uint32(0); i < layers; i++ { // Construct ask order ID at this layer. @@ -435,7 +435,7 @@ func (k Keeper) ReplaceVaultClobOrder( // Cancel old order. err := k.clobKeeper.HandleMsgCancelOrder(ctx, clobtypes.NewMsgCancelOrderStateful( *oldOrderId, - uint32(ctx.BlockTime().Unix())+k.GetParams(ctx).OrderExpirationSeconds, + uint32(ctx.BlockTime().Unix())+k.GetVaultQuotingParams(ctx, vaultId).OrderExpirationSeconds, )) vaultId.IncrCounterWithLabels( metrics.VaultCancelOrder, diff --git a/protocol/x/vault/keeper/orders_test.go b/protocol/x/vault/keeper/orders_test.go index 70a8c2f1b2..08b3844b3a 100644 --- a/protocol/x/vault/keeper/orders_test.go +++ b/protocol/x/vault/keeper/orders_test.go @@ -146,11 +146,11 @@ func TestRefreshAllVaultOrders(t *testing.T) { testapp.UpdateGenesisDocWithAppStateForModule( &genesis, func(genesisState *vaulttypes.GenesisState) { - vaultParams := genesisState.Params - vaultParams.ActivationThresholdQuoteQuantums = dtypes.NewIntFromBigInt( + defaultQuotingParams := genesisState.DefaultQuotingParams + defaultQuotingParams.ActivationThresholdQuoteQuantums = dtypes.NewIntFromBigInt( tc.activationThresholdQuoteQuantums, ) - genesisState.Params = vaultParams + genesisState.DefaultQuotingParams = defaultQuotingParams }, ) return genesis @@ -237,11 +237,12 @@ func TestRefreshVaultClobOrders(t *testing.T) { "Success - Orders refresh due to expiration": { vaultId: constants.Vault_Clob0, advanceBlock: func(ctx sdk.Context, tApp *testapp.TestApp) sdk.Context { + orderExpirationSeconds := vaulttypes.DefaultQuotingParams().OrderExpirationSeconds return tApp.AdvanceToBlock( uint32(tApp.GetBlockHeight())+5, testapp.AdvanceToBlockOptions{ BlockTime: ctx.BlockTime().Add( - time.Second * time.Duration(vaulttypes.DefaultParams().OrderExpirationSeconds), + time.Second * time.Duration(orderExpirationSeconds), ), }, ) @@ -315,7 +316,7 @@ func TestRefreshVaultClobOrders(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { // Initialize tApp. - params := vaulttypes.DefaultParams() + defaultQuotingParams := vaulttypes.DefaultQuotingParams() tApp := testapp.NewTestAppBuilder(t).WithGenesisDocFn(func() (genesis types.GenesisDoc) { genesis = testapp.DefaultGenesis() testapp.UpdateGenesisDocWithAppStateForModule( @@ -349,7 +350,7 @@ func TestRefreshVaultClobOrders(t *testing.T) { AssetPositions: []*satypes.AssetPosition{ testutil.CreateSingleAssetPosition( assettypes.AssetUsdc.Id, - params.ActivationThresholdQuoteQuantums.BigInt(), + defaultQuotingParams.ActivationThresholdQuoteQuantums.BigInt(), ), }, }, @@ -358,7 +359,7 @@ func TestRefreshVaultClobOrders(t *testing.T) { AssetPositions: []*satypes.AssetPosition{ testutil.CreateSingleAssetPosition( assettypes.AssetUsdc.Id, - params.ActivationThresholdQuoteQuantums.BigInt(), + defaultQuotingParams.ActivationThresholdQuoteQuantums.BigInt(), ), }, }, @@ -380,7 +381,7 @@ func TestRefreshVaultClobOrders(t *testing.T) { verifyVaultOrders := func(expectedGTBT uint32, expectedClientIds []uint32) { allStatefulOrders := tApp.App.ClobKeeper.GetAllStatefulOrders(ctx) // Verify that number of vault orders is `layers * 2`. - require.Len(t, allStatefulOrders, int(params.Layers*2)) + require.Len(t, allStatefulOrders, int(defaultQuotingParams.Layers*2)) // Verify that GTBT of orders is as expected. for _, order := range allStatefulOrders { require.Equal(t, expectedGTBT, order.GetGoodTilBlockTime()) @@ -407,28 +408,28 @@ func TestRefreshVaultClobOrders(t *testing.T) { // Vault should place its initial orders (client IDs should be canonical). initialOrders := tApp.App.ClobKeeper.GetAllStatefulOrders(ctx) - require.Len(t, initialOrders, int(params.Layers*2)) + require.Len(t, initialOrders, int(defaultQuotingParams.Layers*2)) verifyVaultOrders( - uint32(ctx.BlockTime().Unix())+params.OrderExpirationSeconds, + uint32(ctx.BlockTime().Unix())+defaultQuotingParams.OrderExpirationSeconds, canonicalClientIds, ) if tc.ordersShouldRefresh { ctx = tc.advanceBlock(ctx, tApp) verifyVaultOrders( - uint32(ctx.BlockTime().Unix())+params.OrderExpirationSeconds, + uint32(ctx.BlockTime().Unix())+defaultQuotingParams.OrderExpirationSeconds, flippedClientIds, // Client IDs should be flipped. ) ctx = tc.advanceBlock(ctx, tApp) verifyVaultOrders( - uint32(ctx.BlockTime().Unix())+params.OrderExpirationSeconds, + uint32(ctx.BlockTime().Unix())+defaultQuotingParams.OrderExpirationSeconds, canonicalClientIds, // Client IDs should be back to canonical. ) } else { oldBlockTime := uint32(ctx.BlockTime().Unix()) ctx = tc.advanceBlock(ctx, tApp) verifyVaultOrders( - oldBlockTime+params.OrderExpirationSeconds, + oldBlockTime+defaultQuotingParams.OrderExpirationSeconds, canonicalClientIds, ) } @@ -439,8 +440,8 @@ func TestRefreshVaultClobOrders(t *testing.T) { func TestGetVaultClobOrders(t *testing.T) { tests := map[string]struct { /* --- Setup --- */ - // Vault params. - vaultParams vaulttypes.Params + // Vault quoting params. + vaultQuotingParams vaulttypes.QuotingParams // Vault ID. vaultId vaulttypes.VaultId // Vault asset. @@ -462,7 +463,7 @@ func TestGetVaultClobOrders(t *testing.T) { expectedErr error }{ "Success - Vault Clob 0, 2 layers, leverage 0, doesn't cross oracle price": { - vaultParams: vaulttypes.Params{ + vaultQuotingParams: vaulttypes.QuotingParams{ Layers: 2, // 2 layers SpreadMinPpm: 3_123, // 31.23 bps SpreadBufferPpm: 1_500, // 15 bps @@ -536,7 +537,7 @@ func TestGetVaultClobOrders(t *testing.T) { }, }, "Success - Vault Clob 1, 3 layers, leverage -0.6, doesn't cross oracle price": { - vaultParams: vaulttypes.Params{ + vaultQuotingParams: vaulttypes.QuotingParams{ Layers: 3, // 3 layers SpreadMinPpm: 7_654, // 76.54 bps SpreadBufferPpm: 2_900, // 29 bps @@ -616,7 +617,7 @@ func TestGetVaultClobOrders(t *testing.T) { }, }, "Success - Vault Clob 1, 3 layers, leverage -3, crosses oracle price": { - vaultParams: vaulttypes.Params{ + vaultQuotingParams: vaulttypes.QuotingParams{ Layers: 3, // 3 layers SpreadMinPpm: 3_000, // 30 bps SpreadBufferPpm: 8_500, // 85 bps @@ -696,7 +697,7 @@ func TestGetVaultClobOrders(t *testing.T) { }, }, "Success - Vault Clob 1, 2 layers, leverage 3, crosses oracle price": { - vaultParams: vaulttypes.Params{ + vaultQuotingParams: vaulttypes.QuotingParams{ Layers: 2, // 2 layers SpreadMinPpm: 3_000, // 30 bps SpreadBufferPpm: 1_500, // 15 bps @@ -764,7 +765,7 @@ func TestGetVaultClobOrders(t *testing.T) { }, }, "Success - Get orders from Vault for Clob Pair 1, No Orders due to Zero Order Size": { - vaultParams: vaulttypes.Params{ + vaultQuotingParams: vaulttypes.QuotingParams{ Layers: 2, // 2 layers SpreadMinPpm: 3_000, // 30 bps SpreadBufferPpm: 1_500, // 15 bps @@ -788,16 +789,16 @@ func TestGetVaultClobOrders(t *testing.T) { expectedOrderQuantums: []uint64{}, }, "Error - Clob Pair doesn't exist": { - vaultParams: vaulttypes.DefaultParams(), - vaultId: constants.Vault_Clob0, - clobPair: constants.ClobPair_Eth, - marketParam: constants.TestMarketParams[1], - marketPrice: constants.TestMarketPrices[1], - perpetual: constants.EthUsd_NoMarginRequirement, - expectedErr: vaulttypes.ErrClobPairNotFound, + vaultQuotingParams: vaulttypes.DefaultQuotingParams(), + vaultId: constants.Vault_Clob0, + clobPair: constants.ClobPair_Eth, + marketParam: constants.TestMarketParams[1], + marketPrice: constants.TestMarketPrices[1], + perpetual: constants.EthUsd_NoMarginRequirement, + expectedErr: vaulttypes.ErrClobPairNotFound, }, "Error - Vault equity is zero": { - vaultParams: vaulttypes.DefaultParams(), + vaultQuotingParams: vaulttypes.DefaultQuotingParams(), vaultId: constants.Vault_Clob0, vaultAssetQuoteQuantums: big.NewInt(0), vaultInventoryBaseQuantums: big.NewInt(0), @@ -808,7 +809,7 @@ func TestGetVaultClobOrders(t *testing.T) { expectedErr: vaulttypes.ErrNonPositiveEquity, }, "Error - Vault equity is negative": { - vaultParams: vaulttypes.DefaultParams(), + vaultQuotingParams: vaulttypes.DefaultQuotingParams(), vaultId: constants.Vault_Clob0, vaultAssetQuoteQuantums: big.NewInt(5_000_000), // 5 USDC vaultInventoryBaseQuantums: big.NewInt(-10_000_000), @@ -819,7 +820,7 @@ func TestGetVaultClobOrders(t *testing.T) { expectedErr: vaulttypes.ErrNonPositiveEquity, }, "Error - Market price is zero": { - vaultParams: vaulttypes.DefaultParams(), + vaultQuotingParams: vaulttypes.DefaultQuotingParams(), vaultId: constants.Vault_Clob0, vaultAssetQuoteQuantums: big.NewInt(1_000_000_000), // 1,000 USDC vaultInventoryBaseQuantums: big.NewInt(0), @@ -863,13 +864,6 @@ func TestGetVaultClobOrders(t *testing.T) { genesisState.ClobPairs = []clobtypes.ClobPair{tc.clobPair} }, ) - // Initialize vault module with test params. - testapp.UpdateGenesisDocWithAppStateForModule( - &genesis, - func(genesisState *vaulttypes.GenesisState) { - genesisState.Params = tc.vaultParams - }, - ) // Initialize subaccounts module with vault's equity and inventory. testapp.UpdateGenesisDocWithAppStateForModule( &genesis, @@ -909,6 +903,10 @@ func TestGetVaultClobOrders(t *testing.T) { }).Build() ctx := tApp.InitChain() + // Set vault quoting parameters. + err := tApp.App.VaultKeeper.SetVaultQuotingParams(ctx, tc.vaultId, &tc.vaultQuotingParams) + require.NoError(t, err) + // Get vault orders. orders, err := tApp.App.VaultKeeper.GetVaultClobOrders(ctx, tc.vaultId) if tc.expectedErr != nil { @@ -918,7 +916,7 @@ func TestGetVaultClobOrders(t *testing.T) { require.NoError(t, err) // Get expected orders. - params := tApp.App.VaultKeeper.GetParams(ctx) + vaultQuotingParams := tApp.App.VaultKeeper.GetVaultQuotingParams(ctx, tc.vaultId) buildVaultClobOrder := func( layer uint8, side clobtypes.Order_Side, @@ -936,7 +934,7 @@ func TestGetVaultClobOrders(t *testing.T) { Quantums: quantums, Subticks: subticks, GoodTilOneof: &clobtypes.Order_GoodTilBlockTime{ - GoodTilBlockTime: uint32(ctx.BlockTime().Unix()) + params.OrderExpirationSeconds, + GoodTilBlockTime: uint32(ctx.BlockTime().Unix()) + vaultQuotingParams.OrderExpirationSeconds, }, } } @@ -1012,9 +1010,9 @@ func TestGetVaultClobOrderIds(t *testing.T) { ctx := tApp.InitChain() // Set number of layers. - params := k.GetParams(ctx) - params.Layers = tc.layers - err := k.SetParams(ctx, params) + quotingParams := k.GetVaultQuotingParams(ctx, tc.vaultId) + quotingParams.Layers = tc.layers + err := k.SetVaultQuotingParams(ctx, tc.vaultId, "ingParams) require.NoError(t, err) // Construct expected order IDs. diff --git a/protocol/x/vault/keeper/params.go b/protocol/x/vault/keeper/params.go index bb0138feb7..5e60903565 100644 --- a/protocol/x/vault/keeper/params.go +++ b/protocol/x/vault/keeper/params.go @@ -6,67 +6,67 @@ import ( "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" ) -// GetParams returns `Params` in state. -func (k Keeper) GetParams( +// GetDefaultQuotingParams returns `DefaultQuotingParams` in state. +func (k Keeper) GetDefaultQuotingParams( ctx sdk.Context, ) ( - params types.Params, + params types.QuotingParams, ) { store := ctx.KVStore(k.storeKey) - b := store.Get([]byte(types.ParamsKey)) + b := store.Get([]byte(types.DefaultQuotingParamsKey)) k.cdc.MustUnmarshal(b, ¶ms) return params } -// SetParams updates `Params` in state. +// SetDefaultQuotingParams updates `DefaultQuotingParams` in state. // Returns an error if validation fails. -func (k Keeper) SetParams( +func (k Keeper) SetDefaultQuotingParams( ctx sdk.Context, - params types.Params, + params *types.QuotingParams, ) error { if err := params.Validate(); err != nil { return err } store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), b) + b := k.cdc.MustMarshal(params) + store.Set([]byte(types.DefaultQuotingParamsKey), b) return nil } -// GetVaultParams returns `VaultParams` in state for a given vault. -func (k Keeper) GetVaultParams( +// GetVaultQuotingParams returns `QuotingParams` in state for a given vault, if it exists, +// and otherwise, returns module-wide `DefaultQuotingParams`. +func (k Keeper) GetVaultQuotingParams( ctx sdk.Context, vaultId types.VaultId, ) ( - vaultParams types.VaultParams, - exists bool, + quotingParams types.QuotingParams, ) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.VaultParamsKeyPrefix)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.QuotingParamsKeyPrefix)) b := store.Get(vaultId.ToStateKey()) if b == nil { - return vaultParams, false + return k.GetDefaultQuotingParams(ctx) } - k.cdc.MustUnmarshal(b, &vaultParams) - return vaultParams, true + k.cdc.MustUnmarshal(b, "ingParams) + return quotingParams } -// SetVaultParams sets `VaultParams` in state for a given vault. +// SetVaultQuotingParams sets `QuotingParams` in state for a given vault. // Returns an error if validation fails. -func (k Keeper) SetVaultParams( +func (k Keeper) SetVaultQuotingParams( ctx sdk.Context, vaultId types.VaultId, - vaultParams types.VaultParams, + qoutingParams *types.QuotingParams, ) error { - if err := vaultParams.Validate(); err != nil { + if err := qoutingParams.Validate(); err != nil { return err } - b := k.cdc.MustMarshal(&vaultParams) - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.VaultParamsKeyPrefix)) + b := k.cdc.MustMarshal(qoutingParams) + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.QuotingParamsKeyPrefix)) store.Set(vaultId.ToStateKey(), b) return nil diff --git a/protocol/x/vault/keeper/params_test.go b/protocol/x/vault/keeper/params_test.go index 160521520b..35d31756e6 100644 --- a/protocol/x/vault/keeper/params_test.go +++ b/protocol/x/vault/keeper/params_test.go @@ -6,22 +6,21 @@ import ( "github.com/dydxprotocol/v4-chain/protocol/dtypes" testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" - pricestypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" "github.com/stretchr/testify/require" ) -func TestGetSetParams(t *testing.T) { +func TestGetSetDefaultQuotingParams(t *testing.T) { tApp := testapp.NewTestAppBuilder(t).Build() ctx := tApp.InitChain() k := tApp.App.VaultKeeper // Params should have default values at genesis. - params := k.GetParams(ctx) - require.Equal(t, types.DefaultParams(), params) + params := k.GetDefaultQuotingParams(ctx) + require.Equal(t, types.DefaultQuotingParams(), params) // Set new params and get. - newParams := types.Params{ + newParams := &types.QuotingParams{ Layers: 3, SpreadMinPpm: 4_000, SpreadBufferPpm: 2_000, @@ -30,12 +29,12 @@ func TestGetSetParams(t *testing.T) { OrderExpirationSeconds: 10, ActivationThresholdQuoteQuantums: dtypes.NewInt(1_000_000_000), } - err := k.SetParams(ctx, newParams) + err := k.SetDefaultQuotingParams(ctx, newParams) require.NoError(t, err) - require.Equal(t, newParams, k.GetParams(ctx)) + require.Equal(t, newParams, k.GetDefaultQuotingParams(ctx)) // Set invalid params and get. - invalidParams := types.Params{ + invalidParams := &types.QuotingParams{ Layers: 3, SpreadMinPpm: 4_000, SpreadBufferPpm: 2_000, @@ -44,37 +43,51 @@ func TestGetSetParams(t *testing.T) { OrderExpirationSeconds: 0, // invalid ActivationThresholdQuoteQuantums: dtypes.NewInt(1_000_000_000), } - err = k.SetParams(ctx, invalidParams) + err = k.SetDefaultQuotingParams(ctx, invalidParams) require.Error(t, err) - require.Equal(t, newParams, k.GetParams(ctx)) + require.Equal(t, newParams, k.GetDefaultQuotingParams(ctx)) } -func TestGetSetVaultParams(t *testing.T) { +func TestGetSetVaultQuotingParams(t *testing.T) { tApp := testapp.NewTestAppBuilder(t).Build() ctx := tApp.InitChain() k := tApp.App.VaultKeeper - // Get non-existent vault params. - _, exists := k.GetVaultParams(ctx, constants.Vault_Clob0) - require.False(t, exists) + // Should get default quoting params. + quotingParams := k.GetVaultQuotingParams(ctx, constants.Vault_Clob0) + require.Equal(t, types.DefaultQuotingParams(), quotingParams) - // Set vault params of vault clob 0. - vaultClob0Params := types.VaultParams{ - LaggedPrice: &pricestypes.MarketPrice{ - Id: uint32(0), - Exponent: -5, - Price: 123_456_789, - }, + // Set quoting params of vault clob 0. + vaultClob0QuotingParams := &types.QuotingParams{ + Layers: 3, + SpreadMinPpm: 12_345, + SpreadBufferPpm: 5_678, + SkewFactorPpm: 4_121_787, + OrderSizePctPpm: 232_121, + OrderExpirationSeconds: 120, + ActivationThresholdQuoteQuantums: dtypes.NewInt(2_123_456_789), } - err := k.SetVaultParams(ctx, constants.Vault_Clob0, vaultClob0Params) + err := k.SetVaultQuotingParams(ctx, constants.Vault_Clob0, vaultClob0QuotingParams) require.NoError(t, err) - // Get vault params of vault clob 0. - params, exists := k.GetVaultParams(ctx, constants.Vault_Clob0) - require.True(t, exists) - require.Equal(t, vaultClob0Params, params) + // Get quoting params of vault clob 0. + quotingParams = k.GetVaultQuotingParams(ctx, constants.Vault_Clob0) + require.Equal(t, vaultClob0QuotingParams, quotingParams) + + // Set quoting params of vault clob 1. + vaultClob1QuotingParams := &types.QuotingParams{ + Layers: 4, + SpreadMinPpm: 123_456, + SpreadBufferPpm: 87_654, + SkewFactorPpm: 5_432_111, + OrderSizePctPpm: 444_333, + OrderExpirationSeconds: 90, + ActivationThresholdQuoteQuantums: dtypes.NewInt(1_111_111_111), + } + err = k.SetVaultQuotingParams(ctx, constants.Vault_Clob1, vaultClob1QuotingParams) + require.NoError(t, err) - // Get vault params of vault clob 1. - _, exists = k.GetVaultParams(ctx, constants.Vault_Clob1) - require.False(t, exists) + // Get quoting params of vault clob 1. + quotingParams = k.GetVaultQuotingParams(ctx, constants.Vault_Clob1) + require.Equal(t, vaultClob1QuotingParams, quotingParams) } diff --git a/protocol/x/vault/keeper/vault.go b/protocol/x/vault/keeper/vault.go index 1e84880277..1f7923c432 100644 --- a/protocol/x/vault/keeper/vault.go +++ b/protocol/x/vault/keeper/vault.go @@ -139,7 +139,7 @@ func (k Keeper) GetAllVaults(ctx sdk.Context) []*types.Vault { allOwnerShares := k.GetAllOwnerShares(ctx, *vaultId) - vaultParams, _ := k.GetVaultParams(ctx, *vaultId) + quotingParams := k.GetVaultQuotingParams(ctx, *vaultId) mostRecentClientIds := k.GetMostRecentClientIds(ctx, *vaultId) @@ -147,7 +147,7 @@ func (k Keeper) GetAllVaults(ctx sdk.Context) []*types.Vault { VaultId: vaultId, TotalShares: &totalShares, OwnerShares: allOwnerShares, - VaultParams: &vaultParams, + QuotingParams: "ingParams, MostRecentClientIds: mostRecentClientIds, }) } diff --git a/protocol/x/vault/keeper/vault_test.go b/protocol/x/vault/keeper/vault_test.go index ebbfc7858c..d38675c5b0 100644 --- a/protocol/x/vault/keeper/vault_test.go +++ b/protocol/x/vault/keeper/vault_test.go @@ -214,15 +214,13 @@ func TestDecommissionVault(t *testing.T) { // Decommission vault. k.DecommissionVault(ctx, tc.vaultId) - // Check that total shares, owner shares, vault params, and vault address are deleted. + // Check that total shares, owner shares, and vault address are deleted. _, exists := k.GetTotalShares(ctx, tc.vaultId) require.Equal(t, false, exists) for _, owner := range tc.owners { _, exists = k.GetOwnerShares(ctx, tc.vaultId, owner) require.Equal(t, false, exists) } - _, exists = k.GetVaultParams(ctx, tc.vaultId) - require.False(t, exists) require.False(t, k.IsVault(ctx, tc.vaultId.ToModuleAccountAddress())) }) } diff --git a/protocol/x/vault/types/genesis.go b/protocol/x/vault/types/genesis.go index 60b8053f12..bb1cf66f36 100644 --- a/protocol/x/vault/types/genesis.go +++ b/protocol/x/vault/types/genesis.go @@ -3,7 +3,7 @@ package types // DefaultGenesis returns the default stats genesis state. func DefaultGenesis() *GenesisState { return &GenesisState{ - Params: DefaultParams(), + DefaultQuotingParams: DefaultQuotingParams(), } } @@ -11,7 +11,7 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Validate params. - if err := gs.Params.Validate(); err != nil { + if err := gs.DefaultQuotingParams.Validate(); err != nil { return err } @@ -36,6 +36,11 @@ func (gs GenesisState) Validate() error { if totalShares.Sign() != 0 { return ErrMismatchedTotalAndOwnerShares } + if vault.QuotingParams != nil { + if err := vault.QuotingParams.Validate(); err != nil { + return err + } + } } return nil } diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 2e5fdbf32e..4178643168 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -86,8 +86,8 @@ type Vault struct { TotalShares *NumShares `protobuf:"bytes,2,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` // The shares of each owner in the vault. OwnerShares []*OwnerShare `protobuf:"bytes,3,rep,name=owner_shares,json=ownerShares,proto3" json:"owner_shares,omitempty"` - // The individual parameters of the vault. - VaultParams *VaultParams `protobuf:"bytes,4,opt,name=vault_params,json=vaultParams,proto3" json:"vault_params,omitempty"` + // The quoting parameters of the vault. + QuotingParams *QuotingParams `protobuf:"bytes,4,opt,name=quoting_params,json=quotingParams,proto3" json:"quoting_params,omitempty"` // The client IDs of the most recently placed orders of the vault. MostRecentClientIds []uint32 `protobuf:"varint,5,rep,packed,name=most_recent_client_ids,json=mostRecentClientIds,proto3" json:"most_recent_client_ids,omitempty"` } @@ -146,9 +146,9 @@ func (m *Vault) GetOwnerShares() []*OwnerShare { return nil } -func (m *Vault) GetVaultParams() *VaultParams { +func (m *Vault) GetQuotingParams() *QuotingParams { if m != nil { - return m.VaultParams + return m.QuotingParams } return nil } @@ -169,31 +169,31 @@ func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescrip var fileDescriptor_4be4a747b209e41c = []byte{ // 397 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcf, 0xee, 0xd2, 0x30, - 0x1c, 0xdf, 0x7e, 0xfc, 0xd1, 0x74, 0xf3, 0x52, 0x09, 0x41, 0x8c, 0x65, 0x72, 0xe2, 0xe2, 0x16, - 0xc1, 0xe8, 0x55, 0xf1, 0x60, 0xb8, 0xa8, 0x94, 0xc4, 0x83, 0x89, 0x59, 0xc6, 0x56, 0xc7, 0x92, - 0x6d, 0xc5, 0xb5, 0x43, 0x78, 0x0b, 0x1f, 0xc1, 0x17, 0xf1, 0xce, 0x91, 0xa3, 0x27, 0x63, 0xe0, - 0x45, 0x4c, 0xbf, 0x9d, 0x28, 0x71, 0x78, 0xe9, 0xda, 0xcf, 0xbf, 0x7e, 0xf6, 0x4d, 0x91, 0x13, - 0xed, 0xa2, 0xed, 0xba, 0xe0, 0x92, 0x87, 0x3c, 0xf5, 0x36, 0x41, 0x99, 0x4a, 0x2f, 0x66, 0x39, - 0x13, 0x89, 0x70, 0x01, 0xc6, 0xf8, 0x6f, 0x85, 0x0b, 0x8a, 0x7e, 0x27, 0xe6, 0x31, 0x07, 0xcc, - 0x53, 0x3b, 0xad, 0xec, 0x0f, 0x6a, 0xb2, 0xd6, 0x41, 0x11, 0x64, 0x55, 0x54, 0x9f, 0xd4, 0x08, - 0xc4, 0x2a, 0x28, 0xd8, 0x7f, 0x78, 0x58, 0x35, 0x3f, 0xfc, 0x6a, 0x22, 0xfb, 0x95, 0x2e, 0xb7, - 0x90, 0x81, 0x64, 0xf8, 0x03, 0xea, 0x46, 0xec, 0xa3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0x9d, + 0x94, 0x79, 0x2c, 0x91, 0x8e, 0x17, 0x85, 0xea, 0x13, 0xfa, 0xa2, 0x5b, 0x37, 0xab, 0xc3, 0x16, + 0xbd, 0xaf, 0x54, 0x0a, 0xe2, 0x6b, 0xd0, 0xa6, 0xbe, 0x98, 0xcc, 0xf6, 0x47, 0xa2, 0x1f, 0x8e, + 0x44, 0xff, 0x7d, 0x24, 0xfa, 0xb7, 0x13, 0xd1, 0x0e, 0x27, 0xa2, 0xfd, 0x3c, 0x11, 0xed, 0xd3, + 0x8b, 0x20, 0x94, 0xcb, 0x6c, 0x61, 0x79, 0x3c, 0xb6, 0x2f, 0x5f, 0xcb, 0xb3, 0x27, 0xde, 0xd2, + 0x0d, 0x13, 0xfb, 0xdc, 0xd9, 0x16, 0x2f, 0x48, 0xee, 0x56, 0x4c, 0x2c, 0x1a, 0xd0, 0x1f, 0xff, + 0x09, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x11, 0xf8, 0x4e, 0xf1, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -281,9 +281,9 @@ func (m *Vault) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if m.VaultParams != nil { + if m.QuotingParams != nil { { - size, err := m.VaultParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.QuotingParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -382,8 +382,8 @@ func (m *Vault) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.VaultParams != nil { - l = m.VaultParams.Size() + if m.QuotingParams != nil { + l = m.QuotingParams.Size() n += 1 + l + sovGenesis(uint64(l)) } if len(m.MostRecentClientIds) > 0 { @@ -656,7 +656,7 @@ func (m *Vault) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VaultParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuotingParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -683,10 +683,10 @@ func (m *Vault) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.VaultParams == nil { - m.VaultParams = &VaultParams{} + if m.QuotingParams == nil { + m.QuotingParams = &QuotingParams{} } - if err := m.VaultParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.QuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/protocol/x/vault/types/keys.go b/protocol/x/vault/types/keys.go index a019d80715..14468ab3c4 100644 --- a/protocol/x/vault/types/keys.go +++ b/protocol/x/vault/types/keys.go @@ -18,11 +18,13 @@ const ( // OwnerShares store: vaultId VaultId -> owner string -> shares NumShares. OwnerSharesKeyPrefix = "OwnerShares:" - // ParamsKey is the key to retrieve Params. - ParamsKey = "Params" + // DefaultQuotingParams is the key to retrieve DefaultQuotingParams. + // A vault uses DefaultQuotingParams if it does not have its own QuotingParams. + DefaultQuotingParamsKey = "DefaultQuotingParams" - // VaultParamsKeyPrefix is the prefix to retrieve all VaultParams. - VaultParamsKeyPrefix = "VaultParams:" + // QuotingParamsKeyPrefix is the prefix to retrieve all QuotingParams. + // QuotingParams store: vaultId VaultId -> QuotingParams. + QuotingParamsKeyPrefix = "QuotingParams:" // VaultAddressKeyPrefix is the prefix to retrieve all vault addresses. VaultAddressKeyPrefix = "VaultAddress:" diff --git a/protocol/x/vault/types/params.go b/protocol/x/vault/types/params.go index e55aa24f31..648af682a9 100644 --- a/protocol/x/vault/types/params.go +++ b/protocol/x/vault/types/params.go @@ -6,9 +6,9 @@ import ( "github.com/dydxprotocol/v4-chain/protocol/dtypes" ) -// DefaultParams returns a default set of `x/vault` parameters. -func DefaultParams() Params { - return Params{ +// DefaultQuotingParams returns a default set of `x/vault` parameters. +func DefaultQuotingParams() QuotingParams { + return QuotingParams{ Layers: 2, // 2 layers SpreadMinPpm: 10_000, // 100 bps SpreadBufferPpm: 1_500, // 15 bps @@ -20,7 +20,7 @@ func DefaultParams() Params { } // Validate validates `x/vault` parameters. -func (p Params) Validate() error { +func (p QuotingParams) Validate() error { // Layers must be less than or equal to MaxUint8. if p.Layers > math.MaxUint8 { return ErrInvalidLayers @@ -44,8 +44,3 @@ func (p Params) Validate() error { return nil } - -// Validate validates individual vault parameters. -func (v VaultParams) Validate() error { - return nil -} diff --git a/protocol/x/vault/types/params.pb.go b/protocol/x/vault/types/params.pb.go index c0cb987a96..643054ecf9 100644 --- a/protocol/x/vault/types/params.pb.go +++ b/protocol/x/vault/types/params.pb.go @@ -123,89 +123,39 @@ func (m *QuotingParams) GetOrderExpirationSeconds() uint32 { return 0 } -// VaultParams stores individual parameters of a vault. -type VaultParams struct { - // The quoting parameters specific to this vault. - QuotingParams QuotingParams `protobuf:"bytes,1,opt,name=quoting_params,json=quotingParams,proto3" json:"quoting_params"` -} - -func (m *VaultParams) Reset() { *m = VaultParams{} } -func (m *VaultParams) String() string { return proto.CompactTextString(m) } -func (*VaultParams) ProtoMessage() {} -func (*VaultParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6043e0b8bfdbca9f, []int{1} -} -func (m *VaultParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VaultParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VaultParams.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 *VaultParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_VaultParams.Merge(m, src) -} -func (m *VaultParams) XXX_Size() int { - return m.Size() -} -func (m *VaultParams) XXX_DiscardUnknown() { - xxx_messageInfo_VaultParams.DiscardUnknown(m) -} - -var xxx_messageInfo_VaultParams proto.InternalMessageInfo - -func (m *VaultParams) GetQuotingParams() QuotingParams { - if m != nil { - return m.QuotingParams - } - return QuotingParams{} -} - func init() { proto.RegisterType((*QuotingParams)(nil), "dydxprotocol.vault.QuotingParams") - proto.RegisterType((*VaultParams)(nil), "dydxprotocol.vault.VaultParams") } func init() { proto.RegisterFile("dydxprotocol/vault/params.proto", fileDescriptor_6043e0b8bfdbca9f) } var fileDescriptor_6043e0b8bfdbca9f = []byte{ - // 433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x8b, 0xd4, 0x30, - 0x18, 0xc6, 0xa7, 0xee, 0x3a, 0x42, 0x76, 0x67, 0x17, 0x8b, 0x2c, 0xc5, 0x43, 0x67, 0x5c, 0x45, - 0x16, 0xc5, 0x16, 0x54, 0xd0, 0xa3, 0x0c, 0x28, 0x7a, 0x50, 0xe6, 0x8f, 0x78, 0x10, 0x24, 0x64, - 0xd2, 0x4c, 0x1b, 0x6c, 0x93, 0x34, 0x49, 0xd7, 0x99, 0xf9, 0x14, 0xde, 0xbc, 0xfb, 0x69, 0xf6, - 0xb8, 0x47, 0xf1, 0xb0, 0xc8, 0xcc, 0x17, 0x91, 0xbc, 0xa9, 0xab, 0x83, 0x97, 0xbd, 0xb5, 0xcf, - 0xf3, 0x4b, 0xde, 0xbe, 0xfc, 0x8a, 0xfa, 0xd9, 0x32, 0x5b, 0x28, 0x2d, 0xad, 0xa4, 0xb2, 0x4c, - 0x4f, 0x49, 0x53, 0xda, 0x54, 0x11, 0x4d, 0x2a, 0x93, 0x40, 0x1a, 0x86, 0xff, 0x02, 0x09, 0x00, - 0xb7, 0x6f, 0xe5, 0x32, 0x97, 0x90, 0xa5, 0xee, 0xc9, 0x93, 0xc7, 0xdf, 0x77, 0x50, 0x6f, 0xdc, - 0x48, 0xcb, 0x45, 0x3e, 0x82, 0x1b, 0xc2, 0x23, 0xd4, 0x2d, 0xc9, 0x92, 0x69, 0x13, 0x05, 0x83, - 0xe0, 0xa4, 0x37, 0x69, 0xdf, 0xc2, 0x7b, 0xe8, 0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11, 0x76, - 0x32, 0xf8, 0x3b, 0xf4, 0xfd, 0x9f, 0x99, 0x4e, 0x09, 0x1b, 0xb7, 0x13, 0x8f, 0x3f, 0xa1, 0xbd, - 0x0f, 0xce, 0x61, 0x6b, 0xe8, 0x1d, 0x3a, 0xa8, 0xbd, 0x32, 0xec, 0xad, 0x83, 0xa9, 0xbd, 0xc7, - 0x77, 0x92, 0xff, 0xb5, 0x27, 0x5b, 0x72, 0x87, 0xbb, 0xee, 0xab, 0x27, 0xbd, 0x7a, 0x2b, 0x1c, - 0x9f, 0xad, 0xe3, 0xe0, 0x7c, 0x1d, 0x07, 0xbf, 0xd6, 0x71, 0xf0, 0x75, 0x13, 0x77, 0xce, 0x37, - 0x71, 0xe7, 0xc7, 0x26, 0xee, 0x7c, 0x7c, 0x76, 0xf5, 0xe5, 0x16, 0xed, 0x7f, 0x08, 0x3b, 0xce, - 0xba, 0x90, 0x3f, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xd1, 0x51, 0x65, 0xaa, 0x02, 0x00, - 0x00, + // 392 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcd, 0xca, 0xd3, 0x40, + 0x14, 0x86, 0x13, 0x3f, 0xad, 0x30, 0xb4, 0x16, 0x83, 0x94, 0xe0, 0x22, 0x2d, 0x2a, 0x52, 0x14, + 0x93, 0x85, 0x82, 0x2e, 0xa5, 0xa0, 0xe8, 0x42, 0xe8, 0x8f, 0x2b, 0x37, 0xc3, 0x64, 0x32, 0x4d, + 0x06, 0x93, 0x99, 0xe9, 0xcc, 0xa4, 0xb6, 0xbd, 0x0a, 0x77, 0xee, 0xbd, 0x9a, 0x2e, 0xbb, 0x14, + 0x17, 0x45, 0xda, 0x1b, 0x91, 0x9c, 0x89, 0x55, 0x77, 0xdf, 0x2e, 0x79, 0xde, 0xe7, 0x9c, 0x37, + 0x70, 0x82,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x90, 0x2d, 0x34, 0x33, 0x85, 0x2c, 0x33, 0xbc, + 0xaa, 0xa5, 0x65, 0x78, 0x55, 0x13, 0x61, 0xeb, 0xca, 0x84, 0xb7, 0x47, 0xfe, 0xb8, 0x3b, 0x79, + 0xb7, 0x3f, 0x0e, 0xbd, 0x9f, 0xc7, 0xe1, 0xeb, 0x9c, 0xdb, 0xa2, 0x4e, 0x63, 0x2a, 0xab, 0xe4, + 0xff, 0xb3, 0xbc, 0x78, 0x46, 0x0b, 0xc2, 0x45, 0x72, 0x21, 0x99, 0xdd, 0x2a, 0x66, 0xe2, 0x05, + 0xd3, 0x9c, 0x94, 0x7c, 0x47, 0xd2, 0x92, 0xbd, 0x17, 0x76, 0x3e, 0xfa, 0x5b, 0xfa, 0xf1, 0x4f, + 0x67, 0x73, 0x12, 0x36, 0x6b, 0x1b, 0x27, 0xb3, 0xfd, 0x29, 0xf2, 0x0f, 0xa7, 0xc8, 0xff, 0x75, + 0x8a, 0xfc, 0xaf, 0xe7, 0xc8, 0x3b, 0x9c, 0x23, 0xef, 0xc7, 0x39, 0xf2, 0x3e, 0xbd, 0xbc, 0x7e, + 0xfb, 0xa6, 0xfd, 0x51, 0xe0, 0x23, 0xd2, 0x0e, 0xf0, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x17, 0x3d, 0xea, 0x26, 0x4b, 0x02, 0x00, 0x00, } func (m *QuotingParams) Marshal() (dAtA []byte, err error) { @@ -271,39 +221,6 @@ func (m *QuotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *VaultParams) 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 *VaultParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VaultParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.QuotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -344,17 +261,6 @@ func (m *QuotingParams) Size() (n int) { return n } -func (m *VaultParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.QuotingParams.Size() - n += 1 + l + sovParams(uint64(l)) - return n -} - func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -558,89 +464,6 @@ func (m *QuotingParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *VaultParams) 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 ErrIntOverflowParams - } - 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: VaultParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VaultParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QuotingParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.QuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/vault/types/params_test.go b/protocol/x/vault/types/params_test.go index b633ed23ef..2fe762d8ec 100644 --- a/protocol/x/vault/types/params_test.go +++ b/protocol/x/vault/types/params_test.go @@ -8,19 +8,19 @@ import ( "github.com/stretchr/testify/require" ) -func TestValidate(t *testing.T) { +func TestValidateQuotingParams(t *testing.T) { tests := map[string]struct { // Params to validate. - params types.Params + params types.QuotingParams // Expected error expectedErr error }{ "Success": { - params: types.DefaultParams(), + params: types.DefaultQuotingParams(), expectedErr: nil, }, "Failure - Layer is greater than MaxUint8": { - params: types.Params{ + params: types.QuotingParams{ Layers: 256, SpreadMinPpm: 3_000, SpreadBufferPpm: 1_500, @@ -32,7 +32,7 @@ func TestValidate(t *testing.T) { expectedErr: types.ErrInvalidLayers, }, "Failure - SpreadMinPpm is 0": { - params: types.Params{ + params: types.QuotingParams{ Layers: 2, SpreadMinPpm: 0, SpreadBufferPpm: 1_500, @@ -44,7 +44,7 @@ func TestValidate(t *testing.T) { expectedErr: types.ErrInvalidSpreadMinPpm, }, "Failure - OrderSizePctPpm is 0": { - params: types.Params{ + params: types.QuotingParams{ Layers: 2, SpreadMinPpm: 3_000, SpreadBufferPpm: 1_500, @@ -56,7 +56,7 @@ func TestValidate(t *testing.T) { expectedErr: types.ErrInvalidOrderSizePctPpm, }, "Failure - OrderExpirationSeconds is 0": { - params: types.Params{ + params: types.QuotingParams{ Layers: 2, SpreadMinPpm: 3_000, SpreadBufferPpm: 1_500, @@ -68,7 +68,7 @@ func TestValidate(t *testing.T) { expectedErr: types.ErrInvalidOrderExpirationSeconds, }, "Failure - ActivationThresholdQuoteQuantums is negative": { - params: types.Params{ + params: types.QuotingParams{ Layers: 2, SpreadMinPpm: 3_000, SpreadBufferPpm: 1_500, diff --git a/protocol/x/vault/types/tx.pb.go b/protocol/x/vault/types/tx.pb.go index 7de57c637a..22e889a22c 100644 --- a/protocol/x/vault/types/tx.pb.go +++ b/protocol/x/vault/types/tx.pb.go @@ -127,7 +127,8 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo -// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request type. +// MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request +// type. type MsgUpdateDefaultQuotingParams struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // The quoting parameters to update to. Every field must be set. @@ -181,7 +182,8 @@ func (m *MsgUpdateDefaultQuotingParams) GetDefaultQuotingParams() QuotingParams return QuotingParams{} } -// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams response type. +// MsgUpdateDefaultQuotingParamsResponse is the Msg/UpdateDefaultQuotingParams +// response type. type MsgUpdateDefaultQuotingParamsResponse struct { } diff --git a/protocol/x/vault/types/types.go b/protocol/x/vault/types/types.go index 3bb50d145c..8edc8c4ddd 100644 --- a/protocol/x/vault/types/types.go +++ b/protocol/x/vault/types/types.go @@ -25,12 +25,12 @@ type VaultKeeper interface { ) (err error) // Params. - GetParams( + GetDefaultQuotingParams( ctx sdk.Context, - ) Params - SetParams( + ) QuotingParams + SetDefaultQuotingParams( ctx sdk.Context, - params Params, + params QuotingParams, ) error // Shares. From 21cf0baf41096478a963fadbe96a9447fc5d78cb Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Thu, 1 Aug 2024 16:16:38 -0400 Subject: [PATCH 03/10] address comments --- .../src/codegen/dydxprotocol/vault/genesis.ts | 48 +- .../src/codegen/dydxprotocol/vault/params.ts | 183 +++++++ .../src/codegen/dydxprotocol/vault/query.ts | 22 +- .../codegen/dydxprotocol/vault/tx.rpc.msg.ts | 15 +- .../src/codegen/dydxprotocol/vault/tx.ts | 125 ++++- proto/dydxprotocol/vault/genesis.proto | 7 +- proto/dydxprotocol/vault/params.proto | 35 ++ proto/dydxprotocol/vault/query.proto | 4 +- proto/dydxprotocol/vault/tx.proto | 19 + protocol/app/upgrades/v5.0.0/upgrade.go | 15 +- protocol/x/vault/genesis.go | 2 +- .../vault/keeper/msg_server_update_params.go | 17 + protocol/x/vault/keeper/orders_test.go | 4 +- protocol/x/vault/keeper/params.go | 4 +- protocol/x/vault/keeper/params_test.go | 103 ++-- protocol/x/vault/types/genesis.pb.go | 146 ++++-- protocol/x/vault/types/params.pb.go | 443 ++++++++++++++++- protocol/x/vault/types/query.pb.go | 160 ++++-- protocol/x/vault/types/tx.pb.go | 463 ++++++++++++++++-- 19 files changed, 1587 insertions(+), 228 deletions(-) create mode 100644 protocol/x/vault/keeper/msg_server_update_params.go 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 1db93c26ad..f9227a1c0e 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts @@ -1,4 +1,4 @@ -import { QuotingParams, QuotingParamsSDKType } from "./params"; +import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType } from "./params"; import { VaultId, VaultIdSDKType } from "./vault"; import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share"; import * as _m0 from "protobufjs/minimal"; @@ -6,20 +6,36 @@ import { DeepPartial } from "../../helpers"; /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisState { - /** The default quoting parameters for all vaults. */ - defaultQuotingParams?: QuotingParams; + /** + * The parameters of the module. + * Deprecated since v6.x in favor of default_quoting_params. + */ + + /** @deprecated */ + params?: Params; /** The vaults. */ vaults: Vault[]; + /** The default quoting parameters for all vaults. */ + + defaultQuotingParams?: QuotingParams; } /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisStateSDKType { - /** The default quoting parameters for all vaults. */ - default_quoting_params?: QuotingParamsSDKType; + /** + * The parameters of the module. + * Deprecated since v6.x in favor of default_quoting_params. + */ + + /** @deprecated */ + params?: ParamsSDKType; /** The vaults. */ vaults: VaultSDKType[]; + /** The default quoting parameters for all vaults. */ + + default_quoting_params?: QuotingParamsSDKType; } /** Vault defines the total shares and owner shares of a vault. */ @@ -60,21 +76,26 @@ export interface VaultSDKType { function createBaseGenesisState(): GenesisState { return { - defaultQuotingParams: undefined, - vaults: [] + params: undefined, + vaults: [], + defaultQuotingParams: undefined }; } export const GenesisState = { encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.defaultQuotingParams !== undefined) { - QuotingParams.encode(message.defaultQuotingParams, writer.uint32(10).fork()).ldelim(); + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } for (const v of message.vaults) { Vault.encode(v!, writer.uint32(18).fork()).ldelim(); } + if (message.defaultQuotingParams !== undefined) { + QuotingParams.encode(message.defaultQuotingParams, writer.uint32(26).fork()).ldelim(); + } + return writer; }, @@ -88,13 +109,17 @@ export const GenesisState = { switch (tag >>> 3) { case 1: - message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); + message.params = Params.decode(reader, reader.uint32()); break; case 2: message.vaults.push(Vault.decode(reader, reader.uint32())); break; + case 3: + message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); + break; + default: reader.skipType(tag & 7); break; @@ -106,8 +131,9 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.vaults = object.vaults?.map(e => Vault.fromPartial(e)) || []; + message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts index c2a6e26e40..0ad91e5a20 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts @@ -72,6 +72,84 @@ export interface QuotingParamsSDKType { activation_threshold_quote_quantums: Uint8Array; } +/** + * Deprecated: Params stores `x/vault` parameters. + * Deprecated since v6.x as is replaced by QuotingParams. + */ + +export interface Params { + /** + * The number of layers of orders a vault places. For example if + * `layers=2`, a vault places 2 asks and 2 bids. + */ + layers: number; + /** The minimum base spread when a vault quotes around reservation price. */ + + spreadMinPpm: number; + /** + * The buffer amount to add to min_price_change_ppm to arrive at `spread` + * according to formula: + * `spread = max(spread_min_ppm, min_price_change_ppm + spread_buffer_ppm)`. + */ + + spreadBufferPpm: number; + /** The factor that determines how aggressive a vault skews its orders. */ + + skewFactorPpm: number; + /** The percentage of vault equity that each order is sized at. */ + + orderSizePctPpm: number; + /** The duration that a vault's orders are valid for. */ + + orderExpirationSeconds: number; + /** + * The number of quote quantums in quote asset that a vault with no perpetual + * positions must have to activate, i.e. if a vault has no perpetual positions + * and has strictly less than this amount of quote asset, it will not + * activate. + */ + + activationThresholdQuoteQuantums: Uint8Array; +} +/** + * Deprecated: Params stores `x/vault` parameters. + * Deprecated since v6.x as is replaced by QuotingParams. + */ + +export interface ParamsSDKType { + /** + * The number of layers of orders a vault places. For example if + * `layers=2`, a vault places 2 asks and 2 bids. + */ + layers: number; + /** The minimum base spread when a vault quotes around reservation price. */ + + spread_min_ppm: number; + /** + * The buffer amount to add to min_price_change_ppm to arrive at `spread` + * according to formula: + * `spread = max(spread_min_ppm, min_price_change_ppm + spread_buffer_ppm)`. + */ + + spread_buffer_ppm: number; + /** The factor that determines how aggressive a vault skews its orders. */ + + skew_factor_ppm: number; + /** The percentage of vault equity that each order is sized at. */ + + order_size_pct_ppm: number; + /** The duration that a vault's orders are valid for. */ + + order_expiration_seconds: number; + /** + * The number of quote quantums in quote asset that a vault with no perpetual + * positions must have to activate, i.e. if a vault has no perpetual positions + * and has strictly less than this amount of quote asset, it will not + * activate. + */ + + activation_threshold_quote_quantums: Uint8Array; +} function createBaseQuotingParams(): QuotingParams { return { @@ -176,4 +254,109 @@ export const QuotingParams = { return message; } +}; + +function createBaseParams(): Params { + return { + layers: 0, + spreadMinPpm: 0, + spreadBufferPpm: 0, + skewFactorPpm: 0, + orderSizePctPpm: 0, + orderExpirationSeconds: 0, + activationThresholdQuoteQuantums: new Uint8Array() + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.layers !== 0) { + writer.uint32(8).uint32(message.layers); + } + + if (message.spreadMinPpm !== 0) { + writer.uint32(16).uint32(message.spreadMinPpm); + } + + if (message.spreadBufferPpm !== 0) { + writer.uint32(24).uint32(message.spreadBufferPpm); + } + + if (message.skewFactorPpm !== 0) { + writer.uint32(32).uint32(message.skewFactorPpm); + } + + if (message.orderSizePctPpm !== 0) { + writer.uint32(40).uint32(message.orderSizePctPpm); + } + + if (message.orderExpirationSeconds !== 0) { + writer.uint32(48).uint32(message.orderExpirationSeconds); + } + + if (message.activationThresholdQuoteQuantums.length !== 0) { + writer.uint32(58).bytes(message.activationThresholdQuoteQuantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.layers = reader.uint32(); + break; + + case 2: + message.spreadMinPpm = reader.uint32(); + break; + + case 3: + message.spreadBufferPpm = reader.uint32(); + break; + + case 4: + message.skewFactorPpm = reader.uint32(); + break; + + case 5: + message.orderSizePctPpm = reader.uint32(); + break; + + case 6: + message.orderExpirationSeconds = reader.uint32(); + break; + + case 7: + message.activationThresholdQuoteQuantums = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.layers = object.layers ?? 0; + message.spreadMinPpm = object.spreadMinPpm ?? 0; + message.spreadBufferPpm = object.spreadBufferPpm ?? 0; + message.skewFactorPpm = object.skewFactorPpm ?? 0; + message.orderSizePctPpm = object.orderSizePctPpm ?? 0; + message.orderExpirationSeconds = object.orderExpirationSeconds ?? 0; + message.activationThresholdQuoteQuantums = object.activationThresholdQuoteQuantums ?? new Uint8Array(); + return message; + } + }; \ No newline at end of file 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 8900bf4217..04cfefa83c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts @@ -1,6 +1,6 @@ import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType } from "./vault"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; -import { QuotingParams, QuotingParamsSDKType } from "./params"; +import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType } from "./params"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share"; import * as _m0 from "protobufjs/minimal"; @@ -14,11 +14,19 @@ export interface QueryParamsRequestSDKType {} /** QueryParamsResponse is a response type for the Params RPC method. */ export interface QueryParamsResponse { + /** Deprecated since v6.x in favor of default_quoting_params. */ + + /** @deprecated */ + params?: Params; defaultQuotingParams?: QuotingParams; } /** QueryParamsResponse is a response type for the Params RPC method. */ export interface QueryParamsResponseSDKType { + /** Deprecated since v6.x in favor of default_quoting_params. */ + + /** @deprecated */ + params?: ParamsSDKType; default_quoting_params?: QuotingParamsSDKType; } /** QueryVaultRequest is a request type for the Vault RPC method. */ @@ -136,14 +144,19 @@ export const QueryParamsRequest = { function createBaseQueryParamsResponse(): QueryParamsResponse { return { + params: undefined, defaultQuotingParams: undefined }; } export const QueryParamsResponse = { encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.defaultQuotingParams !== undefined) { - QuotingParams.encode(message.defaultQuotingParams, writer.uint32(10).fork()).ldelim(); + QuotingParams.encode(message.defaultQuotingParams, writer.uint32(18).fork()).ldelim(); } return writer; @@ -159,6 +172,10 @@ export const QueryParamsResponse = { switch (tag >>> 3) { case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + + case 2: message.defaultQuotingParams = QuotingParams.decode(reader, reader.uint32()); break; @@ -173,6 +190,7 @@ export const QueryParamsResponse = { fromPartial(object: DeepPartial): QueryParamsResponse { const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; return message; } 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 6f79eea71c..4d4d783ceb 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,17 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateDefaultQuotingParams, MsgUpdateDefaultQuotingParamsResponse } from "./tx"; +import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgUpdateDefaultQuotingParams, MsgUpdateDefaultQuotingParamsResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** DepositToVault deposits funds into a vault. */ depositToVault(request: MsgDepositToVault): Promise; + /** + * UpdateParams updates the Params in state. + * Deprecated since v6.x in favor of UpdateDefaultQuotingParams. + */ + + updateParams(request: MsgUpdateParams): Promise; /** UpdateDefaultQuotingParams updates the default quoting params in state. */ updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise; @@ -16,6 +22,7 @@ export class MsgClientImpl implements Msg { constructor(rpc: Rpc) { this.rpc = rpc; this.depositToVault = this.depositToVault.bind(this); + this.updateParams = this.updateParams.bind(this); this.updateDefaultQuotingParams = this.updateDefaultQuotingParams.bind(this); } @@ -25,6 +32,12 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositToVaultResponse.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); + return promise.then(data => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); + } + updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise { const data = MsgUpdateDefaultQuotingParams.encode(request).finish(); const promise = this.rpc.request("dydxprotocol.vault.Msg", "UpdateDefaultQuotingParams", 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 682b7c183e..53b779964e 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts @@ -1,6 +1,6 @@ import { VaultId, VaultIdSDKType } from "./vault"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; -import { QuotingParams, QuotingParamsSDKType } from "./params"; +import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** @@ -39,6 +39,40 @@ export interface MsgDepositToVaultResponse {} /** MsgDepositToVaultResponse is the Msg/DepositToVault response type. */ export interface MsgDepositToVaultResponseSDKType {} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. + */ + +export interface MsgUpdateParams { + authority: string; + /** The parameters to update. Each field must be set. */ + + params?: Params; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. + */ + +export interface MsgUpdateParamsSDKType { + authority: string; + /** The parameters to update. Each field must be set. */ + + params?: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse is the Msg/UpdateParams response type. + * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. + */ + +export interface MsgUpdateParamsResponse {} +/** + * MsgUpdateParamsResponse is the Msg/UpdateParams response type. + * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. + */ + +export interface MsgUpdateParamsResponseSDKType {} /** * MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request * type. @@ -173,6 +207,95 @@ export const MsgDepositToVaultResponse = { }; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: undefined + }; +} + +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + } + +}; + +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} + +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + } + +}; + function createBaseMsgUpdateDefaultQuotingParams(): MsgUpdateDefaultQuotingParams { return { authority: "", diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index 2d60a5e7ad..36f7dc2a86 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -10,10 +10,13 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; // GenesisState defines `x/vault`'s genesis state. message GenesisState { - // The default quoting parameters for all vaults. - QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ]; + // The parameters of the module. + // Deprecated since v6.x in favor of default_quoting_params. + Params params = 1 [ (gogoproto.nullable) = false, deprecated = true ]; // The vaults. repeated Vault vaults = 2; + // The default quoting parameters for all vaults. + QuotingParams default_quoting_params = 3 [ (gogoproto.nullable) = false ]; } // Vault defines the total shares and owner shares of a vault. diff --git a/proto/dydxprotocol/vault/params.proto b/proto/dydxprotocol/vault/params.proto index 8fd02e1bb8..9a76486899 100644 --- a/proto/dydxprotocol/vault/params.proto +++ b/proto/dydxprotocol/vault/params.proto @@ -38,3 +38,38 @@ message QuotingParams { (gogoproto.nullable) = false ]; } + +// Deprecated: Params stores `x/vault` parameters. +// Deprecated since v6.x as is replaced by QuotingParams. +message Params { + // The number of layers of orders a vault places. For example if + // `layers=2`, a vault places 2 asks and 2 bids. + uint32 layers = 1; + + // The minimum base spread when a vault quotes around reservation price. + uint32 spread_min_ppm = 2; + + // The buffer amount to add to min_price_change_ppm to arrive at `spread` + // according to formula: + // `spread = max(spread_min_ppm, min_price_change_ppm + spread_buffer_ppm)`. + uint32 spread_buffer_ppm = 3; + + // The factor that determines how aggressive a vault skews its orders. + uint32 skew_factor_ppm = 4; + + // The percentage of vault equity that each order is sized at. + uint32 order_size_pct_ppm = 5; + + // The duration that a vault's orders are valid for. + uint32 order_expiration_seconds = 6; + + // The number of quote quantums in quote asset that a vault with no perpetual + // positions must have to activate, i.e. if a vault has no perpetual positions + // and has strictly less than this amount of quote asset, it will not + // activate. + bytes activation_threshold_quote_quantums = 7 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/dydxprotocol/vault/query.proto b/proto/dydxprotocol/vault/query.proto index b00d6c35f5..f73d5f131c 100644 --- a/proto/dydxprotocol/vault/query.proto +++ b/proto/dydxprotocol/vault/query.proto @@ -37,7 +37,9 @@ message QueryParamsRequest {} // QueryParamsResponse is a response type for the Params RPC method. message QueryParamsResponse { - QuotingParams default_quoting_params = 1 [ (gogoproto.nullable) = false ]; + // Deprecated since v6.x in favor of default_quoting_params. + Params params = 1 [ (gogoproto.nullable) = false, deprecated = true ]; + QuotingParams default_quoting_params = 2 [ (gogoproto.nullable) = false ]; } // QueryVaultRequest is a request type for the Vault RPC method. diff --git a/proto/dydxprotocol/vault/tx.proto b/proto/dydxprotocol/vault/tx.proto index 9ff3068552..50fc701fb3 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -15,6 +15,10 @@ service Msg { // DepositToVault deposits funds into a vault. rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); + // UpdateParams updates the Params in state. + // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // UpdateDefaultQuotingParams updates the default quoting params in state. rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) returns (MsgUpdateDefaultQuotingParamsResponse); @@ -45,6 +49,21 @@ message MsgDepositToVault { // MsgDepositToVaultResponse is the Msg/DepositToVault response type. message MsgDepositToVaultResponse {} +// MsgUpdateParams is the Msg/UpdateParams request type. +// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. +message MsgUpdateParams { + // Authority is the address that controls the module. + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // The parameters to update. Each field must be set. + Params params = 2 [ (gogoproto.nullable) = false ]; +} + +// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. +message MsgUpdateParamsResponse {} + // MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request // type. message MsgUpdateDefaultQuotingParams { diff --git a/protocol/app/upgrades/v5.0.0/upgrade.go b/protocol/app/upgrades/v5.0.0/upgrade.go index 5a74597eda..b39109d872 100644 --- a/protocol/app/upgrades/v5.0.0/upgrade.go +++ b/protocol/app/upgrades/v5.0.0/upgrade.go @@ -287,17 +287,18 @@ func voteExtensionsUpgrade( ) } -// Initialize vault module parameters. +// Deprecated: Initialize vault module parameters. +// This function is deprecated because `Params` in `x/vault` is replaced with `DefaultQuotingParams` in v6.x. func initializeVaultModuleParams( ctx sdk.Context, vaultKeeper vaulttypes.VaultKeeper, ) { - // Set vault module quoting parameters to default values. - defaultQuotingParams := vaulttypes.DefaultQuotingParams() - if err := vaultKeeper.SetDefaultQuotingParams(ctx, defaultQuotingParams); err != nil { - panic(fmt.Sprintf("failed to set vault module parameters: %s", err)) - } - ctx.Logger().Info("Successfully set vault module parameters") + // // Set vault module parameters to default values. + // vaultParams := vaulttypes.DefaultParams() + // if err := vaultKeeper.SetParams(ctx, vaultParams); err != nil { + // panic(fmt.Sprintf("failed to set vault module parameters: %s", err)) + // } + // ctx.Logger().Info("Successfully set vault module parameters") } func CreateUpgradeHandler( diff --git a/protocol/x/vault/genesis.go b/protocol/x/vault/genesis.go index 45bceb2fcd..7007bd34e0 100644 --- a/protocol/x/vault/genesis.go +++ b/protocol/x/vault/genesis.go @@ -30,7 +30,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } if vault.QuotingParams != nil { - if err := k.SetVaultQuotingParams(ctx, *vault.VaultId, vault.QuotingParams); err != nil { + if err := k.SetVaultQuotingParams(ctx, *vault.VaultId, *vault.QuotingParams); err != nil { panic(err) } } diff --git a/protocol/x/vault/keeper/msg_server_update_params.go b/protocol/x/vault/keeper/msg_server_update_params.go new file mode 100644 index 0000000000..b2d1ea737a --- /dev/null +++ b/protocol/x/vault/keeper/msg_server_update_params.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" +) + +// UpdateParams updates the parameters of the vault module. +// Deprecated since v6.x in favor of UpdateDefaultQuotingParams. +func (k msgServer) UpdateParams( + goCtx context.Context, + msg *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { + return nil, fmt.Errorf("deprecated since v6.x in favor of UpdateDefaultQuotingParams") +} diff --git a/protocol/x/vault/keeper/orders_test.go b/protocol/x/vault/keeper/orders_test.go index 08b3844b3a..62a24316d5 100644 --- a/protocol/x/vault/keeper/orders_test.go +++ b/protocol/x/vault/keeper/orders_test.go @@ -904,7 +904,7 @@ func TestGetVaultClobOrders(t *testing.T) { ctx := tApp.InitChain() // Set vault quoting parameters. - err := tApp.App.VaultKeeper.SetVaultQuotingParams(ctx, tc.vaultId, &tc.vaultQuotingParams) + err := tApp.App.VaultKeeper.SetVaultQuotingParams(ctx, tc.vaultId, tc.vaultQuotingParams) require.NoError(t, err) // Get vault orders. @@ -1012,7 +1012,7 @@ func TestGetVaultClobOrderIds(t *testing.T) { // Set number of layers. quotingParams := k.GetVaultQuotingParams(ctx, tc.vaultId) quotingParams.Layers = tc.layers - err := k.SetVaultQuotingParams(ctx, tc.vaultId, "ingParams) + err := k.SetVaultQuotingParams(ctx, tc.vaultId, quotingParams) require.NoError(t, err) // Construct expected order IDs. diff --git a/protocol/x/vault/keeper/params.go b/protocol/x/vault/keeper/params.go index 5e60903565..ddbea6f695 100644 --- a/protocol/x/vault/keeper/params.go +++ b/protocol/x/vault/keeper/params.go @@ -59,13 +59,13 @@ func (k Keeper) GetVaultQuotingParams( func (k Keeper) SetVaultQuotingParams( ctx sdk.Context, vaultId types.VaultId, - qoutingParams *types.QuotingParams, + qoutingParams types.QuotingParams, ) error { if err := qoutingParams.Validate(); err != nil { return err } - b := k.cdc.MustMarshal(qoutingParams) + b := k.cdc.MustMarshal(&qoutingParams) store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.QuotingParamsKeyPrefix)) store.Set(vaultId.ToStateKey(), b) diff --git a/protocol/x/vault/keeper/params_test.go b/protocol/x/vault/keeper/params_test.go index 35d31756e6..db675e9a6a 100644 --- a/protocol/x/vault/keeper/params_test.go +++ b/protocol/x/vault/keeper/params_test.go @@ -31,7 +31,7 @@ func TestGetSetDefaultQuotingParams(t *testing.T) { } err := k.SetDefaultQuotingParams(ctx, newParams) require.NoError(t, err) - require.Equal(t, newParams, k.GetDefaultQuotingParams(ctx)) + require.Equal(t, *newParams, k.GetDefaultQuotingParams(ctx)) // Set invalid params and get. invalidParams := &types.QuotingParams{ @@ -45,49 +45,74 @@ func TestGetSetDefaultQuotingParams(t *testing.T) { } err = k.SetDefaultQuotingParams(ctx, invalidParams) require.Error(t, err) - require.Equal(t, newParams, k.GetDefaultQuotingParams(ctx)) + require.Equal(t, *newParams, k.GetDefaultQuotingParams(ctx)) } func TestGetSetVaultQuotingParams(t *testing.T) { - tApp := testapp.NewTestAppBuilder(t).Build() - ctx := tApp.InitChain() - k := tApp.App.VaultKeeper - - // Should get default quoting params. - quotingParams := k.GetVaultQuotingParams(ctx, constants.Vault_Clob0) - require.Equal(t, types.DefaultQuotingParams(), quotingParams) - - // Set quoting params of vault clob 0. - vaultClob0QuotingParams := &types.QuotingParams{ - Layers: 3, - SpreadMinPpm: 12_345, - SpreadBufferPpm: 5_678, - SkewFactorPpm: 4_121_787, - OrderSizePctPpm: 232_121, - OrderExpirationSeconds: 120, - ActivationThresholdQuoteQuantums: dtypes.NewInt(2_123_456_789), + tests := map[string]struct { + // Vault id. + vaultId types.VaultId + // Vault quoting params to set. + vaultQuotingParams *types.QuotingParams + }{ + "Vault Clob 0. Default quoting params": { + vaultId: constants.Vault_Clob0, + vaultQuotingParams: nil, + }, + "Vault Clob 0. Non-default quoting params": { + vaultId: constants.Vault_Clob0, + vaultQuotingParams: &types.QuotingParams{ + Layers: 3, + SpreadMinPpm: 12_345, + SpreadBufferPpm: 5_678, + SkewFactorPpm: 4_121_787, + OrderSizePctPpm: 232_121, + OrderExpirationSeconds: 120, + ActivationThresholdQuoteQuantums: dtypes.NewInt(2_123_456_789), + }, + }, + "Vault Clob 1. Default quoting params": { + vaultId: constants.Vault_Clob0, + vaultQuotingParams: nil, + }, + "Vault Clob 1. Non-default quoting params": { + vaultId: constants.Vault_Clob0, + vaultQuotingParams: &types.QuotingParams{ + Layers: 4, + SpreadMinPpm: 123_456, + SpreadBufferPpm: 87_654, + SkewFactorPpm: 5_432_111, + OrderSizePctPpm: 444_333, + OrderExpirationSeconds: 90, + ActivationThresholdQuoteQuantums: dtypes.NewInt(1_111_111_111), + }, + }, } - err := k.SetVaultQuotingParams(ctx, constants.Vault_Clob0, vaultClob0QuotingParams) - require.NoError(t, err) - // Get quoting params of vault clob 0. - quotingParams = k.GetVaultQuotingParams(ctx, constants.Vault_Clob0) - require.Equal(t, vaultClob0QuotingParams, quotingParams) + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.VaultKeeper - // Set quoting params of vault clob 1. - vaultClob1QuotingParams := &types.QuotingParams{ - Layers: 4, - SpreadMinPpm: 123_456, - SpreadBufferPpm: 87_654, - SkewFactorPpm: 5_432_111, - OrderSizePctPpm: 444_333, - OrderExpirationSeconds: 90, - ActivationThresholdQuoteQuantums: dtypes.NewInt(1_111_111_111), + if tc.vaultQuotingParams != nil { + // Set quoting params. + err := k.SetVaultQuotingParams(ctx, tc.vaultId, *tc.vaultQuotingParams) + require.NoError(t, err) + // Verify quoting params are as set. + require.Equal( + t, + *tc.vaultQuotingParams, + k.GetVaultQuotingParams(ctx, tc.vaultId), + ) + } else { + // Verify quoting params are default. + require.Equal( + t, + k.GetDefaultQuotingParams(ctx), + k.GetVaultQuotingParams(ctx, tc.vaultId), + ) + } + }) } - err = k.SetVaultQuotingParams(ctx, constants.Vault_Clob1, vaultClob1QuotingParams) - require.NoError(t, err) - - // Get quoting params of vault clob 1. - quotingParams = k.GetVaultQuotingParams(ctx, constants.Vault_Clob1) - require.Equal(t, vaultClob1QuotingParams, quotingParams) } diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 4178643168..236e02ae55 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -25,10 +25,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines `x/vault`'s genesis state. type GenesisState struct { - // The default quoting parameters for all vaults. - DefaultQuotingParams QuotingParams `protobuf:"bytes,1,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` + // The parameters of the module. + // Deprecated since v6.x in favor of default_quoting_params. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // Deprecated: Do not use. // The vaults. Vaults []*Vault `protobuf:"bytes,2,rep,name=vaults,proto3" json:"vaults,omitempty"` + // The default quoting parameters for all vaults. + DefaultQuotingParams QuotingParams `protobuf:"bytes,3,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -64,11 +67,12 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetDefaultQuotingParams() QuotingParams { +// Deprecated: Do not use. +func (m *GenesisState) GetParams() Params { if m != nil { - return m.DefaultQuotingParams + return m.Params } - return QuotingParams{} + return Params{} } func (m *GenesisState) GetVaults() []*Vault { @@ -78,6 +82,13 @@ func (m *GenesisState) GetVaults() []*Vault { return nil } +func (m *GenesisState) GetDefaultQuotingParams() QuotingParams { + if m != nil { + return m.DefaultQuotingParams + } + return QuotingParams{} +} + // Vault defines the total shares and owner shares of a vault. type Vault struct { // The ID of the vault. @@ -168,32 +179,34 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescriptor_4be4a747b209e41c) } var fileDescriptor_4be4a747b209e41c = []byte{ - // 397 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0xae, 0xd2, 0x40, - 0x14, 0xc6, 0x5b, 0xfe, 0x69, 0xa6, 0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x00, 0xff, 0xff, 0xf3, 0x11, 0xf8, 0x4e, 0xf1, 0x02, 0x00, 0x00, + // 418 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x8f, 0x93, 0x40, + 0x14, 0x87, 0x65, 0x17, 0xcd, 0xd0, 0xf5, 0x30, 0x6e, 0x36, 0x88, 0x71, 0x16, 0xf7, 0xd4, 0x8b, + 0x10, 0x77, 0x8d, 0x26, 0x9e, 0x74, 0x3d, 0xe8, 0x5e, 0xd4, 0x4e, 0x13, 0x0f, 0x26, 0x86, 0x50, + 0x18, 0x29, 0x09, 0x30, 0x2d, 0x33, 0xd4, 0xf6, 0x5b, 0xf8, 0x9d, 0xbc, 0xf4, 0xd8, 0xa3, 0x07, + 0x63, 0x4c, 0xfb, 0x45, 0xcc, 0x3c, 0xc6, 0xa6, 0x55, 0x34, 0x5e, 0xe0, 0xcd, 0xfb, 0xfd, 0x79, + 0xbf, 0x79, 0x19, 0xe4, 0xa7, 0x8b, 0x74, 0x3e, 0xa9, 0xb9, 0xe4, 0x09, 0x2f, 0xc2, 0x59, 0xdc, + 0x14, 0x32, 0xcc, 0x58, 0xc5, 0x44, 0x2e, 0x02, 0x68, 0x63, 0xbc, 0xcb, 0x08, 0x80, 0xe1, 0x9d, + 0x64, 0x3c, 0xe3, 0xd0, 0x0b, 0x55, 0xd5, 0x32, 0xbd, 0xb3, 0x0e, 0xaf, 0x49, 0x5c, 0xc7, 0xa5, + 0xb6, 0xf2, 0x48, 0x07, 0x41, 0x8c, 0xe3, 0x9a, 0xfd, 0x03, 0x87, 0x6f, 0x8b, 0x9f, 0x7f, 0x33, + 0x51, 0xef, 0x65, 0x1b, 0x6e, 0x28, 0x63, 0xc9, 0xf0, 0x53, 0x64, 0xb7, 0x03, 0x5c, 0xd3, 0x37, + 0xfb, 0xce, 0x85, 0x17, 0xfc, 0x19, 0x36, 0x78, 0x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06, + 0xcb, 0x35, 0x31, 0x57, 0x6b, 0x62, 0xfe, 0x58, 0x13, 0xf3, 0xf3, 0x86, 0x18, 0xab, 0x0d, 0x31, + 0xbe, 0x6e, 0x88, 0xf1, 0xfe, 0x49, 0x96, 0xcb, 0x71, 0x33, 0x0a, 0x12, 0x5e, 0x86, 0xfb, 0x2f, + 0xed, 0xd1, 0x83, 0x64, 0x1c, 0xe7, 0x55, 0xb8, 0xed, 0xcc, 0xf5, 0xeb, 0x93, 0x8b, 0x09, 0x13, + 0x23, 0x1b, 0xfa, 0x97, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x11, 0x76, 0x00, 0x2d, 0x03, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -216,6 +229,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.DefaultQuotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.Vaults) > 0 { for iNdEx := len(m.Vaults) - 1; iNdEx >= 0; iNdEx-- { { @@ -231,7 +254,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } { - size, err := m.DefaultQuotingParams.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -264,20 +287,20 @@ func (m *Vault) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.MostRecentClientIds) > 0 { - dAtA3 := make([]byte, len(m.MostRecentClientIds)*10) - var j2 int + dAtA4 := make([]byte, len(m.MostRecentClientIds)*10) + var j3 int for _, num := range m.MostRecentClientIds { for num >= 1<<7 { - dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j2++ + j3++ } - dAtA3[j2] = uint8(num) - j2++ + dAtA4[j3] = uint8(num) + j3++ } - i -= j2 - copy(dAtA[i:], dAtA3[:j2]) - i = encodeVarintGenesis(dAtA, i, uint64(j2)) + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintGenesis(dAtA, i, uint64(j3)) i-- dAtA[i] = 0x2a } @@ -351,7 +374,7 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.DefaultQuotingParams.Size() + l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) if len(m.Vaults) > 0 { for _, e := range m.Vaults { @@ -359,6 +382,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.DefaultQuotingParams.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -433,7 +458,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -460,7 +485,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.DefaultQuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -498,6 +523,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DefaultQuotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/protocol/x/vault/types/params.pb.go b/protocol/x/vault/types/params.pb.go index 643054ecf9..7ee3c8578e 100644 --- a/protocol/x/vault/types/params.pb.go +++ b/protocol/x/vault/types/params.pb.go @@ -123,39 +123,141 @@ func (m *QuotingParams) GetOrderExpirationSeconds() uint32 { return 0 } +// Deprecated: Params stores `x/vault` parameters. +// Deprecated since v6.x as is replaced by QuotingParams. +type Params struct { + // The number of layers of orders a vault places. For example if + // `layers=2`, a vault places 2 asks and 2 bids. + Layers uint32 `protobuf:"varint,1,opt,name=layers,proto3" json:"layers,omitempty"` + // The minimum base spread when a vault quotes around reservation price. + SpreadMinPpm uint32 `protobuf:"varint,2,opt,name=spread_min_ppm,json=spreadMinPpm,proto3" json:"spread_min_ppm,omitempty"` + // The buffer amount to add to min_price_change_ppm to arrive at `spread` + // according to formula: + // `spread = max(spread_min_ppm, min_price_change_ppm + spread_buffer_ppm)`. + SpreadBufferPpm uint32 `protobuf:"varint,3,opt,name=spread_buffer_ppm,json=spreadBufferPpm,proto3" json:"spread_buffer_ppm,omitempty"` + // The factor that determines how aggressive a vault skews its orders. + SkewFactorPpm uint32 `protobuf:"varint,4,opt,name=skew_factor_ppm,json=skewFactorPpm,proto3" json:"skew_factor_ppm,omitempty"` + // The percentage of vault equity that each order is sized at. + OrderSizePctPpm uint32 `protobuf:"varint,5,opt,name=order_size_pct_ppm,json=orderSizePctPpm,proto3" json:"order_size_pct_ppm,omitempty"` + // The duration that a vault's orders are valid for. + OrderExpirationSeconds uint32 `protobuf:"varint,6,opt,name=order_expiration_seconds,json=orderExpirationSeconds,proto3" json:"order_expiration_seconds,omitempty"` + // The number of quote quantums in quote asset that a vault with no perpetual + // positions must have to activate, i.e. if a vault has no perpetual positions + // and has strictly less than this amount of quote asset, it will not + // activate. + ActivationThresholdQuoteQuantums github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,7,opt,name=activation_threshold_quote_quantums,json=activationThresholdQuoteQuantums,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"activation_threshold_quote_quantums"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_6043e0b8bfdbca9f, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetLayers() uint32 { + if m != nil { + return m.Layers + } + return 0 +} + +func (m *Params) GetSpreadMinPpm() uint32 { + if m != nil { + return m.SpreadMinPpm + } + return 0 +} + +func (m *Params) GetSpreadBufferPpm() uint32 { + if m != nil { + return m.SpreadBufferPpm + } + return 0 +} + +func (m *Params) GetSkewFactorPpm() uint32 { + if m != nil { + return m.SkewFactorPpm + } + return 0 +} + +func (m *Params) GetOrderSizePctPpm() uint32 { + if m != nil { + return m.OrderSizePctPpm + } + return 0 +} + +func (m *Params) GetOrderExpirationSeconds() uint32 { + if m != nil { + return m.OrderExpirationSeconds + } + return 0 +} + func init() { proto.RegisterType((*QuotingParams)(nil), "dydxprotocol.vault.QuotingParams") + proto.RegisterType((*Params)(nil), "dydxprotocol.vault.Params") } func init() { proto.RegisterFile("dydxprotocol/vault/params.proto", fileDescriptor_6043e0b8bfdbca9f) } var fileDescriptor_6043e0b8bfdbca9f = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcd, 0xca, 0xd3, 0x40, - 0x14, 0x86, 0x13, 0x3f, 0xad, 0x30, 0xb4, 0x16, 0x83, 0x94, 0xe0, 0x22, 0x2d, 0x2a, 0x52, 0x14, - 0x93, 0x85, 0x82, 0x2e, 0xa5, 0xa0, 0xe8, 0x42, 0xe8, 0x8f, 0x2b, 0x37, 0xc3, 0x64, 0x32, 0x4d, - 0x06, 0x93, 0x99, 0xe9, 0xcc, 0xa4, 0xb6, 0xbd, 0x0a, 0x77, 0xee, 0xbd, 0x9a, 0x2e, 0xbb, 0x14, - 0x17, 0x45, 0xda, 0x1b, 0x91, 0x9c, 0x89, 0x55, 0x77, 0xdf, 0x2e, 0x79, 0xde, 0xe7, 0x9c, 0x37, - 0x70, 0x82, 0x86, 0xd9, 0x36, 0xdb, 0x28, 0x2d, 0xad, 0xa4, 0xb2, 0x4c, 0xd6, 0xa4, 0x2e, 0x6d, - 0xa2, 0x88, 0x26, 0x95, 0x89, 0x81, 0x06, 0xc1, 0xbf, 0x42, 0x0c, 0xc2, 0xfd, 0x7b, 0xb9, 0xcc, - 0x25, 0xb0, 0xa4, 0x79, 0x72, 0xe6, 0x83, 0xef, 0x57, 0xa8, 0x37, 0xab, 0xa5, 0xe5, 0x22, 0x9f, - 0xc2, 0x86, 0x60, 0x80, 0x3a, 0x25, 0xd9, 0x32, 0x6d, 0x42, 0x7f, 0xe4, 0x8f, 0x7b, 0xf3, 0xf6, - 0x2d, 0x78, 0x84, 0xee, 0x18, 0xa5, 0x19, 0xc9, 0x70, 0xc5, 0x05, 0x56, 0xaa, 0x0a, 0x6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, 0x1b, 0x27, 0xb3, 0xfd, 0x29, 0xf2, 0x0f, 0xa7, 0xc8, 0xff, 0x75, - 0x8a, 0xfc, 0xaf, 0xe7, 0xc8, 0x3b, 0x9c, 0x23, 0xef, 0xc7, 0x39, 0xf2, 0x3e, 0xbd, 0xbc, 0x7e, - 0xfb, 0xa6, 0xfd, 0x51, 0xe0, 0x23, 0xd2, 0x0e, 0xf0, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x17, 0x3d, 0xea, 0x26, 0x4b, 0x02, 0x00, 0x00, + // 407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x93, 0xb1, 0x8e, 0xd3, 0x30, + 0x1c, 0xc6, 0x13, 0x0a, 0x41, 0xb2, 0xae, 0x9c, 0x88, 0xd0, 0x29, 0x62, 0x48, 0xab, 0x03, 0xa1, + 0x13, 0x88, 0x64, 0x00, 0x09, 0x46, 0x54, 0x09, 0x04, 0x03, 0x52, 0x7b, 0x65, 0x62, 0xb1, 0x1c, + 0xc7, 0x4d, 0x2c, 0x12, 0xdb, 0xb5, 0x9d, 0xd2, 0xf6, 0x29, 0xd8, 0x18, 0xd8, 0x78, 0x9a, 0x8e, + 0x1d, 0x11, 0x43, 0x85, 0xda, 0x17, 0x41, 0xf9, 0x3b, 0x14, 0xd8, 0x18, 0x19, 0x6e, 0x4b, 0x7e, + 0xdf, 0xcf, 0xfe, 0x22, 0x7d, 0x0a, 0x1a, 0xe4, 0xab, 0x7c, 0xa9, 0xb4, 0xb4, 0x92, 0xca, 0x2a, + 0x5d, 0x90, 0xa6, 0xb2, 0xa9, 0x22, 0x9a, 0xd4, 0x26, 0x01, 0x1a, 0x86, 0x7f, 0x0a, 0x09, 0x08, + 0x77, 0xef, 0x14, 0xb2, 0x90, 0xc0, 0xd2, 0xf6, 0xc9, 0x99, 0xe7, 0x5f, 0x7b, 0xa8, 0x3f, 0x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67, 0x79, 0xfa, 0x98, 0x96, 0x84, 0x8b, 0xf4, 0x48, 0x72, + 0xbb, 0x52, 0xcc, 0x24, 0x53, 0xa6, 0x39, 0xa9, 0xf8, 0x9a, 0x64, 0x15, 0x7b, 0x23, 0xec, 0xe5, + 0xf0, 0x77, 0xe9, 0xbb, 0x5f, 0x9d, 0xed, 0x24, 0x6c, 0xd2, 0x35, 0x9e, 0x7f, 0xe9, 0xa1, 0xe0, + 0x6a, 0x9d, 0xff, 0x74, 0x9d, 0xd1, 0x64, 0xb3, 0x8f, 0xfd, 0xed, 0x3e, 0xf6, 0x7f, 0xec, 0x63, + 0xff, 0xd3, 0x21, 0xf6, 0xb6, 0x87, 0xd8, 0xfb, 0x76, 0x88, 0xbd, 0xf7, 0xcf, 0xfe, 0xbd, 0x7d, + 0xd9, 0xfd, 0xc6, 0xf0, 0x11, 0x59, 0x00, 0xfc, 0xc9, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x64, + 0x6d, 0x5c, 0xb4, 0xe9, 0x03, 0x00, 0x00, } func (m *QuotingParams) Marshal() (dAtA []byte, err error) { @@ -221,6 +323,69 @@ func (m *QuotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.ActivationThresholdQuoteQuantums.Size() + i -= size + if _, err := m.ActivationThresholdQuoteQuantums.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.OrderExpirationSeconds != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.OrderExpirationSeconds)) + i-- + dAtA[i] = 0x30 + } + if m.OrderSizePctPpm != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.OrderSizePctPpm)) + i-- + dAtA[i] = 0x28 + } + if m.SkewFactorPpm != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SkewFactorPpm)) + i-- + dAtA[i] = 0x20 + } + if m.SpreadBufferPpm != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SpreadBufferPpm)) + i-- + dAtA[i] = 0x18 + } + if m.SpreadMinPpm != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SpreadMinPpm)) + i-- + dAtA[i] = 0x10 + } + if m.Layers != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Layers)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -261,6 +426,35 @@ func (m *QuotingParams) Size() (n int) { return n } +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Layers != 0 { + n += 1 + sovParams(uint64(m.Layers)) + } + if m.SpreadMinPpm != 0 { + n += 1 + sovParams(uint64(m.SpreadMinPpm)) + } + if m.SpreadBufferPpm != 0 { + n += 1 + sovParams(uint64(m.SpreadBufferPpm)) + } + if m.SkewFactorPpm != 0 { + n += 1 + sovParams(uint64(m.SkewFactorPpm)) + } + if m.OrderSizePctPpm != 0 { + n += 1 + sovParams(uint64(m.OrderSizePctPpm)) + } + if m.OrderExpirationSeconds != 0 { + n += 1 + sovParams(uint64(m.OrderExpirationSeconds)) + } + l = m.ActivationThresholdQuoteQuantums.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -464,6 +658,203 @@ func (m *QuotingParams) Unmarshal(dAtA []byte) error { } return nil } +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Layers", wireType) + } + m.Layers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Layers |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpreadMinPpm", wireType) + } + m.SpreadMinPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpreadMinPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SpreadBufferPpm", wireType) + } + m.SpreadBufferPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SpreadBufferPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SkewFactorPpm", wireType) + } + m.SkewFactorPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SkewFactorPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderSizePctPpm", wireType) + } + m.OrderSizePctPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderSizePctPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderExpirationSeconds", wireType) + } + m.OrderExpirationSeconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderExpirationSeconds |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActivationThresholdQuoteQuantums", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ActivationThresholdQuoteQuantums.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/vault/types/query.pb.go b/protocol/x/vault/types/query.pb.go index 34a087164b..89e8d0e08d 100644 --- a/protocol/x/vault/types/query.pb.go +++ b/protocol/x/vault/types/query.pb.go @@ -71,7 +71,9 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is a response type for the Params RPC method. type QueryParamsResponse struct { - DefaultQuotingParams QuotingParams `protobuf:"bytes,1,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` + // Deprecated since v6.x in favor of default_quoting_params. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // Deprecated: Do not use. + DefaultQuotingParams QuotingParams `protobuf:"bytes,2,opt,name=default_quoting_params,json=defaultQuotingParams,proto3" json:"default_quoting_params"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } @@ -107,6 +109,14 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +// Deprecated: Do not use. +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func (m *QueryParamsResponse) GetDefaultQuotingParams() QuotingParams { if m != nil { return m.DefaultQuotingParams @@ -456,57 +466,58 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/query.proto", fileDescriptor_478fb8dc0ff21ea6) } var fileDescriptor_478fb8dc0ff21ea6 = []byte{ - // 788 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xef, 0xd2, 0xd2, 0xef, 0x97, 0x69, 0x31, 0x71, 0x44, 0xac, 0x05, 0x17, 0xd8, 0x44, 0x7e, -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bf, 0xa6, 0xbb, 0x92, 0x89, - 0x3f, 0xaa, 0xa5, 0x24, 0x8f, 0xdf, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x73, 0x54, 0x73, 0x3c, - 0xc0, 0x08, 0x00, 0x00, + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0x9b, 0x34, 0xef, 0x75, 0x92, 0x3e, 0xe9, 0xcd, 0xeb, 0x2b, 0x21, 0x2d, 0x6e, 0x6b, + 0x89, 0x7e, 0x82, 0x87, 0x04, 0x24, 0x10, 0x42, 0x88, 0x76, 0x51, 0xe8, 0x06, 0x1a, 0x17, 0xb1, + 0x40, 0x82, 0x30, 0x49, 0xa6, 0xae, 0x25, 0xc7, 0x93, 0xd8, 0xe3, 0xd0, 0x50, 0x75, 0x83, 0xc4, + 0x82, 0x1d, 0x12, 0xbf, 0x00, 0x16, 0xac, 0x58, 0xb0, 0x63, 0xc9, 0xb6, 0xcb, 0x4a, 0x6c, 0x10, + 0x8b, 0x0a, 0xb5, 0xfc, 0x10, 0xe4, 0x99, 0x49, 0xe2, 0x7c, 0x98, 0x46, 0xa8, 0x9b, 0xc8, 0xb9, + 0x73, 0xef, 0xb9, 0xc7, 0xe7, 0x9e, 0x3b, 0x06, 0x6a, 0xa5, 0x59, 0xd9, 0xad, 0xb9, 0x94, 0xd1, + 0x32, 0xb5, 0x51, 0x03, 0xfb, 0x36, 0x43, 0x75, 0x9f, 0xb8, 0x4d, 0x9d, 0x07, 0x21, 0x0c, 0x9f, + 0xeb, 0xfc, 0x3c, 0x3b, 0x61, 0x52, 0x93, 0xf2, 0x18, 0x0a, 0x9e, 0x44, 0x66, 0x76, 0xda, 0xa4, + 0xd4, 0xb4, 0x09, 0xc2, 0x35, 0x0b, 0x61, 0xc7, 0xa1, 0x0c, 0x33, 0x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0x3a, 0x7e, 0xb5, 0x44, 0x5c, 0x4e, 0x6b, 0xdc, 0x90, 0xff, 0xb4, 0xcf, 0x71, + 0xa9, 0x94, 0x6c, 0x20, 0x15, 0xb9, 0x05, 0xfe, 0xe6, 0x38, 0x45, 0xab, 0x22, 0x35, 0x99, 0x8a, + 0xec, 0xb2, 0x51, 0x91, 0x6f, 0xf0, 0x57, 0x43, 0xfc, 0x85, 0x05, 0x30, 0xde, 0x19, 0x79, 0x00, + 0x21, 0xa4, 0x98, 0xef, 0x86, 0x08, 0x39, 0x44, 0xdf, 0x6a, 0x3f, 0xb7, 0xd1, 0xd2, 0x5e, 0x28, + 0x06, 0x9f, 0x81, 0x24, 0xa9, 0xfb, 0x16, 0x6b, 0x66, 0xe2, 0xb3, 0xca, 0x62, 0x7a, 0xed, 0x5e, + 0x90, 0xf3, 0xfd, 0x68, 0xe6, 0x8e, 0x69, 0xb1, 0x1d, 0xbf, 0xa4, 0x97, 0x69, 0x15, 0x75, 0x7b, + 0xe2, 0xda, 0xe5, 0xf2, 0x0e, 0xb6, 0x1c, 0xd4, 0x8e, 0x54, 0x02, 0x21, 0x3c, 0x7d, 0x8b, 0xb8, + 0x16, 0xb6, 0xad, 0x17, 0xb8, 0x64, 0x93, 0x0d, 0x87, 0x19, 0x12, 0x17, 0x6e, 0x83, 0x31, 0xcb, + 0x69, 0x10, 0x87, 0x51, 0xb7, 0x99, 0x49, 0x9c, 0x71, 0x93, 0x0e, 0x34, 0x5c, 0x07, 0x69, 0x46, + 0x19, 0xb6, 0x8b, 0xdc, 0xcf, 0x5e, 0x66, 0x94, 0x6b, 0x33, 0x70, 0x88, 0xf7, 0xfd, 0xea, 0x16, + 0x4f, 0x92, 0x92, 0xa4, 0x78, 0xa1, 0x08, 0x69, 0x45, 0xf0, 0x3f, 0x1f, 0xdc, 0xaa, 0x6d, 0xf3, + 0x31, 0xb4, 0x5c, 0x0e, 0xd7, 0x01, 0xe8, 0xec, 0xa6, 0x9c, 0xde, 0xb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x52, 0x64, 0xa3, 0xde, 0x8d, 0xcc, 0x2e, 0x0f, 0x93, 0x2a, 0x79, 0xcd, 0x71, + 0x5e, 0x53, 0xf0, 0x7c, 0x24, 0x2f, 0xf8, 0x5e, 0x01, 0xa9, 0x90, 0x81, 0xe0, 0x4a, 0x24, 0x7c, + 0xff, 0x56, 0x64, 0x2f, 0x0d, 0x97, 0x2c, 0xd9, 0xdc, 0xe0, 0x6c, 0xf2, 0xf0, 0xca, 0x20, 0x36, + 0x61, 0xb7, 0xf6, 0x8a, 0xb5, 0x56, 0x38, 0x38, 0x56, 0x95, 0xc3, 0x63, 0x55, 0xf9, 0x71, 0xac, + 0x2a, 0x6f, 0x4e, 0xd4, 0xd8, 0xe1, 0x89, 0x1a, 0xfb, 0x76, 0xa2, 0xc6, 0x1e, 0x5f, 0x1f, 0xfe, + 0x36, 0xdd, 0x95, 0x9d, 0xf8, 0xa5, 0x5a, 0x4a, 0xf2, 0xf8, 0xd5, 0x5f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x16, 0xfd, 0xc1, 0xee, 0xfd, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -757,6 +768,16 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1071,6 +1092,8 @@ func (m *QueryParamsResponse) Size() (n int) { } var l int _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) l = m.DefaultQuotingParams.Size() n += 1 + l + sovQuery(uint64(l)) return n @@ -1266,6 +1289,39 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DefaultQuotingParams", wireType) } diff --git a/protocol/x/vault/types/tx.pb.go b/protocol/x/vault/types/tx.pb.go index 22e889a22c..b136a6a9a0 100644 --- a/protocol/x/vault/types/tx.pb.go +++ b/protocol/x/vault/types/tx.pb.go @@ -127,6 +127,99 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The parameters to update. Each field must be set. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +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} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse is the Msg/UpdateParams response type. +// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. +type MsgUpdateParamsResponse struct { +} + +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} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + // MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request // type. type MsgUpdateDefaultQuotingParams struct { @@ -139,7 +232,7 @@ func (m *MsgUpdateDefaultQuotingParams) Reset() { *m = MsgUpdateDefaultQ func (m *MsgUpdateDefaultQuotingParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDefaultQuotingParams) ProtoMessage() {} func (*MsgUpdateDefaultQuotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{2} + return fileDescriptor_ced574c6017ce006, []int{4} } func (m *MsgUpdateDefaultQuotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -191,7 +284,7 @@ func (m *MsgUpdateDefaultQuotingParamsResponse) Reset() { *m = MsgUpdate func (m *MsgUpdateDefaultQuotingParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDefaultQuotingParamsResponse) ProtoMessage() {} func (*MsgUpdateDefaultQuotingParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{3} + return fileDescriptor_ced574c6017ce006, []int{5} } func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,6 +316,8 @@ var xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse proto.InternalMessageI func init() { proto.RegisterType((*MsgDepositToVault)(nil), "dydxprotocol.vault.MsgDepositToVault") proto.RegisterType((*MsgDepositToVaultResponse)(nil), "dydxprotocol.vault.MsgDepositToVaultResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "dydxprotocol.vault.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateDefaultQuotingParams)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParams") proto.RegisterType((*MsgUpdateDefaultQuotingParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse") } @@ -230,41 +325,43 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/tx.proto", fileDescriptor_ced574c6017ce006) } var fileDescriptor_ced574c6017ce006 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x5b, 0x04, 0x74, 0x69, 0x23, 0xb1, 0x8a, 0x20, 0x75, 0x84, 0x53, 0x22, 0x15, 0x0a, - 0x52, 0x6c, 0xb5, 0xa0, 0x22, 0x7a, 0x82, 0xa8, 0x07, 0x22, 0x14, 0x89, 0x38, 0xc0, 0x01, 0x09, - 0x59, 0x1b, 0xef, 0xd6, 0xb1, 0x14, 0x7b, 0x1d, 0xef, 0x3a, 0x4a, 0x38, 0x72, 0xe4, 0xc4, 0x0f, - 0xf0, 0x0f, 0x1c, 0xf8, 0x06, 0xd4, 0x63, 0xc5, 0x09, 0x71, 0xa8, 0x50, 0x72, 0xe0, 0x1f, 0x38, - 0x21, 0xef, 0xda, 0x4d, 0x4c, 0xdc, 0x2a, 0xbd, 0x24, 0xb3, 0x33, 0xf3, 0x66, 0xe6, 0xbd, 0x19, - 0x19, 0x54, 0xf0, 0x18, 0x8f, 0x82, 0x90, 0x72, 0x6a, 0xd3, 0xbe, 0x31, 0x44, 0x51, 0x9f, 0x1b, - 0x7c, 0xa4, 0x0b, 0x0f, 0x84, 0xf3, 0x41, 0x5d, 0x04, 0xd5, 0x4d, 0x9b, 0x32, 0x8f, 0x32, 0x4b, - 0xb8, 0x0d, 0xf9, 0x90, 0xe9, 0xea, 0x6d, 0xf9, 0x32, 0x3c, 0xe6, 0x18, 0xc3, 0xdd, 0xf8, 0x2f, - 0x09, 0x3c, 0xc8, 0x34, 0x61, 0x51, 0x17, 0xd9, 0x36, 0x8d, 0x7c, 0xce, 0xe6, 0xec, 0x24, 0xb5, - 0x9a, 0x33, 0x4f, 0x80, 0x42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x00, - 0x00, + // 576 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x8f, 0xd2, 0x40, + 0x14, 0xa6, 0xbb, 0x66, 0x75, 0x47, 0x16, 0x63, 0x43, 0x5c, 0x28, 0xb1, 0xac, 0x98, 0xd5, 0x55, + 0x43, 0x9b, 0x5d, 0xcd, 0xaa, 0x7b, 0x52, 0xb2, 0x07, 0x89, 0x21, 0x91, 0xa2, 0x1e, 0x4c, 0x0c, + 0x0e, 0x9d, 0xd9, 0xd2, 0x04, 0x3a, 0xa5, 0x33, 0x25, 0xe0, 0xd1, 0xa3, 0x27, 0x13, 0xcf, 0xfe, + 0x07, 0x0f, 0xfe, 0x06, 0xb3, 0xc7, 0x8d, 0x27, 0x63, 0xcc, 0xc6, 0xc0, 0xc1, 0xbf, 0x61, 0x3a, + 0x53, 0xa0, 0x5d, 0x2a, 0xc1, 0x78, 0x81, 0x99, 0xf7, 0xbe, 0xef, 0xbd, 0xef, 0x7b, 0x33, 0x53, + 0x50, 0x40, 0x43, 0x34, 0x70, 0x3d, 0xc2, 0x88, 0x49, 0x3a, 0x7a, 0x1f, 0xfa, 0x1d, 0xa6, 0xb3, + 0x81, 0xc6, 0x23, 0xb2, 0x1c, 0x4d, 0x6a, 0x3c, 0xa9, 0xe4, 0x4d, 0x42, 0xbb, 0x84, 0x36, 0x79, + 0x58, 0x17, 0x1b, 0x01, 0x57, 0x36, 0xc5, 0x4e, 0xef, 0x52, 0x4b, 0xef, 0xef, 0x06, 0x7f, 0x61, + 0xe2, 0x56, 0xac, 0x09, 0xf5, 0x5b, 0xd0, 0x34, 0x89, 0xef, 0x30, 0x1a, 0x59, 0x87, 0xd0, 0x62, + 0x82, 0x1e, 0x17, 0x7a, 0xb0, 0x3b, 0x69, 0xa2, 0x26, 0x00, 0xf8, 0x6f, 0x98, 0xcf, 0x5a, 0xc4, + 0x22, 0x42,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0x64, 0xac, 0xa6, 0xbe, + 0x8f, 0xd5, 0xd4, 0xab, 0xfb, 0xcb, 0xbf, 0xce, 0xc1, 0xe4, 0xf3, 0x1a, 0x3c, 0xd2, 0xd6, 0x1a, + 0x8f, 0xdf, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x4c, 0xe9, 0x02, 0x81, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -281,6 +378,9 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // DepositToVault deposits funds into a vault. DepositToVault(ctx context.Context, in *MsgDepositToVault, opts ...grpc.CallOption) (*MsgDepositToVaultResponse, error) + // UpdateParams updates the Params in state. + // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // UpdateDefaultQuotingParams updates the default quoting params in state. UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) } @@ -302,6 +402,15 @@ func (c *msgClient) DepositToVault(ctx context.Context, in *MsgDepositToVault, o 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...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) { out := new(MsgUpdateDefaultQuotingParamsResponse) err := c.cc.Invoke(ctx, "/dydxprotocol.vault.Msg/UpdateDefaultQuotingParams", in, out, opts...) @@ -315,6 +424,9 @@ func (c *msgClient) UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdat type MsgServer interface { // DepositToVault deposits funds into a vault. DepositToVault(context.Context, *MsgDepositToVault) (*MsgDepositToVaultResponse, error) + // UpdateParams updates the Params in state. + // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // UpdateDefaultQuotingParams updates the default quoting params in state. UpdateDefaultQuotingParams(context.Context, *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) } @@ -326,6 +438,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) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func (*UnimplementedMsgServer) UpdateDefaultQuotingParams(ctx context.Context, req *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateDefaultQuotingParams not implemented") } @@ -352,6 +467,24 @@ func _Msg_DepositToVault_Handler(srv interface{}, ctx context.Context, dec func( 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 { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.vault.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateDefaultQuotingParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateDefaultQuotingParams) if err := dec(in); err != nil { @@ -378,6 +511,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DepositToVault", Handler: _Msg_DepositToVault_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, { MethodName: "UpdateDefaultQuotingParams", Handler: _Msg_UpdateDefaultQuotingParams_Handler, @@ -467,6 +604,69 @@ func (m *MsgDepositToVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgUpdateDefaultQuotingParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -569,6 +769,30 @@ func (m *MsgDepositToVaultResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgUpdateDefaultQuotingParams) Size() (n int) { if m == nil { return 0 @@ -804,6 +1028,171 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 err := m.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgUpdateDefaultQuotingParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 6eaaad40914598ba4363362275bf8dcc0f321f59 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Thu, 1 Aug 2024 16:39:44 -0400 Subject: [PATCH 04/10] fix proto --- proto/dydxprotocol/vault/genesis.proto | 2 +- protocol/app/msgs/internal_msgs.go | 2 + protocol/x/vault/types/genesis.pb.go | 88 ++++++++++++++------------ 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index 36f7dc2a86..004dd2457e 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -12,7 +12,7 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; message GenesisState { // The parameters of the module. // Deprecated since v6.x in favor of default_quoting_params. - Params params = 1 [ (gogoproto.nullable) = false, deprecated = true ]; + Params params = 1 [ deprecated = true ]; // The vaults. repeated Vault vaults = 2; // The default quoting parameters for all vaults. diff --git a/protocol/app/msgs/internal_msgs.go b/protocol/app/msgs/internal_msgs.go index 9d43de6c6f..ad2c0b1daa 100644 --- a/protocol/app/msgs/internal_msgs.go +++ b/protocol/app/msgs/internal_msgs.go @@ -186,6 +186,8 @@ var ( "/dydxprotocol.stats.MsgUpdateParamsResponse": nil, // vault + "/dydxprotocol.vault.MsgUpdateParams": &vault.MsgUpdateParams{}, + "/dydxprotocol.vault.MsgUpdateParamsResponse": nil, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": &vault.MsgUpdateDefaultQuotingParams{}, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": nil, diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 236e02ae55..8bc7668cb0 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { // The parameters of the module. // Deprecated since v6.x in favor of default_quoting_params. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // Deprecated: Do not use. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // Deprecated: Do not use. // The vaults. Vaults []*Vault `protobuf:"bytes,2,rep,name=vaults,proto3" json:"vaults,omitempty"` // The default quoting parameters for all vaults. @@ -68,11 +68,11 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo // Deprecated: Do not use. -func (m *GenesisState) GetParams() Params { +func (m *GenesisState) GetParams() *Params { if m != nil { return m.Params } - return Params{} + return nil } func (m *GenesisState) GetVaults() []*Vault { @@ -179,34 +179,33 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescriptor_4be4a747b209e41c) } var fileDescriptor_4be4a747b209e41c = []byte{ - // 418 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x8f, 0x93, 0x40, - 0x14, 0x87, 0x65, 0x17, 0xcd, 0xd0, 0xf5, 0x30, 0x6e, 0x36, 0x88, 0x71, 0x16, 0xf7, 0xd4, 0x8b, - 0x10, 0x77, 0x8d, 0x26, 0x9e, 0x74, 0x3d, 0xe8, 0x5e, 0xd4, 0x4e, 0x13, 0x0f, 0x26, 0x86, 0x50, - 0x18, 0x29, 0x09, 0x30, 0x2d, 0x33, 0xd4, 0xf6, 0x5b, 0xf8, 0x9d, 0xbc, 0xf4, 0xd8, 0xa3, 0x07, - 0x63, 0x4c, 0xfb, 0x45, 0xcc, 0x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0xde, 0x98, 0xb5, 0x05, - 0x7e, 0x86, 0x7a, 0x92, 0xcb, 0xb8, 0x88, 0x60, 0xab, 0xea, 0x66, 0x4a, 0x7b, 0xaf, 0x4b, 0xfb, - 0xba, 0x29, 0x87, 0x40, 0xa2, 0x0e, 0x48, 0xda, 0x03, 0x7e, 0x8e, 0x7a, 0xfc, 0x53, 0xc5, 0xea, - 0x5f, 0x0e, 0x16, 0xec, 0x86, 0x74, 0x39, 0xbc, 0x51, 0x3c, 0x90, 0x51, 0x87, 0x6f, 0x6b, 0x81, - 0x5f, 0xa1, 0x5b, 0xbf, 0x6d, 0xe7, 0xf0, 0x3f, 0xb7, 0x43, 0x8f, 0xa7, 0xbb, 0x47, 0x7c, 0x89, - 0x4e, 0x4b, 0x2e, 0x64, 0x54, 0xb3, 0x84, 0x55, 0x32, 0x4a, 0x8a, 0x5c, 0xfd, 0xf2, 0x54, 0xb8, - 0x47, 0xbe, 0xd5, 0x3f, 0xa6, 0xb7, 0x15, 0x4a, 0x01, 0x7c, 0x01, 0xd8, 0x75, 0x2a, 0xae, 0x06, - 0xcb, 0x35, 0x31, 0x57, 0x6b, 0x62, 0xfe, 0x58, 0x13, 0xf3, 0xf3, 0x86, 0x18, 0xab, 0x0d, 0x31, - 0xbe, 0x6e, 0x88, 0xf1, 0xfe, 0x49, 0x96, 0xcb, 0x71, 0x33, 0x0a, 0x12, 0x5e, 0x86, 0xfb, 0x2f, - 0xed, 0xd1, 0x83, 0x64, 0x1c, 0xe7, 0x55, 0xb8, 0xed, 0xcc, 0xf5, 0xeb, 0x93, 0x8b, 0x09, 0x13, - 0x23, 0x1b, 0xfa, 0x97, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x11, 0x76, 0x00, 0x2d, 0x03, - 0x00, 0x00, + // 414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x3f, 0x8f, 0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xdc, 0xb2, 0x67, 0x4f, 0xe2, + 0x71, 0x94, 0x95, 0xc1, 0x2e, 0x33, 0xd7, 0x9b, 0x27, 0x17, 0x13, 0x26, 0x46, 0x5d, 0xc8, 0x5f, + 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xb6, 0xba, 0x8f, 0x29, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -253,16 +252,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -374,8 +375,10 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } if len(m.Vaults) > 0 { for _, e := range m.Vaults { l = e.Size() @@ -485,6 +488,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Params == nil { + m.Params = &Params{} + } if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 36bfd3afa93f766cd02c166dbbd903a256045444 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Thu, 1 Aug 2024 16:46:20 -0400 Subject: [PATCH 05/10] fix sample pregenesis --- protocol/scripts/genesis/sample_pregenesis.json | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index dd13b8592a..87df12b12c 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -3911,6 +3911,7 @@ "spread_buffer_ppm": 1500, "spread_min_ppm": 3000 }, + "params": null, "vaults": [] }, "vest": { From a8123629404f6b76e6b656de3e43337cbedbd661 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Fri, 2 Aug 2024 00:35:59 -0400 Subject: [PATCH 06/10] add to all_msgs --- protocol/app/msgs/all_msgs.go | 10 ++++++---- protocol/app/msgs/internal_msgs_test.go | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/protocol/app/msgs/all_msgs.go b/protocol/app/msgs/all_msgs.go index 14019a0896..7897d3ddbe 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.MsgUpdateParams": {}, + "/dydxprotocol.vault.MsgUpdateParamsResponse": {}, + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": {}, + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": {}, // vest "/dydxprotocol.vest.MsgSetVestEntry": {}, diff --git a/protocol/app/msgs/internal_msgs_test.go b/protocol/app/msgs/internal_msgs_test.go index da50b0e1c3..453d3827ea 100644 --- a/protocol/app/msgs/internal_msgs_test.go +++ b/protocol/app/msgs/internal_msgs_test.go @@ -146,6 +146,8 @@ func TestInternalMsgSamples_Gov_Key(t *testing.T) { // vault "/dydxprotocol.vault.MsgUpdateParams", "/dydxprotocol.vault.MsgUpdateParamsResponse", + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams", + "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse", // vest "/dydxprotocol.vest.MsgDeleteVestEntry", From 332b611b004f99cf5f1ce08f6b17963befeff29c Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Fri, 2 Aug 2024 11:27:44 -0400 Subject: [PATCH 07/10] add deprecated MsgUpdateParams to internal msg --- protocol/lib/ante/internal_msg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol/lib/ante/internal_msg.go b/protocol/lib/ante/internal_msg.go index a0951c5d8c..2ca6fe8245 100644 --- a/protocol/lib/ante/internal_msg.go +++ b/protocol/lib/ante/internal_msg.go @@ -126,6 +126,7 @@ func IsInternalMsg(msg sdk.Msg) bool { *stats.MsgUpdateParams, // vault + *vault.MsgUpdateParams, *vault.MsgUpdateDefaultQuotingParams, // vest From e1e6ffc3eda46f9dac6e77692658259ccacc4529 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Fri, 2 Aug 2024 12:17:58 -0400 Subject: [PATCH 08/10] replace UpdateParams --- .../codegen/dydxprotocol/vault/tx.rpc.msg.ts | 15 +- .../src/codegen/dydxprotocol/vault/tx.ts | 125 +---- proto/dydxprotocol/vault/tx.proto | 19 - protocol/app/msgs/all_msgs.go | 2 - protocol/app/msgs/internal_msgs.go | 2 - protocol/app/msgs/internal_msgs_test.go | 2 - protocol/lib/ante/internal_msg.go | 1 - .../vault/keeper/msg_server_update_params.go | 17 - protocol/x/vault/types/tx.pb.go | 463 ++---------------- 9 files changed, 39 insertions(+), 607 deletions(-) delete mode 100644 protocol/x/vault/keeper/msg_server_update_params.go 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 4d4d783ceb..6f79eea71c 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,17 +1,11 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; -import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgUpdateDefaultQuotingParams, MsgUpdateDefaultQuotingParamsResponse } from "./tx"; +import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateDefaultQuotingParams, MsgUpdateDefaultQuotingParamsResponse } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** DepositToVault deposits funds into a vault. */ depositToVault(request: MsgDepositToVault): Promise; - /** - * UpdateParams updates the Params in state. - * Deprecated since v6.x in favor of UpdateDefaultQuotingParams. - */ - - updateParams(request: MsgUpdateParams): Promise; /** UpdateDefaultQuotingParams updates the default quoting params in state. */ updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise; @@ -22,7 +16,6 @@ export class MsgClientImpl implements Msg { constructor(rpc: Rpc) { this.rpc = rpc; this.depositToVault = this.depositToVault.bind(this); - this.updateParams = this.updateParams.bind(this); this.updateDefaultQuotingParams = this.updateDefaultQuotingParams.bind(this); } @@ -32,12 +25,6 @@ export class MsgClientImpl implements Msg { return promise.then(data => MsgDepositToVaultResponse.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); - return promise.then(data => MsgUpdateParamsResponse.decode(new _m0.Reader(data))); - } - updateDefaultQuotingParams(request: MsgUpdateDefaultQuotingParams): Promise { const data = MsgUpdateDefaultQuotingParams.encode(request).finish(); const promise = this.rpc.request("dydxprotocol.vault.Msg", "UpdateDefaultQuotingParams", 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 53b779964e..682b7c183e 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts @@ -1,6 +1,6 @@ import { VaultId, VaultIdSDKType } from "./vault"; import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; -import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType } from "./params"; +import { QuotingParams, QuotingParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** @@ -39,40 +39,6 @@ export interface MsgDepositToVaultResponse {} /** MsgDepositToVaultResponse is the Msg/DepositToVault response type. */ export interface MsgDepositToVaultResponseSDKType {} -/** - * MsgUpdateParams is the Msg/UpdateParams request type. - * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. - */ - -export interface MsgUpdateParams { - authority: string; - /** The parameters to update. Each field must be set. */ - - params?: Params; -} -/** - * MsgUpdateParams is the Msg/UpdateParams request type. - * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. - */ - -export interface MsgUpdateParamsSDKType { - authority: string; - /** The parameters to update. Each field must be set. */ - - params?: ParamsSDKType; -} -/** - * MsgUpdateParamsResponse is the Msg/UpdateParams response type. - * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. - */ - -export interface MsgUpdateParamsResponse {} -/** - * MsgUpdateParamsResponse is the Msg/UpdateParams response type. - * Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. - */ - -export interface MsgUpdateParamsResponseSDKType {} /** * MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request * type. @@ -207,95 +173,6 @@ export const MsgDepositToVaultResponse = { }; -function createBaseMsgUpdateParams(): MsgUpdateParams { - return { - authority: "", - params: undefined - }; -} - -export const MsgUpdateParams = { - encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.authority !== "") { - writer.uint32(10).string(message.authority); - } - - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(18).fork()).ldelim(); - } - - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParams(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - case 1: - message.authority = reader.string(); - break; - - case 2: - message.params = Params.decode(reader, reader.uint32()); - break; - - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(object: DeepPartial): MsgUpdateParams { - const message = createBaseMsgUpdateParams(); - message.authority = object.authority ?? ""; - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; - return message; - } - -}; - -function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { - return {}; -} - -export const MsgUpdateParamsResponse = { - encode(_: MsgUpdateParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParamsResponse(); - - while (reader.pos < end) { - const tag = reader.uint32(); - - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - - return message; - }, - - fromPartial(_: DeepPartial): MsgUpdateParamsResponse { - const message = createBaseMsgUpdateParamsResponse(); - return message; - } - -}; - function createBaseMsgUpdateDefaultQuotingParams(): MsgUpdateDefaultQuotingParams { return { authority: "", diff --git a/proto/dydxprotocol/vault/tx.proto b/proto/dydxprotocol/vault/tx.proto index 50fc701fb3..9ff3068552 100644 --- a/proto/dydxprotocol/vault/tx.proto +++ b/proto/dydxprotocol/vault/tx.proto @@ -15,10 +15,6 @@ service Msg { // DepositToVault deposits funds into a vault. rpc DepositToVault(MsgDepositToVault) returns (MsgDepositToVaultResponse); - // UpdateParams updates the Params in state. - // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - // UpdateDefaultQuotingParams updates the default quoting params in state. rpc UpdateDefaultQuotingParams(MsgUpdateDefaultQuotingParams) returns (MsgUpdateDefaultQuotingParamsResponse); @@ -49,21 +45,6 @@ message MsgDepositToVault { // MsgDepositToVaultResponse is the Msg/DepositToVault response type. message MsgDepositToVaultResponse {} -// MsgUpdateParams is the Msg/UpdateParams request type. -// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. -message MsgUpdateParams { - // Authority is the address that controls the module. - option (cosmos.msg.v1.signer) = "authority"; - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // The parameters to update. Each field must be set. - Params params = 2 [ (gogoproto.nullable) = false ]; -} - -// MsgUpdateParamsResponse is the Msg/UpdateParams response type. -// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. -message MsgUpdateParamsResponse {} - // MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request // type. message MsgUpdateDefaultQuotingParams { diff --git a/protocol/app/msgs/all_msgs.go b/protocol/app/msgs/all_msgs.go index 7897d3ddbe..9c5954e526 100644 --- a/protocol/app/msgs/all_msgs.go +++ b/protocol/app/msgs/all_msgs.go @@ -241,8 +241,6 @@ var ( // vault "/dydxprotocol.vault.MsgDepositToVault": {}, "/dydxprotocol.vault.MsgDepositToVaultResponse": {}, - "/dydxprotocol.vault.MsgUpdateParams": {}, - "/dydxprotocol.vault.MsgUpdateParamsResponse": {}, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": {}, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": {}, diff --git a/protocol/app/msgs/internal_msgs.go b/protocol/app/msgs/internal_msgs.go index ad2c0b1daa..9d43de6c6f 100644 --- a/protocol/app/msgs/internal_msgs.go +++ b/protocol/app/msgs/internal_msgs.go @@ -186,8 +186,6 @@ var ( "/dydxprotocol.stats.MsgUpdateParamsResponse": nil, // vault - "/dydxprotocol.vault.MsgUpdateParams": &vault.MsgUpdateParams{}, - "/dydxprotocol.vault.MsgUpdateParamsResponse": nil, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": &vault.MsgUpdateDefaultQuotingParams{}, "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": nil, diff --git a/protocol/app/msgs/internal_msgs_test.go b/protocol/app/msgs/internal_msgs_test.go index 453d3827ea..9b66919e7f 100644 --- a/protocol/app/msgs/internal_msgs_test.go +++ b/protocol/app/msgs/internal_msgs_test.go @@ -144,8 +144,6 @@ func TestInternalMsgSamples_Gov_Key(t *testing.T) { "/dydxprotocol.stats.MsgUpdateParamsResponse", // vault - "/dydxprotocol.vault.MsgUpdateParams", - "/dydxprotocol.vault.MsgUpdateParamsResponse", "/dydxprotocol.vault.MsgUpdateDefaultQuotingParams", "/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse", diff --git a/protocol/lib/ante/internal_msg.go b/protocol/lib/ante/internal_msg.go index 2ca6fe8245..a0951c5d8c 100644 --- a/protocol/lib/ante/internal_msg.go +++ b/protocol/lib/ante/internal_msg.go @@ -126,7 +126,6 @@ func IsInternalMsg(msg sdk.Msg) bool { *stats.MsgUpdateParams, // vault - *vault.MsgUpdateParams, *vault.MsgUpdateDefaultQuotingParams, // vest diff --git a/protocol/x/vault/keeper/msg_server_update_params.go b/protocol/x/vault/keeper/msg_server_update_params.go deleted file mode 100644 index b2d1ea737a..0000000000 --- a/protocol/x/vault/keeper/msg_server_update_params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" -) - -// UpdateParams updates the parameters of the vault module. -// Deprecated since v6.x in favor of UpdateDefaultQuotingParams. -func (k msgServer) UpdateParams( - goCtx context.Context, - msg *types.MsgUpdateParams, -) (*types.MsgUpdateParamsResponse, error) { - return nil, fmt.Errorf("deprecated since v6.x in favor of UpdateDefaultQuotingParams") -} diff --git a/protocol/x/vault/types/tx.pb.go b/protocol/x/vault/types/tx.pb.go index b136a6a9a0..22e889a22c 100644 --- a/protocol/x/vault/types/tx.pb.go +++ b/protocol/x/vault/types/tx.pb.go @@ -127,99 +127,6 @@ func (m *MsgDepositToVaultResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDepositToVaultResponse proto.InternalMessageInfo -// MsgUpdateParams is the Msg/UpdateParams request type. -// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParams. -type MsgUpdateParams struct { - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // The parameters to update. Each field must be set. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -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} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// MsgUpdateParamsResponse is the Msg/UpdateParams response type. -// Deprecated since v6.x in favor of MsgUpdateDefaultQuotingParamsResponse. -type MsgUpdateParamsResponse struct { -} - -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} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - // MsgUpdateDefaultQuotingParams is the Msg/UpdateDefaultQuotingParams request // type. type MsgUpdateDefaultQuotingParams struct { @@ -232,7 +139,7 @@ func (m *MsgUpdateDefaultQuotingParams) Reset() { *m = MsgUpdateDefaultQ func (m *MsgUpdateDefaultQuotingParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDefaultQuotingParams) ProtoMessage() {} func (*MsgUpdateDefaultQuotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{4} + return fileDescriptor_ced574c6017ce006, []int{2} } func (m *MsgUpdateDefaultQuotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -284,7 +191,7 @@ func (m *MsgUpdateDefaultQuotingParamsResponse) Reset() { *m = MsgUpdate func (m *MsgUpdateDefaultQuotingParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateDefaultQuotingParamsResponse) ProtoMessage() {} func (*MsgUpdateDefaultQuotingParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ced574c6017ce006, []int{5} + return fileDescriptor_ced574c6017ce006, []int{3} } func (m *MsgUpdateDefaultQuotingParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -316,8 +223,6 @@ var xxx_messageInfo_MsgUpdateDefaultQuotingParamsResponse proto.InternalMessageI func init() { proto.RegisterType((*MsgDepositToVault)(nil), "dydxprotocol.vault.MsgDepositToVault") proto.RegisterType((*MsgDepositToVaultResponse)(nil), "dydxprotocol.vault.MsgDepositToVaultResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "dydxprotocol.vault.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateDefaultQuotingParams)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParams") proto.RegisterType((*MsgUpdateDefaultQuotingParamsResponse)(nil), "dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse") } @@ -325,43 +230,41 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/tx.proto", fileDescriptor_ced574c6017ce006) } var fileDescriptor_ced574c6017ce006 = []byte{ - // 576 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x8f, 0xd2, 0x40, - 0x14, 0xa6, 0xbb, 0x66, 0x75, 0x47, 0x16, 0x63, 0x43, 0x5c, 0x28, 0xb1, 0xac, 0x98, 0xd5, 0x55, - 0x43, 0x9b, 0x5d, 0xcd, 0xaa, 0x7b, 0x52, 0xb2, 0x07, 0x89, 0x21, 0x91, 0xa2, 0x1e, 0x4c, 0x0c, - 0x0e, 0x9d, 0xd9, 0xd2,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0x05, - 0x7f, 0x95, 0xc0, 0xd5, 0x69, 0xee, 0x10, 0x1f, 0x05, 0x45, 0xeb, 0x3e, 0x61, 0xb6, 0x63, 0xfd, - 0xa7, 0xfc, 0xd7, 0xe0, 0x0a, 0x12, 0xf5, 0x9a, 0x3d, 0x51, 0xb0, 0x19, 0xb3, 0x73, 0x2d, 0xc9, - 0x4e, 0xac, 0x75, 0xe8, 0x2a, 0x8b, 0x12, 0x64, 0xcd, 0x79, 0xbc, 0x09, 0xb6, 0x17, 0xfa, 0x98, - 0x38, 0xde, 0xfb, 0xb9, 0x02, 0x56, 0x6b, 0xd4, 0x92, 0x8f, 0x40, 0xe6, 0xcc, 0x1d, 0xdf, 0x4e, - 0x52, 0x34, 0x77, 0xd6, 0x4a, 0x79, 0x29, 0xd8, 0xa4, 0x9f, 0xfc, 0x06, 0xa4, 0x63, 0xd7, 0xe1, - 0xfa, 0x5f, 0xe8, 0x51, 0x90, 0x72, 0x67, 0x09, 0xd0, 0xb4, 0xc3, 0x7b, 0x09, 0x28, 0x0b, 0x0e, - 0x70, 0x77, 0x61, 0xad, 0x24, 0x8a, 0xf2, 0xf0, 0x9f, 0x29, 0x13, 0x31, 0x95, 0xfa, 0xf1, 0x48, - 0x95, 0x4e, 0x46, 0xaa, 0xf4, 0x6b, 0xa4, 0x4a, 0x1f, 0xc6, 0x6a, 0xea, 0x64, 0xac, 0xa6, 0xbe, - 0x8f, 0xd5, 0xd4, 0xab, 0xfb, 0xcb, 0xbf, 0xce, 0xc1, 0xe4, 0xf3, 0x1a, 0x3c, 0xd2, 0xd6, 0x1a, - 0x8f, 0xdf, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x4c, 0xe9, 0x02, 0x81, 0x05, 0x00, 0x00, + // 529 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0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, 0x9e, 0x63, 0x1c, + 0x12, 0xc6, 0x3a, 0x3c, 0x74, 0x7d, 0xc7, 0x9c, 0xa5, 0xc2, 0xf7, 0xe0, 0x16, 0x96, 0xf5, 0xac, + 0x81, 0x2c, 0x68, 0xc9, 0x65, 0x27, 0x8a, 0xde, 0xcd, 0x5b, 0x47, 0xa6, 0x75, 0xe3, 0x4a, 0x2c, + 0x93, 0x59, 0xc2, 0x39, 0x63, 0x1d, 0x14, 0x63, 0xa6, 0xb3, 0x76, 0xb5, 0xfb, 0x60, 0xfb, 0x42, + 0x1e, 0x29, 0xe3, 0xbd, 0xbf, 0x0a, 0x58, 0x6d, 0x31, 0x07, 0x1e, 0x81, 0xe2, 0x7f, 0x27, 0xb3, + 0x9d, 0x37, 0xd1, 0x82, 0x74, 0x6a, 0x7d, 0xa9, 0xb4, 0xb4, 0x1f, 0xfc, 0xa4, 0x00, 0xf5, 0x02, + 0x79, 0x77, 0xcf, 0xa9, 0x76, 0x3e, 0x44, 0x7d, 0x7a, 0x69, 0x48, 0x3a, 0x4c, 0xa3, 0x7d, 0x3c, + 0xd1, 0x94, 0x93, 0x89, 0xa6, 0xfc, 0x9e, 0x68, 0xca, 0xe7, 0xa9, 0x56, 0x38, 0x99, 0x6a, 0x85, + 0x9f, 0x53, 0xad, 0xf0, 0xee, 0xc9, 0xf2, 0xa7, 0x38, 0x4a, 0xbf, 0x25, 0xf1, 0x45, 0x76, 0xaf, + 0x0a, 0xff, 0xa3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x66, 0x7c, 0x37, 0x6e, 0x04, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -378,9 +281,6 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // DepositToVault deposits funds into a vault. DepositToVault(ctx context.Context, in *MsgDepositToVault, opts ...grpc.CallOption) (*MsgDepositToVaultResponse, error) - // UpdateParams updates the Params in state. - // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // UpdateDefaultQuotingParams updates the default quoting params in state. UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) } @@ -402,15 +302,6 @@ func (c *msgClient) DepositToVault(ctx context.Context, in *MsgDepositToVault, o 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...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdateDefaultQuotingParams, opts ...grpc.CallOption) (*MsgUpdateDefaultQuotingParamsResponse, error) { out := new(MsgUpdateDefaultQuotingParamsResponse) err := c.cc.Invoke(ctx, "/dydxprotocol.vault.Msg/UpdateDefaultQuotingParams", in, out, opts...) @@ -424,9 +315,6 @@ func (c *msgClient) UpdateDefaultQuotingParams(ctx context.Context, in *MsgUpdat type MsgServer interface { // DepositToVault deposits funds into a vault. DepositToVault(context.Context, *MsgDepositToVault) (*MsgDepositToVaultResponse, error) - // UpdateParams updates the Params in state. - // Deprecated since v6.x in favor of UpdateDefaultQuotingParams. - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // UpdateDefaultQuotingParams updates the default quoting params in state. UpdateDefaultQuotingParams(context.Context, *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) } @@ -438,9 +326,6 @@ 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) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} func (*UnimplementedMsgServer) UpdateDefaultQuotingParams(ctx context.Context, req *MsgUpdateDefaultQuotingParams) (*MsgUpdateDefaultQuotingParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateDefaultQuotingParams not implemented") } @@ -467,24 +352,6 @@ func _Msg_DepositToVault_Handler(srv interface{}, ctx context.Context, dec func( 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 { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dydxprotocol.vault.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_UpdateDefaultQuotingParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateDefaultQuotingParams) if err := dec(in); err != nil { @@ -511,10 +378,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "DepositToVault", Handler: _Msg_DepositToVault_Handler, }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, { MethodName: "UpdateDefaultQuotingParams", Handler: _Msg_UpdateDefaultQuotingParams_Handler, @@ -604,69 +467,6 @@ func (m *MsgDepositToVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgUpdateDefaultQuotingParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -769,30 +569,6 @@ func (m *MsgDepositToVaultResponse) Size() (n int) { return n } -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgUpdateDefaultQuotingParams) Size() (n int) { if m == nil { return 0 @@ -1028,171 +804,6 @@ func (m *MsgDepositToVaultResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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 err := m.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *MsgUpdateDefaultQuotingParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From 16018d058fd5341f741269ead189034bff909ce9 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Fri, 2 Aug 2024 12:34:30 -0400 Subject: [PATCH 09/10] fix genesis test --- protocol/app/testdata/default_genesis_state.json | 1 + protocol/testutil/constants/genesis.go | 1 + 2 files changed, 2 insertions(+) diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index c501b74aec..8934b1e55a 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -490,6 +490,7 @@ "order_expiration_seconds": 60, "activation_threshold_quote_quantums": "1000000000" }, + "params": null, "vaults": [] }, "vest": { diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index 5b9260cb31..18d3590788 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -4523,6 +4523,7 @@ const GenesisState = `{ "order_expiration_seconds": 60, "activation_threshold_quote_quantums": "1000000000" }, + "params": null, "vaults": [] }, "vest": { From 64c06197e1427407a8045344bfe699c3ebe506a9 Mon Sep 17 00:00:00 2001 From: Tian Qin Date: Fri, 2 Aug 2024 13:58:51 -0400 Subject: [PATCH 10/10] reserve vault genesis params --- .../src/codegen/dydxprotocol/vault/genesis.ts | 28 +--- proto/dydxprotocol/vault/genesis.proto | 5 +- .../app/testdata/default_genesis_state.json | 1 - .../scripts/genesis/sample_pregenesis.json | 1 - protocol/testutil/constants/genesis.go | 1 - protocol/x/vault/types/genesis.pb.go | 135 +++++------------- 6 files changed, 39 insertions(+), 132 deletions(-) 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 f9227a1c0e..9264ce2266 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts @@ -1,4 +1,4 @@ -import { Params, ParamsSDKType, QuotingParams, QuotingParamsSDKType } from "./params"; +import { QuotingParams, QuotingParamsSDKType } from "./params"; import { VaultId, VaultIdSDKType } from "./vault"; import { NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./share"; import * as _m0 from "protobufjs/minimal"; @@ -6,15 +6,7 @@ import { DeepPartial } from "../../helpers"; /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisState { - /** - * The parameters of the module. - * Deprecated since v6.x in favor of default_quoting_params. - */ - - /** @deprecated */ - params?: Params; /** The vaults. */ - vaults: Vault[]; /** The default quoting parameters for all vaults. */ @@ -23,15 +15,7 @@ export interface GenesisState { /** GenesisState defines `x/vault`'s genesis state. */ export interface GenesisStateSDKType { - /** - * The parameters of the module. - * Deprecated since v6.x in favor of default_quoting_params. - */ - - /** @deprecated */ - params?: ParamsSDKType; /** The vaults. */ - vaults: VaultSDKType[]; /** The default quoting parameters for all vaults. */ @@ -76,7 +60,6 @@ export interface VaultSDKType { function createBaseGenesisState(): GenesisState { return { - params: undefined, vaults: [], defaultQuotingParams: undefined }; @@ -84,10 +67,6 @@ function createBaseGenesisState(): GenesisState { export const GenesisState = { encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.vaults) { Vault.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -108,10 +87,6 @@ export const GenesisState = { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.params = Params.decode(reader, reader.uint32()); - break; - case 2: message.vaults.push(Vault.decode(reader, reader.uint32())); break; @@ -131,7 +106,6 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.vaults = object.vaults?.map(e => Vault.fromPartial(e)) || []; message.defaultQuotingParams = object.defaultQuotingParams !== undefined && object.defaultQuotingParams !== null ? QuotingParams.fromPartial(object.defaultQuotingParams) : undefined; return message; diff --git a/proto/dydxprotocol/vault/genesis.proto b/proto/dydxprotocol/vault/genesis.proto index 004dd2457e..750fd8b84c 100644 --- a/proto/dydxprotocol/vault/genesis.proto +++ b/proto/dydxprotocol/vault/genesis.proto @@ -10,9 +10,8 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"; // GenesisState defines `x/vault`'s genesis state. message GenesisState { - // The parameters of the module. - // Deprecated since v6.x in favor of default_quoting_params. - Params params = 1 [ deprecated = true ]; + // `params` field replaced since v6.x by default_quoting_params. + reserved 1; // The vaults. repeated Vault vaults = 2; // The default quoting parameters for all vaults. diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 8934b1e55a..c501b74aec 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -490,7 +490,6 @@ "order_expiration_seconds": 60, "activation_threshold_quote_quantums": "1000000000" }, - "params": null, "vaults": [] }, "vest": { diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 87df12b12c..dd13b8592a 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -3911,7 +3911,6 @@ "spread_buffer_ppm": 1500, "spread_min_ppm": 3000 }, - "params": null, "vaults": [] }, "vest": { diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index 18d3590788..5b9260cb31 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -4523,7 +4523,6 @@ const GenesisState = `{ "order_expiration_seconds": 60, "activation_threshold_quote_quantums": "1000000000" }, - "params": null, "vaults": [] }, "vest": { diff --git a/protocol/x/vault/types/genesis.pb.go b/protocol/x/vault/types/genesis.pb.go index 8bc7668cb0..c4333c6484 100644 --- a/protocol/x/vault/types/genesis.pb.go +++ b/protocol/x/vault/types/genesis.pb.go @@ -25,9 +25,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines `x/vault`'s genesis state. type GenesisState struct { - // The parameters of the module. - // Deprecated since v6.x in favor of default_quoting_params. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // Deprecated: Do not use. // The vaults. Vaults []*Vault `protobuf:"bytes,2,rep,name=vaults,proto3" json:"vaults,omitempty"` // The default quoting parameters for all vaults. @@ -67,14 +64,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -// Deprecated: Do not use. -func (m *GenesisState) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - func (m *GenesisState) GetVaults() []*Vault { if m != nil { return m.Vaults @@ -179,33 +168,33 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/genesis.proto", fileDescriptor_4be4a747b209e41c) } var fileDescriptor_4be4a747b209e41c = []byte{ - // 414 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x3f, 0x8f, 0xd3, 0x30, - 0x14, 0x4f, 0x9a, 0xbb, 0x82, 0x9c, 0x1e, 0x83, 0x39, 0x9d, 0x42, 0x10, 0xbe, 0x70, 0x53, 0x17, - 0x12, 0x71, 0x87, 0x8e, 0x15, 0x8e, 0x01, 0x6e, 0x01, 0xea, 0x4a, 0x0c, 0x48, 0x28, 0x4a, 0x13, - 0x93, 0x46, 0x4a, 0xe2, 0x36, 0x76, 0x4a, 0xfb, 0x2d, 0xf8, 0x4e, 0x2c, 0x1d, 0x3b, 0x76, 0x42, - 0xa8, 0xfd, 0x22, 0xc8, 0x2f, 0xa6, 0x6a, 0x21, 0x20, 0x16, 0xfb, 0xf9, 0xfd, 0xfe, 0xbc, 0xe7, - 0xa7, 0x87, 0xbc, 0x64, 0x91, 0xcc, 0x27, 0x15, 0x97, 0x3c, 0xe6, 0x79, 0x30, 0x8b, 0xea, 0x5c, - 0x06, 0x29, 0x2b, 0x99, 0xc8, 0x84, 0x0f, 0x69, 0x8c, 0xf7, 0x19, 0x3e, 0x30, 0xdc, 0xd3, 0x94, - 0xa7, 0x1c, 0x72, 0x81, 0x8a, 0x1a, 0xa6, 0x7b, 0xde, 0xe2, 0x35, 0x89, 0xaa, 0xa8, 0xd0, 0x56, - 0x2e, 0x69, 0x21, 0x88, 0x71, 0x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a1, 0xb3, 0x82, 0x0b, - 0x19, 0x56, 0x2c, 0x66, 0xa5, 0x0c, 0xe3, 0x3c, 0x53, 0x57, 0x96, 0x08, 0xe7, 0xd8, 0xb3, 0xfa, - 0x27, 0xf4, 0xbe, 0x42, 0x29, 0x80, 0xaf, 0x00, 0xbb, 0x4d, 0xc4, 0xcd, 0x60, 0xb9, 0x21, 0xe6, - 0x6a, 0x43, 0xcc, 0x1f, 0x1b, 0x62, 0x7e, 0xdd, 0x12, 0x63, 0xb5, 0x25, 0xc6, 0x7a, 0x4b, 0x8c, - 0x8f, 0xcf, 0xd3, 0x4c, 0x8e, 0xeb, 0x91, 0x1f, 0xf3, 0x22, 0x38, 0xdc, 0xb2, 0x67, 0x4f, 0xe2, - 0x71, 0x94, 0x95, 0xc1, 0x2e, 0x33, 0xd7, 0x9b, 0x27, 0x17, 0x13, 0x26, 0x46, 0x5d, 0xc8, 0x5f, - 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xb6, 0xba, 0x8f, 0x29, 0x03, 0x00, 0x00, + // 407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0xaf, 0xd2, 0x40, + 0x10, 0xc7, 0x5b, 0xca, 0x7b, 0xbe, 0x6c, 0x79, 0xc6, 0xac, 0x2f, 0x2f, 0x15, 0xe3, 0x52, 0x39, + 0x71, 0xb1, 0x8d, 0x60, 0xf4, 0xaa, 0x78, 0x50, 0x3c, 0xa8, 0x2c, 0x89, 0x07, 0x13, 0xd3, 0x94, + 0x76, 0x2d, 0x4d, 0xda, 0x2e, 0x74, 0xb7, 0x08, 0xdf, 0xc2, 0x4f, 0xe1, 0x17, 0xf1, 0xc2, 0x91, + 0xa3, 0x27, 0x63, 0xe0, 0x8b, 0x98, 0x9d, 0x56, 0x02, 0x5a, 0x8d, 0x97, 0xed, 0xec, 0xfc, 0x7f, + 0xf3,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0xba, 0x48, 0x27, 0x00, 0x51, 0x13, 0x4a, 0xca, 0x0b, 0x7e, + 0x86, 0x5a, 0xfc, 0x53, 0xc6, 0xf2, 0x5f, 0x0e, 0x06, 0x4c, 0x88, 0xd4, 0x39, 0xbc, 0x51, 0x1c, + 0x94, 0x51, 0x93, 0x1f, 0x62, 0x81, 0x5f, 0xa2, 0x9b, 0xbf, 0xcd, 0xa8, 0xf9, 0x9f, 0x33, 0xa2, + 0x97, 0x8b, 0xe3, 0x2b, 0x1e, 0xa0, 0xeb, 0x94, 0x0b, 0xe9, 0xe5, 0x2c, 0x60, 0x99, 0xf4, 0x82, + 0x24, 0x56, 0x9f, 0x38, 0x14, 0xd6, 0x99, 0x6d, 0xf4, 0x2e, 0xe9, 0x6d, 0xa5, 0x52, 0x10, 0x9f, + 0x83, 0x36, 0x0a, 0xc5, 0x70, 0xbc, 0xd9, 0x11, 0x7d, 0xbb, 0x23, 0xfa, 0x8f, 0x1d, 0xd1, 0x3f, + 0xef, 0x89, 0xb6, 0xdd, 0x13, 0xed, 0xdb, 0x9e, 0x68, 0xef, 0x9f, 0x44, 0xb1, 0x9c, 0x15, 0x53, + 0x27, 0xe0, 0xa9, 0x7b, 0xba, 0x33, 0x8f, 0x1e, 0x04, 0x33, 0x3f, 0xce, 0xdc, 0x43, 0x66, 0x55, + 0xed, 0x91, 0x5c, 0xcf, 0x99, 0x98, 0x9e, 0x43, 0x7e, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0xe9, + 0xf6, 0xd8, 0x81, 0xf7, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -252,18 +241,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -288,20 +265,20 @@ func (m *Vault) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.MostRecentClientIds) > 0 { - dAtA4 := make([]byte, len(m.MostRecentClientIds)*10) - var j3 int + dAtA3 := make([]byte, len(m.MostRecentClientIds)*10) + var j2 int for _, num := range m.MostRecentClientIds { for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j3++ + j2++ } - dAtA4[j3] = uint8(num) - j3++ + dAtA3[j2] = uint8(num) + j2++ } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintGenesis(dAtA, i, uint64(j3)) + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintGenesis(dAtA, i, uint64(j2)) i-- dAtA[i] = 0x2a } @@ -375,10 +352,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - } if len(m.Vaults) > 0 { for _, e := range m.Vaults { l = e.Size() @@ -459,42 +432,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Vaults", wireType)