diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts index c1210fdd39..fda20a00b7 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts @@ -1,3 +1,4 @@ +import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** @@ -28,6 +29,36 @@ export interface MsgSetMarketsHardCapResponse {} /** MsgSetMarketsHardCapResponse defines the MsgSetMarketsHardCap response */ export interface MsgSetMarketsHardCapResponseSDKType {} +/** MsgCreateMarketPermissionless is a message used to create new markets without // going through x/gov */ + +export interface MsgCreateMarketPermissionless { + /** The name of the `Perpetual` (e.g. `BTC-USD`). */ + ticker: string; + /** The subaccount to deposit from. */ + + subaccountId?: SubaccountId; + /** Number of quote quantums to deposit. */ + + quoteQuantums: Uint8Array; +} +/** MsgCreateMarketPermissionless is a message used to create new markets without // going through x/gov */ + +export interface MsgCreateMarketPermissionlessSDKType { + /** The name of the `Perpetual` (e.g. `BTC-USD`). */ + ticker: string; + /** The subaccount to deposit from. */ + + subaccount_id?: SubaccountIdSDKType; + /** Number of quote quantums to deposit. */ + + quote_quantums: Uint8Array; +} +/** MsgCreateMarketPermissionlessResponse defines the MsgCreateMarketPermissionless response */ + +export interface MsgCreateMarketPermissionlessResponse {} +/** MsgCreateMarketPermissionlessResponse defines the MsgCreateMarketPermissionless response */ + +export interface MsgCreateMarketPermissionlessResponseSDKType {} function createBaseMsgSetMarketsHardCap(): MsgSetMarketsHardCap { return { @@ -116,4 +147,103 @@ export const MsgSetMarketsHardCapResponse = { return message; } +}; + +function createBaseMsgCreateMarketPermissionless(): MsgCreateMarketPermissionless { + return { + ticker: "", + subaccountId: undefined, + quoteQuantums: new Uint8Array() + }; +} + +export const MsgCreateMarketPermissionless = { + encode(message: MsgCreateMarketPermissionless, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ticker !== "") { + writer.uint32(10).string(message.ticker); + } + + if (message.subaccountId !== undefined) { + SubaccountId.encode(message.subaccountId, writer.uint32(18).fork()).ldelim(); + } + + if (message.quoteQuantums.length !== 0) { + writer.uint32(26).bytes(message.quoteQuantums); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateMarketPermissionless { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateMarketPermissionless(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.ticker = reader.string(); + break; + + case 2: + message.subaccountId = SubaccountId.decode(reader, reader.uint32()); + break; + + case 3: + message.quoteQuantums = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgCreateMarketPermissionless { + const message = createBaseMsgCreateMarketPermissionless(); + message.ticker = object.ticker ?? ""; + message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; + message.quoteQuantums = object.quoteQuantums ?? new Uint8Array(); + return message; + } + +}; + +function createBaseMsgCreateMarketPermissionlessResponse(): MsgCreateMarketPermissionlessResponse { + return {}; +} + +export const MsgCreateMarketPermissionlessResponse = { + encode(_: MsgCreateMarketPermissionlessResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateMarketPermissionlessResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateMarketPermissionlessResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgCreateMarketPermissionlessResponse { + const message = createBaseMsgCreateMarketPermissionlessResponse(); + return message; + } + }; \ No newline at end of file diff --git a/proto/dydxprotocol/listing/tx.proto b/proto/dydxprotocol/listing/tx.proto index 7a853ab619..31e4a2548a 100644 --- a/proto/dydxprotocol/listing/tx.proto +++ b/proto/dydxprotocol/listing/tx.proto @@ -3,6 +3,9 @@ package dydxprotocol.listing; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "dydxprotocol/subaccounts/subaccount.proto"; + option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/listing/types"; @@ -27,3 +30,24 @@ message MsgSetMarketsHardCap { // MsgSetMarketsHardCapResponse defines the MsgSetMarketsHardCap response message MsgSetMarketsHardCapResponse {} + +// MsgCreateMarketPermissionless is a message used to create new markets without // going through x/gov +message MsgCreateMarketPermissionless { + option (cosmos.msg.v1.signer) = "subaccount_id"; + + // The name of the `Perpetual` (e.g. `BTC-USD`). + string ticker = 1; + + // The subaccount to deposit from. + dydxprotocol.subaccounts.SubaccountId subaccount_id = 2; + + // Number of quote quantums to deposit. + bytes quote_quantums = 3 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; +} + +// MsgCreateMarketPermissionlessResponse defines the MsgCreateMarketPermissionless response +message MsgCreateMarketPermissionlessResponse {} diff --git a/protocol/app/msgs/all_msgs.go b/protocol/app/msgs/all_msgs.go index 14019a0896..5899cc2b2b 100644 --- a/protocol/app/msgs/all_msgs.go +++ b/protocol/app/msgs/all_msgs.go @@ -197,8 +197,10 @@ var ( "/dydxprotocol.govplus.MsgSlashValidatorResponse": {}, // listing - "/dydxprotocol.listing.MsgSetMarketsHardCap": {}, - "/dydxprotocol.listing.MsgSetMarketsHardCapResponse": {}, + "/dydxprotocol.listing.MsgSetMarketsHardCap": {}, + "/dydxprotocol.listing.MsgSetMarketsHardCapResponse": {}, + "/dydxprotocol.listing.MsgCreateMarketPermissionless": {}, + "/dydxprotocol.listing.MsgCreateMarketPermissionlessResponse": {}, // perpetuals "/dydxprotocol.perpetuals.MsgAddPremiumVotes": {}, diff --git a/protocol/app/msgs/internal_msgs.go b/protocol/app/msgs/internal_msgs.go index a1a2889af0..74c6d44cef 100644 --- a/protocol/app/msgs/internal_msgs.go +++ b/protocol/app/msgs/internal_msgs.go @@ -144,8 +144,10 @@ var ( "/dydxprotocol.govplus.MsgSlashValidatorResponse": nil, // listing - "/dydxprotocol.listing.MsgSetMarketsHardCap": &listing.MsgSetMarketsHardCap{}, - "/dydxprotocol.listing.MsgSetMarketsHardCapResponse": nil, + "/dydxprotocol.listing.MsgSetMarketsHardCap": &listing.MsgSetMarketsHardCap{}, + "/dydxprotocol.listing.MsgSetMarketsHardCapResponse": nil, + "/dydxprotocol.listing.MsgCreateMarketPermissionless": &listing.MsgCreateMarketPermissionless{}, + "/dydxprotocol.listing.MsgCreateMarketPermissionlessResponse": nil, // perpetuals "/dydxprotocol.perpetuals.MsgCreatePerpetual": &perpetuals.MsgCreatePerpetual{}, diff --git a/protocol/app/msgs/internal_msgs_test.go b/protocol/app/msgs/internal_msgs_test.go index da50b0e1c3..15fd9f62fb 100644 --- a/protocol/app/msgs/internal_msgs_test.go +++ b/protocol/app/msgs/internal_msgs_test.go @@ -104,6 +104,8 @@ func TestInternalMsgSamples_Gov_Key(t *testing.T) { // listing "/dydxprotocol.listing.MsgSetMarketsHardCap", "/dydxprotocol.listing.MsgSetMarketsHardCapResponse", + "/dydxprotocol.listing.MsgCreateMarketPermissionless", + "/dydxprotocol.listing.MsgCreateMarketPermissionlessResponse", // perpeutals "/dydxprotocol.perpetuals.MsgCreatePerpetual", diff --git a/protocol/x/listing/keeper/msg_create_market_permissionless.go b/protocol/x/listing/keeper/msg_create_market_permissionless.go new file mode 100644 index 0000000000..96d4d5a176 --- /dev/null +++ b/protocol/x/listing/keeper/msg_create_market_permissionless.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" +) + +func (k msgServer) CreateMarketPermissionless( + goCtx context.Context, + msg *types.MsgCreateMarketPermissionless, +) (*types.MsgCreateMarketPermissionlessResponse, error) { + ctx := lib.UnwrapSDKContext(goCtx, types.ModuleName) + + // Check if the number of listed markets is above the hard cap + numPerpetuals := len(k.PerpetualsKeeper.GetAllPerpetuals(ctx)) + if uint32(numPerpetuals) > k.Keeper.GetMarketsHardCap(ctx) { + return nil, types.ErrMarketsHardCapReached + } + + marketId, err := k.Keeper.CreateMarket(ctx, msg.Ticker) + if err != nil { + return nil, err + } + + perpetualId, err := k.Keeper.CreatePerpetual(ctx, marketId, msg.Ticker) + if err != nil { + return nil, err + } + + _, err = k.Keeper.CreateClobPair(ctx, perpetualId) + if err != nil { + return nil, err + } + + // TODO: vault deposit for PML + + return &types.MsgCreateMarketPermissionlessResponse{}, nil +} diff --git a/protocol/x/listing/types/errors.go b/protocol/x/listing/types/errors.go index 4476f39da7..6ac9bd7237 100644 --- a/protocol/x/listing/types/errors.go +++ b/protocol/x/listing/types/errors.go @@ -9,4 +9,10 @@ var ( 1, "reference price is zero", ) + + ErrMarketsHardCapReached = errorsmod.Register( + ModuleName, + 2, + "listed markets hard cap reached", + ) ) diff --git a/protocol/x/listing/types/expected_keepers.go b/protocol/x/listing/types/expected_keepers.go index 1f694d1b17..14358d07b1 100644 --- a/protocol/x/listing/types/expected_keepers.go +++ b/protocol/x/listing/types/expected_keepers.go @@ -50,4 +50,5 @@ type PerpetualsKeeper interface { marketType perpetualtypes.PerpetualMarketType, ) (perpetualtypes.Perpetual, error) AcquireNextPerpetualID(ctx sdk.Context) uint32 + GetAllPerpetuals(ctx sdk.Context) (list []perpetualtypes.Perpetual) } diff --git a/protocol/x/listing/types/tx.pb.go b/protocol/x/listing/types/tx.pb.go index faf1455764..c26874be46 100644 --- a/protocol/x/listing/types/tx.pb.go +++ b/protocol/x/listing/types/tx.pb.go @@ -8,8 +8,11 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" 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/subaccounts/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -121,35 +124,142 @@ func (m *MsgSetMarketsHardCapResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetMarketsHardCapResponse proto.InternalMessageInfo +// MsgCreateMarketPermissionless is a message used to create new markets without // going through x/gov +type MsgCreateMarketPermissionless struct { + // The name of the `Perpetual` (e.g. `BTC-USD`). + Ticker string `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` + // The subaccount to deposit from. + SubaccountId *types.SubaccountId `protobuf:"bytes,2,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id,omitempty"` + // Number of quote quantums to deposit. + QuoteQuantums github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=quote_quantums,json=quoteQuantums,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"quote_quantums"` +} + +func (m *MsgCreateMarketPermissionless) Reset() { *m = MsgCreateMarketPermissionless{} } +func (m *MsgCreateMarketPermissionless) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMarketPermissionless) ProtoMessage() {} +func (*MsgCreateMarketPermissionless) Descriptor() ([]byte, []int) { + return fileDescriptor_144a579c1e2dcb94, []int{2} +} +func (m *MsgCreateMarketPermissionless) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateMarketPermissionless) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateMarketPermissionless.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 *MsgCreateMarketPermissionless) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMarketPermissionless.Merge(m, src) +} +func (m *MsgCreateMarketPermissionless) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateMarketPermissionless) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMarketPermissionless.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateMarketPermissionless proto.InternalMessageInfo + +func (m *MsgCreateMarketPermissionless) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +func (m *MsgCreateMarketPermissionless) GetSubaccountId() *types.SubaccountId { + if m != nil { + return m.SubaccountId + } + return nil +} + +// MsgCreateMarketPermissionlessResponse defines the MsgCreateMarketPermissionless response +type MsgCreateMarketPermissionlessResponse struct { +} + +func (m *MsgCreateMarketPermissionlessResponse) Reset() { *m = MsgCreateMarketPermissionlessResponse{} } +func (m *MsgCreateMarketPermissionlessResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMarketPermissionlessResponse) ProtoMessage() {} +func (*MsgCreateMarketPermissionlessResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_144a579c1e2dcb94, []int{3} +} +func (m *MsgCreateMarketPermissionlessResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateMarketPermissionlessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateMarketPermissionlessResponse.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 *MsgCreateMarketPermissionlessResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMarketPermissionlessResponse.Merge(m, src) +} +func (m *MsgCreateMarketPermissionlessResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateMarketPermissionlessResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMarketPermissionlessResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateMarketPermissionlessResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSetMarketsHardCap)(nil), "dydxprotocol.listing.MsgSetMarketsHardCap") proto.RegisterType((*MsgSetMarketsHardCapResponse)(nil), "dydxprotocol.listing.MsgSetMarketsHardCapResponse") + proto.RegisterType((*MsgCreateMarketPermissionless)(nil), "dydxprotocol.listing.MsgCreateMarketPermissionless") + proto.RegisterType((*MsgCreateMarketPermissionlessResponse)(nil), "dydxprotocol.listing.MsgCreateMarketPermissionlessResponse") } func init() { proto.RegisterFile("dydxprotocol/listing/tx.proto", fileDescriptor_144a579c1e2dcb94) } var fileDescriptor_144a579c1e2dcb94 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xa9, 0x4c, 0xa9, - 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0xcf, 0xc9, 0x2c, 0x2e, 0xc9, 0xcc, 0x4b, - 0xd7, 0x2f, 0xa9, 0xd0, 0x03, 0x8b, 0x09, 0x89, 0x20, 0x4b, 0xeb, 0x41, 0xa5, 0xa5, 0x24, 0x93, - 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x12, 0xfa, 0x10, 0x0e, 0x44, 0x83, 0x94, 0x38, 0x84, - 0xa7, 0x9f, 0x5b, 0x9c, 0xae, 0x5f, 0x66, 0x08, 0xa2, 0x20, 0x12, 0x4a, 0xfd, 0x8c, 0x5c, 0x22, - 0xbe, 0xc5, 0xe9, 0xc1, 0xa9, 0x25, 0xbe, 0x89, 0x45, 0xd9, 0xa9, 0x25, 0xc5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66, 0xa2, 0x9b, 0x9c, 0x91, 0x98, 0x99, 0xa7, 0x0f, 0x17, 0xa9, 0x40, 0xc4, 0x67, - 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x58, 0xc6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xea, 0x0c, - 0xfe, 0xfa, 0xf4, 0x01, 0x00, 0x00, + // 483 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0xb6, 0x50, 0xe8, 0xd8, 0x14, 0xba, 0x2c, 0x1a, 0x83, 0xdd, 0x86, 0x80, 0x1a, 0x0b, + 0xdd, 0xc5, 0x28, 0x82, 0x3d, 0x69, 0x0a, 0xd2, 0x22, 0x01, 0xdd, 0xbd, 0x79, 0x59, 0x26, 0x3b, + 0xe3, 0xec, 0xd0, 0xdd, 0x99, 0xed, 0xbc, 0xd9, 0x92, 0xf4, 0xe8, 0xcd, 0x93, 0xfe, 0x14, 0x0f, + 0xfe, 0x88, 0x1e, 0x8b, 0x27, 0xf1, 0x50, 0x24, 0x39, 0xf8, 0x37, 0x24, 0x3b, 0xdb, 0x26, 0xc1, + 0x20, 0x39, 0xed, 0x7b, 0xef, 0x7b, 0xf3, 0xbd, 0x37, 0xdf, 0xb7, 0x83, 0x76, 0xc9, 0x88, 0x0c, + 0x73, 0x25, 0xb5, 0x8c, 0x65, 0xea, 0xa7, 0x1c, 0x34, 0x17, 0xcc, 0xd7, 0x43, 0xaf, 0xac, 0xd9, + 0xce, 0x3c, 0xec, 0x55, 0x70, 0xf3, 0x7e, 0x2c, 0x21, 0x93, 0x10, 0x95, 0x80, 0x6f, 0x12, 0x73, + 0xa0, 0x79, 0xcf, 0x64, 0x7e, 0x06, 0xcc, 0x3f, 0x7f, 0x3a, 0xfd, 0x54, 0x80, 0xc3, 0x24, 0x93, + 0xe6, 0xc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0x52, 0xd3, 0xe8, 0xac, 0xc0, 0x42, 0x17, 0x19, 0x34, + 0xd6, 0x5b, 0x56, 0x67, 0xab, 0x77, 0x7c, 0x79, 0xbd, 0x57, 0xfb, 0x75, 0xbd, 0xf7, 0x8a, 0x71, + 0x9d, 0x14, 0x03, 0x2f, 0x96, 0x99, 0xbf, 0x60, 0xc7, 0xf9, 0xf3, 0x83, 0x38, 0xc1, 0x5c, 0xf8, + 0xb7, 0x15, 0xa2, 0x47, 0x39, 0x05, 0x2f, 0xa4, 0x8a, 0xe3, 0x94, 0x5f, 0xe0, 0x41, 0x4a, 0x4f, + 0x84, 0x0e, 0xea, 0x25, 0xff, 0xfb, 0x8a, 0xfe, 0xd0, 0x9e, 0xea, 0xb4, 0x78, 0x81, 0xf6, 0x63, + 0xf4, 0xf0, 0xbf, 0x52, 0xdc, 0x88, 0xd6, 0xbd, 0x40, 0xeb, 0x7d, 0x60, 0x36, 0xa0, 0x9d, 0x7f, + 0x9d, 0xde, 0xf7, 0x96, 0xfd, 0x8e, 0xde, 0x32, 0x13, 0x9a, 0xdd, 0xd5, 0x7b, 0x6f, 0x66, 0xf7, + 0xc2, 0xcb, 0xb1, 0x6b, 0x5d, 0x8d, 0x5d, 0xeb, 0xf7, 0xd8, 0xb5, 0xbe, 0x4e, 0xdc, 0xda, 0xd5, + 0xc4, 0xad, 0xfd, 0x9c, 0xb8, 0xb5, 0x0f, 0x2f, 0x57, 0xd7, 0x68, 0x38, 0x7b, 0x45, 0x53, 0xb1, + 0x06, 0x1b, 0x25, 0xf2, 0xec, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0x72, 0xd2, 0x5a, 0x6a, + 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -292,6 +402,81 @@ func (m *MsgSetMarketsHardCapResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgCreateMarketPermissionless) 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 *MsgCreateMarketPermissionless) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateMarketPermissionless) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.QuoteQuantums.Size() + i -= size + if _, err := m.QuoteQuantums.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.SubaccountId != nil { + { + size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintTx(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateMarketPermissionlessResponse) 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 *MsgCreateMarketPermissionlessResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateMarketPermissionlessResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -328,6 +513,34 @@ func (m *MsgSetMarketsHardCapResponse) Size() (n int) { return n } +func (m *MsgCreateMarketPermissionless) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.SubaccountId != nil { + l = m.SubaccountId.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.QuoteQuantums.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateMarketPermissionlessResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -485,6 +698,207 @@ func (m *MsgSetMarketsHardCapResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreateMarketPermissionless) 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: MsgCreateMarketPermissionless: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateMarketPermissionless: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", 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.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubaccountId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubaccountId == nil { + m.SubaccountId = &types.SubaccountId{} + } + if err := m.SubaccountId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuoteQuantums", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.QuoteQuantums.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 *MsgCreateMarketPermissionlessResponse) 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: MsgCreateMarketPermissionlessResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateMarketPermissionlessResponse: 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0