diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index ebb2583e3c..5b3e18593a 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -140,17 +140,18 @@ import * as _150 from "./clob/tx.rpc.msg"; import * as _151 from "./delaymsg/tx.rpc.msg"; import * as _152 from "./feetiers/tx.rpc.msg"; import * as _153 from "./govplus/tx.rpc.msg"; -import * as _154 from "./perpetuals/tx.rpc.msg"; -import * as _155 from "./prices/tx.rpc.msg"; -import * as _156 from "./ratelimit/tx.rpc.msg"; -import * as _157 from "./rewards/tx.rpc.msg"; -import * as _158 from "./sending/tx.rpc.msg"; -import * as _159 from "./stats/tx.rpc.msg"; -import * as _160 from "./vault/tx.rpc.msg"; -import * as _161 from "./vest/tx.rpc.msg"; -import * as _162 from "./lcd"; -import * as _163 from "./rpc.query"; -import * as _164 from "./rpc.tx"; +import * as _154 from "./listing/tx.rpc.msg"; +import * as _155 from "./perpetuals/tx.rpc.msg"; +import * as _156 from "./prices/tx.rpc.msg"; +import * as _157 from "./ratelimit/tx.rpc.msg"; +import * as _158 from "./rewards/tx.rpc.msg"; +import * as _159 from "./sending/tx.rpc.msg"; +import * as _160 from "./stats/tx.rpc.msg"; +import * as _161 from "./vault/tx.rpc.msg"; +import * as _162 from "./vest/tx.rpc.msg"; +import * as _163 from "./lcd"; +import * as _164 from "./rpc.query"; +import * as _165 from "./rpc.tx"; export namespace dydxprotocol { export const assets = { ..._5, ..._6, @@ -256,7 +257,8 @@ export namespace dydxprotocol { export const listing = { ..._61, ..._62, ..._63, - ..._138 + ..._138, + ..._154 }; export const perpetuals = { ..._64, ..._65, @@ -265,7 +267,7 @@ export namespace dydxprotocol { ..._68, ..._122, ..._139, - ..._154 + ..._155 }; export const prices = { ..._69, ..._70, @@ -274,7 +276,7 @@ export namespace dydxprotocol { ..._73, ..._123, ..._140, - ..._155 + ..._156 }; export const ratelimit = { ..._74, ..._75, @@ -284,7 +286,7 @@ export namespace dydxprotocol { ..._79, ..._124, ..._141, - ..._156 + ..._157 }; export const rewards = { ..._80, ..._81, @@ -293,14 +295,14 @@ export namespace dydxprotocol { ..._84, ..._125, ..._142, - ..._157 + ..._158 }; export const sending = { ..._85, ..._86, ..._87, ..._88, ..._143, - ..._158 + ..._159 }; export const stats = { ..._89, ..._90, @@ -309,7 +311,7 @@ export namespace dydxprotocol { ..._93, ..._126, ..._144, - ..._159 + ..._160 }; export const subaccounts = { ..._94, ..._95, @@ -326,7 +328,7 @@ export namespace dydxprotocol { ..._103, ..._128, ..._146, - ..._160 + ..._161 }; export const vest = { ..._104, ..._105, @@ -334,10 +336,10 @@ export namespace dydxprotocol { ..._107, ..._129, ..._147, - ..._161 + ..._162 }; - export const ClientFactory = { ..._162, - ..._163, - ..._164 + export const ClientFactory = { ..._163, + ..._164, + ..._165 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/genesis.ts index 9bec4aff2b..4c44231cf9 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/genesis.ts @@ -2,17 +2,29 @@ import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** GenesisState defines `x/listing`'s genesis state. */ -export interface GenesisState {} +export interface GenesisState { + /** permissionless_listing_enabled defines whether permissionless listing is enabled. */ + permissionlessListingEnabled: boolean; +} /** GenesisState defines `x/listing`'s genesis state. */ -export interface GenesisStateSDKType {} +export interface GenesisStateSDKType { + /** permissionless_listing_enabled defines whether permissionless listing is enabled. */ + permissionless_listing_enabled: boolean; +} function createBaseGenesisState(): GenesisState { - return {}; + return { + permissionlessListingEnabled: false + }; } export const GenesisState = { - encode(_: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.permissionlessListingEnabled === true) { + writer.uint32(8).bool(message.permissionlessListingEnabled); + } + return writer; }, @@ -25,6 +37,10 @@ export const GenesisState = { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.permissionlessListingEnabled = reader.bool(); + break; + default: reader.skipType(tag & 7); break; @@ -34,8 +50,9 @@ export const GenesisState = { return message; }, - fromPartial(_: DeepPartial): GenesisState { + fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); + message.permissionlessListingEnabled = object.permissionlessListingEnabled ?? false; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.rpc.Query.ts index ab81adee85..f1f090edfa 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.rpc.Query.ts @@ -1,18 +1,34 @@ import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryPermissionlessMarketListingStatus, QueryPermissionlessMarketListingStatusResponse } from "./query"; /** Query defines the gRPC querier service. */ -export interface Query {} +export interface Query { + permissionlessMarketListingStatus(request?: QueryPermissionlessMarketListingStatus): Promise; +} export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; + this.permissionlessMarketListingStatus = this.permissionlessMarketListingStatus.bind(this); + } + + permissionlessMarketListingStatus(request: QueryPermissionlessMarketListingStatus = {}): Promise { + const data = QueryPermissionlessMarketListingStatus.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.listing.Query", "PermissionlessMarketListingStatus", data); + return promise.then(data => QueryPermissionlessMarketListingStatusResponse.decode(new _m0.Reader(data))); } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); const queryService = new QueryClientImpl(rpc); - return {}; + return { + permissionlessMarketListingStatus(request?: QueryPermissionlessMarketListingStatus): Promise { + return queryService.permissionlessMarketListingStatus(request); + } + + }; }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.ts index 693da49fc4..b8eb208a62 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/query.ts @@ -1 +1,97 @@ -export {} \ No newline at end of file +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** Queries if permissionless listings are enabled */ + +export interface QueryPermissionlessMarketListingStatus {} +/** Queries if permissionless listings are enabled */ + +export interface QueryPermissionlessMarketListingStatusSDKType {} +/** Response type indicating if permissionless listings are enabled */ + +export interface QueryPermissionlessMarketListingStatusResponse { + enabled: boolean; +} +/** Response type indicating if permissionless listings are enabled */ + +export interface QueryPermissionlessMarketListingStatusResponseSDKType { + enabled: boolean; +} + +function createBaseQueryPermissionlessMarketListingStatus(): QueryPermissionlessMarketListingStatus { + return {}; +} + +export const QueryPermissionlessMarketListingStatus = { + encode(_: QueryPermissionlessMarketListingStatus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPermissionlessMarketListingStatus { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPermissionlessMarketListingStatus(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): QueryPermissionlessMarketListingStatus { + const message = createBaseQueryPermissionlessMarketListingStatus(); + return message; + } + +}; + +function createBaseQueryPermissionlessMarketListingStatusResponse(): QueryPermissionlessMarketListingStatusResponse { + return { + enabled: false + }; +} + +export const QueryPermissionlessMarketListingStatusResponse = { + encode(message: QueryPermissionlessMarketListingStatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.enabled === true) { + writer.uint32(8).bool(message.enabled); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryPermissionlessMarketListingStatusResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPermissionlessMarketListingStatusResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.enabled = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryPermissionlessMarketListingStatusResponse { + const message = createBaseQueryPermissionlessMarketListingStatusResponse(); + message.enabled = object.enabled ?? false; + return message; + } + +}; \ No newline at end of file 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 693da49fc4..dab2fa202c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/listing/tx.ts @@ -1 +1,109 @@ -export {} \ No newline at end of file +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** MsgEnablePermissionlessMarketListing is used to enable/disable permissionless // market listing */ + +export interface MsgEnablePermissionlessMarketListing { + authority: string; + /** boolean flag to enable/disable permissionless market listing */ + + enablePermissionlessMarketListing: boolean; +} +/** MsgEnablePermissionlessMarketListing is used to enable/disable permissionless // market listing */ + +export interface MsgEnablePermissionlessMarketListingSDKType { + authority: string; + /** boolean flag to enable/disable permissionless market listing */ + + enablePermissionlessMarketListing: boolean; +} +export interface MsgEnablePermissionlessMarketListingResponse {} +export interface MsgEnablePermissionlessMarketListingResponseSDKType {} + +function createBaseMsgEnablePermissionlessMarketListing(): MsgEnablePermissionlessMarketListing { + return { + authority: "", + enablePermissionlessMarketListing: false + }; +} + +export const MsgEnablePermissionlessMarketListing = { + encode(message: MsgEnablePermissionlessMarketListing, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + + if (message.enablePermissionlessMarketListing === true) { + writer.uint32(16).bool(message.enablePermissionlessMarketListing); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePermissionlessMarketListing { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEnablePermissionlessMarketListing(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + + case 2: + message.enablePermissionlessMarketListing = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgEnablePermissionlessMarketListing { + const message = createBaseMsgEnablePermissionlessMarketListing(); + message.authority = object.authority ?? ""; + message.enablePermissionlessMarketListing = object.enablePermissionlessMarketListing ?? false; + return message; + } + +}; + +function createBaseMsgEnablePermissionlessMarketListingResponse(): MsgEnablePermissionlessMarketListingResponse { + return {}; +} + +export const MsgEnablePermissionlessMarketListingResponse = { + encode(_: MsgEnablePermissionlessMarketListingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgEnablePermissionlessMarketListingResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEnablePermissionlessMarketListingResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgEnablePermissionlessMarketListingResponse { + const message = createBaseMsgEnablePermissionlessMarketListingResponse(); + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts index 2c23915bc5..68820dd513 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts @@ -11,6 +11,7 @@ export const createRPCMsgClient = async ({ delaymsg: new (await import("./delaymsg/tx.rpc.msg")).MsgClientImpl(rpc), feetiers: new (await import("./feetiers/tx.rpc.msg")).MsgClientImpl(rpc), govplus: new (await import("./govplus/tx.rpc.msg")).MsgClientImpl(rpc), + listing: new (await import("./listing/tx.rpc.msg")).MsgClientImpl(rpc), perpetuals: new (await import("./perpetuals/tx.rpc.msg")).MsgClientImpl(rpc), prices: new (await import("./prices/tx.rpc.msg")).MsgClientImpl(rpc), ratelimit: new (await import("./ratelimit/tx.rpc.msg")).MsgClientImpl(rpc), diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 5ba0f86b23..4ca46a5083 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -5,10 +5,7 @@ Base URLs: -* For **the deployment by DYDX token holders**, use https://indexer.dydx.trade/v4 -* For **Testnet**, use https://dydx-testnet.imperator.co/v4 - -Note: Messages on Indexer WebSocket feeds are typically more recent than data fetched via Indexer's REST API, because the latter is backed by read replicas of the databases that feed the former. Ordinarily this difference is minimal (less than a second), but it might become prolonged under load. Please see [Indexer Architecture](https://dydx.exchange/blog/v4-deep-dive-indexer) for more information. +* # Authentication @@ -26,11 +23,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}', headers = headers) +r = requests.get('/addresses/{address}', headers = headers) print(r.json()) @@ -42,11 +35,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}`, +fetch('/addresses/{address}', { method: 'GET', @@ -77,7 +66,7 @@ fetch(`${baseURL}/addresses/{address}`, "subaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -97,7 +86,7 @@ fetch(`${baseURL}/addresses/{address}`, "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -115,7 +104,7 @@ fetch(`${baseURL}/addresses/{address}`, "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -124,14 +113,14 @@ fetch(`${baseURL}/addresses/{address}`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -164,11 +153,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) +r = requests.get('/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) print(r.json()) @@ -180,11 +165,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, +fetch('/addresses/{address}/subaccountNumber/{subaccountNumber}', { method: 'GET', @@ -214,7 +195,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, ```json { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -234,7 +215,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -252,7 +233,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -261,14 +242,14 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -298,11 +279,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) +r = requests.get('/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) print(r.json()) @@ -314,11 +291,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}`, +fetch('/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', { method: 'GET', @@ -348,13 +321,13 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu ```json { "address": "string", - "parentSubaccountNumber": 0.1, + "parentSubaccountNumber": 0, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -374,7 +347,7 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -392,7 +365,7 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -401,14 +374,14 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -440,12 +413,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/assetPositions', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/assetPositions', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -458,11 +427,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, +fetch('/assetPositions?address=string&subaccountNumber=0', { method: 'GET', @@ -497,7 +462,7 @@ fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -525,12 +490,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/assetPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/assetPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -543,11 +504,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -582,7 +539,7 @@ fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSub "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -610,11 +567,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/candles/perpetualMarkets/{ticker}', params={ +r = requests.get('/candles/perpetualMarkets/{ticker}', params={ 'resolution': '1MIN' }, headers = headers) @@ -628,11 +581,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, +fetch('/candles/perpetualMarkets/{ticker}?resolution=1MIN', { method: 'GET', @@ -687,7 +636,7 @@ fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -717,11 +666,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/compliance/screen/{address}', headers = headers) +r = requests.get('/compliance/screen/{address}', headers = headers) print(r.json()) @@ -733,11 +678,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/compliance/screen/{address}`, +fetch('/compliance/screen/{address}', { method: 'GET', @@ -793,12 +734,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/fills', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/fills', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -811,11 +748,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, +fetch('/fills?address=string&subaccountNumber=0', { method: 'GET', @@ -857,9 +790,9 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -875,7 +808,7 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -903,12 +836,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/fills/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/fills/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -921,11 +850,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0.1`, +fetch('/fills/parentSubaccount?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -967,9 +892,9 @@ fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0 ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -985,7 +910,7 @@ fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0 "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -1013,11 +938,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/height', headers = headers) +r = requests.get('/height', headers = headers) print(r.json()) @@ -1029,11 +950,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/height`, +fetch('/height', { method: 'GET', @@ -1082,11 +999,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalBlockTradingRewards/{address}', headers = headers) +r = requests.get('/historicalBlockTradingRewards/{address}', headers = headers) print(r.json()) @@ -1098,11 +1011,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalBlockTradingRewards/{address}`, +fetch('/historicalBlockTradingRewards/{address}', { method: 'GET', @@ -1165,11 +1074,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalFunding/{ticker}', headers = headers) +r = requests.get('/historicalFunding/{ticker}', headers = headers) print(r.json()) @@ -1181,11 +1086,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalFunding/{ticker}`, +fetch('/historicalFunding/{ticker}', { method: 'GET', @@ -1250,12 +1151,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historical-pnl', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/historical-pnl', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1268,11 +1165,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, +fetch('/historical-pnl?address=string&subaccountNumber=0', { method: 'GET', @@ -1307,9 +1200,9 @@ fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -1347,12 +1240,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historical-pnl/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/historical-pnl/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1365,11 +1254,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0.1`, +fetch('/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -1404,9 +1289,9 @@ fetch(`${baseURL}/historical-pnl/parentSubaccount?address=string&parentSubaccoun ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -1444,11 +1329,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalTradingRewardAggregations/{address}', params={ +r = requests.get('/historicalTradingRewardAggregations/{address}', params={ 'period': 'DAILY' }, headers = headers) @@ -1462,11 +1343,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY`, +fetch('/historicalTradingRewardAggregations/{address}?period=DAILY', { method: 'GET', @@ -1541,11 +1418,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orderbooks/perpetualMarket/{ticker}', headers = headers) +r = requests.get('/orderbooks/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -1557,11 +1430,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orderbooks/perpetualMarket/{ticker}`, +fetch('/orderbooks/perpetualMarket/{ticker}', { method: 'GET', @@ -1626,12 +1495,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/orders', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1644,11 +1509,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, +fetch('/orders?address=string&subaccountNumber=0', { method: 'GET', @@ -1722,7 +1583,7 @@ fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] ``` @@ -1820,12 +1681,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/orders/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1838,11 +1695,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -1916,7 +1769,7 @@ fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountN "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] ``` @@ -2014,11 +1867,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders/{orderId}', headers = headers) +r = requests.get('/orders/{orderId}', headers = headers) print(r.json()) @@ -2030,11 +1879,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders/{orderId}`, +fetch('/orders/{orderId}', { method: 'GET', @@ -2084,7 +1929,7 @@ fetch(`${baseURL}/orders/{orderId}`, "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -2110,11 +1955,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualMarkets', headers = headers) +r = requests.get('/perpetualMarkets', headers = headers) print(r.json()) @@ -2126,11 +1967,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualMarkets`, +fetch('/perpetualMarkets', { method: 'GET', @@ -2167,17 +2004,17 @@ fetch(`${baseURL}/perpetualMarkets`, "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2190,17 +2027,17 @@ fetch(`${baseURL}/perpetualMarkets`, "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2232,12 +2069,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualPositions', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/perpetualPositions', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2250,11 +2083,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, +fetch('/perpetualPositions?address=string&subaccountNumber=0', { method: 'GET', @@ -2312,7 +2141,7 @@ fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -2340,12 +2169,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/perpetualPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2358,11 +2183,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -2420,7 +2241,7 @@ fetch(`${baseURL}/perpetualPositions/parentSubaccountNumber?address=string&paren "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -2448,11 +2269,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/sparklines', params={ +r = requests.get('/sparklines', params={ 'timePeriod': 'ONE_DAY' }, headers = headers) @@ -2466,11 +2283,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, +fetch('/sparklines?timePeriod=ONE_DAY', { method: 'GET', @@ -2536,11 +2349,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/time', headers = headers) +r = requests.get('/time', headers = headers) print(r.json()) @@ -2552,11 +2361,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/time`, +fetch('/time', { method: 'GET', @@ -2579,7 +2384,7 @@ fetch(`${baseURL}/time`, ```json { "iso": "string", - "epoch": 0.1 + "epoch": 0 } ``` @@ -2605,11 +2410,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/trades/perpetualMarket/{ticker}', headers = headers) +r = requests.get('/trades/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -2621,11 +2422,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, +fetch('/trades/perpetualMarket/{ticker}', { method: 'GET', @@ -2657,9 +2454,9 @@ fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "trades": [ { "id": "string", @@ -2696,12 +2493,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/transfers', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('/transfers', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2714,11 +2507,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, +fetch('/transfers?address=string&subaccountNumber=0', { method: 'GET', @@ -2751,18 +2540,18 @@ fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -2798,12 +2587,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/transfers/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('/transfers/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2816,11 +2601,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -2853,18 +2634,18 @@ fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccou ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -2983,7 +2764,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3034,7 +2815,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3052,7 +2833,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } } @@ -3077,7 +2858,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3106,14 +2887,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } } @@ -3135,7 +2916,7 @@ This operation does not require authentication ```json { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3155,7 +2936,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3173,7 +2954,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3182,14 +2963,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3223,7 +3004,7 @@ This operation does not require authentication "subaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3243,7 +3024,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3261,7 +3042,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3270,14 +3051,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3306,13 +3087,13 @@ This operation does not require authentication ```json { "address": "string", - "parentSubaccountNumber": 0.1, + "parentSubaccountNumber": 0, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3332,7 +3113,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3350,7 +3131,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3359,14 +3140,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3402,7 +3183,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -3463,7 +3244,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -3507,7 +3288,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -3727,7 +3508,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3760,9 +3541,9 @@ This operation does not require authentication ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -3778,7 +3559,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -3965,9 +3746,9 @@ This operation does not require authentication ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -4297,7 +4078,7 @@ or "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -4399,17 +4180,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4461,17 +4242,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4484,17 +4265,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4538,7 +4319,7 @@ or "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -4611,7 +4392,7 @@ or ```json { "iso": "string", - "epoch": 0.1 + "epoch": 0 } ``` @@ -4690,9 +4471,9 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "trades": [ { "id": "string", @@ -4755,11 +4536,11 @@ or { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -4799,18 +4580,18 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -4843,18 +4624,18 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", diff --git a/proto/dydxprotocol/listing/genesis.proto b/proto/dydxprotocol/listing/genesis.proto index 29086f3200..4a7863942b 100644 --- a/proto/dydxprotocol/listing/genesis.proto +++ b/proto/dydxprotocol/listing/genesis.proto @@ -4,4 +4,7 @@ package dydxprotocol.listing; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/listing/types"; // GenesisState defines `x/listing`'s genesis state. -message GenesisState {} \ No newline at end of file +message GenesisState { + // permissionless_listing_enabled defines whether permissionless listing is enabled. + bool permissionless_listing_enabled = 1; +} \ No newline at end of file diff --git a/proto/dydxprotocol/listing/query.proto b/proto/dydxprotocol/listing/query.proto index 4ca01e3b56..fb034eb4db 100644 --- a/proto/dydxprotocol/listing/query.proto +++ b/proto/dydxprotocol/listing/query.proto @@ -4,4 +4,14 @@ package dydxprotocol.listing; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/listing/types"; // Query defines the gRPC querier service. -service Query {} \ No newline at end of file +service Query { + rpc PermissionlessMarketListingStatus(QueryPermissionlessMarketListingStatus) returns (QueryPermissionlessMarketListingStatusResponse); +} + +// Queries if permissionless listings are enabled +message QueryPermissionlessMarketListingStatus {} + +// Response type indicating if permissionless listings are enabled +message QueryPermissionlessMarketListingStatusResponse { + bool enabled = 1; +} \ No newline at end of file diff --git a/proto/dydxprotocol/listing/tx.proto b/proto/dydxprotocol/listing/tx.proto index 88e318dfb4..f875f35b76 100644 --- a/proto/dydxprotocol/listing/tx.proto +++ b/proto/dydxprotocol/listing/tx.proto @@ -1,7 +1,26 @@ syntax = "proto3"; package dydxprotocol.listing; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; + option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/listing/types"; // Msg defines the Msg service. -service Msg {} \ No newline at end of file +service Msg { + rpc EnablePermissionlessMarketListing(MsgEnablePermissionlessMarketListing) returns (MsgEnablePermissionlessMarketListingResponse); +} + +// MsgEnablePermissionlessMarketListing is used to enable/disable permissionless // market listing +message MsgEnablePermissionlessMarketListing { + // The address that controls the module (the gov module account). + option (cosmos.msg.v1.signer) = "authority"; + + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // boolean flag to enable/disable permissionless market listing + bool enablePermissionlessMarketListing = 2; +} + +message MsgEnablePermissionlessMarketListingResponse {} \ No newline at end of file diff --git a/protocol/app/basic_manager/basic_manager.go b/protocol/app/basic_manager/basic_manager.go index f1cec344bc..4bbfc6784d 100644 --- a/protocol/app/basic_manager/basic_manager.go +++ b/protocol/app/basic_manager/basic_manager.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/ibc-go/modules/capability" delaymsgmodule "github.com/dydxprotocol/v4-chain/protocol/x/delaymsg" + listingmodule "github.com/dydxprotocol/v4-chain/protocol/x/listing" custommodule "github.com/dydxprotocol/v4-chain/protocol/app/module" assetsmodule "github.com/dydxprotocol/v4-chain/protocol/x/assets" @@ -93,5 +94,6 @@ var ( ratelimitmodule.AppModuleBasic{}, govplusmodule.AppModuleBasic{}, vaultmodule.AppModuleBasic{}, + listingmodule.AppModuleBasic{}, ) ) diff --git a/protocol/app/msgs/all_msgs.go b/protocol/app/msgs/all_msgs.go index a790f8858b..30e249dc94 100644 --- a/protocol/app/msgs/all_msgs.go +++ b/protocol/app/msgs/all_msgs.go @@ -196,6 +196,10 @@ var ( "/dydxprotocol.govplus.MsgSlashValidator": {}, "/dydxprotocol.govplus.MsgSlashValidatorResponse": {}, + // listing + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListing": {}, + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListingResponse": {}, + // perpetuals "/dydxprotocol.perpetuals.MsgAddPremiumVotes": {}, "/dydxprotocol.perpetuals.MsgAddPremiumVotesResponse": {}, diff --git a/protocol/app/msgs/internal_msgs.go b/protocol/app/msgs/internal_msgs.go index 1e6fc67d5c..916f4177fa 100644 --- a/protocol/app/msgs/internal_msgs.go +++ b/protocol/app/msgs/internal_msgs.go @@ -22,6 +22,7 @@ import ( delaymsg "github.com/dydxprotocol/v4-chain/protocol/x/delaymsg/types" feetiers "github.com/dydxprotocol/v4-chain/protocol/x/feetiers/types" govplus "github.com/dydxprotocol/v4-chain/protocol/x/govplus/types" + listing "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" perpetuals "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types" prices "github.com/dydxprotocol/v4-chain/protocol/x/prices/types" ratelimit "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" @@ -141,6 +142,10 @@ var ( "/dydxprotocol.govplus.MsgSlashValidator": &govplus.MsgSlashValidator{}, "/dydxprotocol.govplus.MsgSlashValidatorResponse": nil, + // listing + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListing": &listing.MsgEnablePermissionlessMarketListing{}, + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListingResponse": nil, + // perpetuals "/dydxprotocol.perpetuals.MsgCreatePerpetual": &perpetuals.MsgCreatePerpetual{}, "/dydxprotocol.perpetuals.MsgCreatePerpetualResponse": nil, diff --git a/protocol/app/msgs/internal_msgs_test.go b/protocol/app/msgs/internal_msgs_test.go index 763706d0a7..3a33c3ab5d 100644 --- a/protocol/app/msgs/internal_msgs_test.go +++ b/protocol/app/msgs/internal_msgs_test.go @@ -101,6 +101,10 @@ func TestInternalMsgSamples_Gov_Key(t *testing.T) { "/dydxprotocol.govplus.MsgSlashValidator", "/dydxprotocol.govplus.MsgSlashValidatorResponse", + // listing + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListing", + "/dydxprotocol.listing.MsgEnablePermissionlessMarketListingResponse", + // perpeutals "/dydxprotocol.perpetuals.MsgCreatePerpetual", "/dydxprotocol.perpetuals.MsgCreatePerpetualResponse", diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 109e2e42a0..fefa60077b 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -338,7 +338,9 @@ "port": "icahost" } }, - "listing": {}, + "listing": { + "permissionless_listing_enabled": false + }, "params": null, "perpetuals": { "perpetuals": [], diff --git a/protocol/go.mod b/protocol/go.mod index d967b4a563..4e504faeaf 100644 --- a/protocol/go.mod +++ b/protocol/go.mod @@ -71,6 +71,7 @@ require ( github.com/spf13/viper v1.18.2 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d go.uber.org/zap v1.27.0 + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8 google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 912cf6d4c1..ddac69fe61 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -855,7 +855,9 @@ "port": "icahost" } }, - "listing": {}, + "listing": { + "permissionless_listing_enabled": false + }, "params": null, "perpetuals": { "liquidity_tiers": [ diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index 3155ecbe51..674497dfe0 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -871,7 +871,9 @@ const GenesisState = `{ } } }, - "listing": {}, + "listing": { + "permissionless_listing_enabled": false + }, "perpetuals": { "liquidity_tiers": [ { diff --git a/protocol/x/listing/genesis.go b/protocol/x/listing/genesis.go index 448b724d67..48a4a89789 100644 --- a/protocol/x/listing/genesis.go +++ b/protocol/x/listing/genesis.go @@ -8,9 +8,15 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.InitializeForGenesis(ctx) + + if err := k.SetPermissionlessListingEnable(ctx, false); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - return &types.GenesisState{} + genesis := types.DefaultGenesis() + return genesis } diff --git a/protocol/x/listing/keeper/grpc_query_enabled_status_test.go b/protocol/x/listing/keeper/grpc_query_enabled_status_test.go new file mode 100644 index 0000000000..1c8d7a7564 --- /dev/null +++ b/protocol/x/listing/keeper/grpc_query_enabled_status_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "testing" + + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" + "github.com/stretchr/testify/require" + + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" +) + +func TestQueryPMLEnabledStatus(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.ListingKeeper + + // set permissionless listing to true for test + k.SetPermissionlessListingEnable(ctx, true) + + // query permissionless market listing status + resp, err := k.PermissionlessMarketListingStatus(ctx, &types.QueryPermissionlessMarketListingStatus{}) + require.NoError(t, err) + require.True(t, resp.Enabled) +} diff --git a/protocol/x/listing/keeper/grpc_query_pml_enabled_status.go b/protocol/x/listing/keeper/grpc_query_pml_enabled_status.go new file mode 100644 index 0000000000..565b1bd360 --- /dev/null +++ b/protocol/x/listing/keeper/grpc_query_pml_enabled_status.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" +) + +func (k Keeper) PermissionlessMarketListingStatus( + ctx context.Context, + req *types.QueryPermissionlessMarketListingStatus, +) (*types.QueryPermissionlessMarketListingStatusResponse, error) { + + enabled, err := k.IsPermissionlessListingEnabled(sdk.UnwrapSDKContext(ctx)) + return &types.QueryPermissionlessMarketListingStatusResponse{ + Enabled: enabled, + }, err +} diff --git a/protocol/x/listing/keeper/listing.go b/protocol/x/listing/keeper/listing.go new file mode 100644 index 0000000000..ca3b924d57 --- /dev/null +++ b/protocol/x/listing/keeper/listing.go @@ -0,0 +1,35 @@ +package keeper + +import ( + "encoding/json" + + "golang.org/x/xerrors" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" +) + +// Function to set permissionless listing flag in module store +func (k Keeper) SetPermissionlessListingEnable(ctx sdk.Context, enable bool) error { + store := ctx.KVStore(k.storeKey) + b, err := json.Marshal(enable) + if err != nil { + return err + } + store.Set([]byte(types.PermissionlessListingEnableKey), b) + return nil +} + +// Function to check if permissionless listing is enabled +func (k Keeper) IsPermissionlessListingEnabled(ctx sdk.Context) (enabled bool, err error) { + store := ctx.KVStore(k.storeKey) + b := store.Get([]byte(types.PermissionlessListingEnableKey)) + if b == nil { + return false, xerrors.Errorf("permissionless listing enable key not found") + } + err = json.Unmarshal(b, &enabled) + if err != nil { + return false, err + } + return enabled, nil +} diff --git a/protocol/x/listing/keeper/msg_server_enable_pml.go b/protocol/x/listing/keeper/msg_server_enable_pml.go new file mode 100644 index 0000000000..9e1063bdb8 --- /dev/null +++ b/protocol/x/listing/keeper/msg_server_enable_pml.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" +) + +func (k msgServer) EnablePermissionlessMarketListing( + goCtx context.Context, + msg *types.MsgEnablePermissionlessMarketListing, +) (*types.MsgEnablePermissionlessMarketListingResponse, error) { + ctx := lib.UnwrapSDKContext(goCtx, types.ModuleName) + + // Check if the sender has the authority to enable permissionless market listing. + if !k.HasAuthority(msg.Authority) { + return nil, errorsmod.Wrapf( + govtypes.ErrInvalidSigner, + "invalid authority %s", + msg.Authority, + ) + } + + // Set the permissionless listing enable flag + err := k.Keeper.SetPermissionlessListingEnable(ctx, msg.EnablePermissionlessMarketListing) + if err != nil { + return nil, err + } + + return &types.MsgEnablePermissionlessMarketListingResponse{}, nil +} diff --git a/protocol/x/listing/keeper/msg_server_enable_pml_test.go b/protocol/x/listing/keeper/msg_server_enable_pml_test.go new file mode 100644 index 0000000000..27b0034c79 --- /dev/null +++ b/protocol/x/listing/keeper/msg_server_enable_pml_test.go @@ -0,0 +1,60 @@ +package keeper_test + +import ( + "testing" + + "github.com/dydxprotocol/v4-chain/protocol/lib" + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/keeper" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" + "github.com/stretchr/testify/require" +) + +func TestMsgEnablePermissionlessMarketListing(t *testing.T) { + + tests := map[string]struct { + // Msg. + msg *types.MsgEnablePermissionlessMarketListing + // Expected error + expectedErr string + }{ + "Success - Enabled": { + msg: &types.MsgEnablePermissionlessMarketListing{ + Authority: lib.GovModuleAddress.String(), + EnablePermissionlessMarketListing: true, + }, + }, + "Success - Disabled": { + msg: &types.MsgEnablePermissionlessMarketListing{ + Authority: lib.GovModuleAddress.String(), + EnablePermissionlessMarketListing: false, + }, + }, + "Failure - Invalid Authority": { + msg: &types.MsgEnablePermissionlessMarketListing{ + Authority: constants.AliceAccAddress.String(), + EnablePermissionlessMarketListing: true, + }, + expectedErr: "invalid authority", + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.ListingKeeper + ms := keeper.NewMsgServerImpl(k) + _, err := ms.EnablePermissionlessMarketListing(ctx, tc.msg) + if tc.expectedErr != "" { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expectedErr) + } else { + enabledFlag, err := k.IsPermissionlessListingEnabled(ctx) + require.NoError(t, err) + require.Equal(t, tc.msg.EnablePermissionlessMarketListing, enabledFlag) + } + }) + } +} diff --git a/protocol/x/listing/module.go b/protocol/x/listing/module.go index 99d2d44446..79d2a6c3a4 100644 --- a/protocol/x/listing/module.go +++ b/protocol/x/listing/module.go @@ -75,7 +75,8 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { +} // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to // generate new transactions containing messages defined in the module. diff --git a/protocol/x/listing/types/genesis.go b/protocol/x/listing/types/genesis.go index 09583a5f2e..81bb017431 100644 --- a/protocol/x/listing/types/genesis.go +++ b/protocol/x/listing/types/genesis.go @@ -2,7 +2,9 @@ package types // DefaultGenesis returns the default stats genesis state. func DefaultGenesis() *GenesisState { - return &GenesisState{} + return &GenesisState{ + PermissionlessListingEnabled: false, + } } // Validate performs basic genesis state validation returning an error upon any diff --git a/protocol/x/listing/types/genesis.pb.go b/protocol/x/listing/types/genesis.pb.go index 878c1c27c2..898e00226f 100644 --- a/protocol/x/listing/types/genesis.pb.go +++ b/protocol/x/listing/types/genesis.pb.go @@ -24,6 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines `x/listing`'s genesis state. type GenesisState struct { + // permissionless_listing_enabled defines whether permissionless listing is enabled. + PermissionlessListingEnabled bool `protobuf:"varint,1,opt,name=permissionless_listing_enabled,json=permissionlessListingEnabled,proto3" json:"permissionless_listing_enabled,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -59,6 +61,13 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo +func (m *GenesisState) GetPermissionlessListingEnabled() bool { + if m != nil { + return m.PermissionlessListingEnabled + } + return false +} + func init() { proto.RegisterType((*GenesisState)(nil), "dydxprotocol.listing.GenesisState") } @@ -68,16 +77,19 @@ func init() { } var fileDescriptor_d378c53d0f5a34b3 = []byte{ - // 143 bytes of a gzipped FileDescriptorProto + // 188 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0xcf, 0xc9, 0x2c, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x4b, 0x08, 0x89, 0x20, 0xab, 0xd1, - 0x83, 0xaa, 0x51, 0xe2, 0xe3, 0xe2, 0x71, 0x87, 0x28, 0x0b, 0x2e, 0x49, 0x2c, 0x49, 0x75, 0x0a, - 0x3e, 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, 0xcb, 0xf4, 0xcc, 0x92, 0x8c, - 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x14, 0xeb, 0xca, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, - 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x70, 0x27, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x65, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x20, 0xa7, 0x52, 0xc2, 0xa7, 0x00, 0x00, 0x00, + 0x83, 0xaa, 0x51, 0x0a, 0xe1, 0xe2, 0x71, 0x87, 0x28, 0x0b, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x72, + 0xe1, 0x92, 0x2b, 0x48, 0x2d, 0xca, 0xcd, 0x2c, 0x2e, 0xce, 0xcc, 0xcf, 0xcb, 0x49, 0x2d, 0x2e, + 0x8e, 0x87, 0xaa, 0x8c, 0x4f, 0xcd, 0x4b, 0x4c, 0xca, 0x49, 0x4d, 0x91, 0x60, 0x54, 0x60, 0xd4, + 0xe0, 0x08, 0x92, 0x41, 0x55, 0xe5, 0x03, 0x51, 0xe4, 0x0a, 0x51, 0xe3, 0x14, 0x7c, 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, 0x96, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0x28, 0x8e, 0x2e, 0x33, 0xd1, 0x4d, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x87, + 0x8b, 0x54, 0xc0, 0x3d, 0x52, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x96, 0x31, 0x06, 0x04, + 0x00, 0x00, 0xff, 0xff, 0x00, 0x81, 0x37, 0xcb, 0xed, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -100,6 +112,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PermissionlessListingEnabled { + i-- + if m.PermissionlessListingEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -120,6 +142,9 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l + if m.PermissionlessListingEnabled { + n += 2 + } return n } @@ -158,6 +183,26 @@ 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionlessListingEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PermissionlessListingEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/protocol/x/listing/types/keys.go b/protocol/x/listing/types/keys.go index 983efc0f9c..aa513b150e 100644 --- a/protocol/x/listing/types/keys.go +++ b/protocol/x/listing/types/keys.go @@ -8,3 +8,9 @@ const ( // StoreKey defines the primary module store key. StoreKey = ModuleName ) + +// State. +const ( + // PermissionlessListingEnableKey is the key to retrieve the permissionless listing enable flag. + PermissionlessListingEnableKey = "PermissionlessListingEnabled" +) diff --git a/protocol/x/listing/types/query.pb.go b/protocol/x/listing/types/query.pb.go index 1042de3679..e3a8070d7d 100644 --- a/protocol/x/listing/types/query.pb.go +++ b/protocol/x/listing/types/query.pb.go @@ -9,7 +9,11 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,19 +27,118 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Queries if permissionless listings are enabled +type QueryPermissionlessMarketListingStatus struct { +} + +func (m *QueryPermissionlessMarketListingStatus) Reset() { + *m = QueryPermissionlessMarketListingStatus{} +} +func (m *QueryPermissionlessMarketListingStatus) String() string { return proto.CompactTextString(m) } +func (*QueryPermissionlessMarketListingStatus) ProtoMessage() {} +func (*QueryPermissionlessMarketListingStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_6c3602ac8eedf7cc, []int{0} +} +func (m *QueryPermissionlessMarketListingStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPermissionlessMarketListingStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPermissionlessMarketListingStatus.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 *QueryPermissionlessMarketListingStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPermissionlessMarketListingStatus.Merge(m, src) +} +func (m *QueryPermissionlessMarketListingStatus) XXX_Size() int { + return m.Size() +} +func (m *QueryPermissionlessMarketListingStatus) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPermissionlessMarketListingStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPermissionlessMarketListingStatus proto.InternalMessageInfo + +// Response type indicating if permissionless listings are enabled +type QueryPermissionlessMarketListingStatusResponse struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +} + +func (m *QueryPermissionlessMarketListingStatusResponse) Reset() { + *m = QueryPermissionlessMarketListingStatusResponse{} +} +func (m *QueryPermissionlessMarketListingStatusResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryPermissionlessMarketListingStatusResponse) ProtoMessage() {} +func (*QueryPermissionlessMarketListingStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6c3602ac8eedf7cc, []int{1} +} +func (m *QueryPermissionlessMarketListingStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPermissionlessMarketListingStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPermissionlessMarketListingStatusResponse.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 *QueryPermissionlessMarketListingStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPermissionlessMarketListingStatusResponse.Merge(m, src) +} +func (m *QueryPermissionlessMarketListingStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPermissionlessMarketListingStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPermissionlessMarketListingStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPermissionlessMarketListingStatusResponse proto.InternalMessageInfo + +func (m *QueryPermissionlessMarketListingStatusResponse) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +func init() { + proto.RegisterType((*QueryPermissionlessMarketListingStatus)(nil), "dydxprotocol.listing.QueryPermissionlessMarketListingStatus") + proto.RegisterType((*QueryPermissionlessMarketListingStatusResponse)(nil), "dydxprotocol.listing.QueryPermissionlessMarketListingStatusResponse") +} + func init() { proto.RegisterFile("dydxprotocol/listing/query.proto", fileDescriptor_6c3602ac8eedf7cc) } var fileDescriptor_6c3602ac8eedf7cc = []byte{ - // 136 bytes of a gzipped FileDescriptorProto + // 229 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0xcf, 0xc9, 0x2c, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x0b, 0x0b, 0x89, 0x20, 0xab, 0xd0, 0x83, 0xaa, - 0x30, 0x62, 0xe7, 0x62, 0x0d, 0x04, 0x29, 0x72, 0x0a, 0x3e, 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, 0xcb, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, - 0x14, 0x5b, 0xca, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x70, 0x9b, - 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x32, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xd9, 0xb1, 0x14, 0x70, 0x9e, 0x00, 0x00, 0x00, + 0x50, 0xd2, 0xe0, 0x52, 0x0b, 0x04, 0x29, 0x0a, 0x48, 0x2d, 0xca, 0xcd, 0x2c, 0x2e, 0xce, 0xcc, + 0xcf, 0xcb, 0x49, 0x2d, 0x2e, 0xf6, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xf1, 0x81, 0xa8, 0x09, 0x2e, + 0x49, 0x2c, 0x29, 0x2d, 0x56, 0xf2, 0xe2, 0xd2, 0x23, 0x4e, 0x65, 0x50, 0x6a, 0x71, 0x41, 0x7e, + 0x5e, 0x71, 0xaa, 0x90, 0x04, 0x17, 0x7b, 0x6a, 0x5e, 0x62, 0x52, 0x4e, 0x6a, 0x8a, 0x04, 0xa3, + 0x02, 0xa3, 0x06, 0x47, 0x10, 0x8c, 0x6b, 0xb4, 0x91, 0x91, 0x8b, 0x15, 0x6c, 0x98, 0xd0, 0x72, + 0x46, 0x2e, 0x45, 0x82, 0x26, 0x0a, 0xd9, 0xe8, 0x61, 0x73, 0x3c, 0x91, 0xee, 0x91, 0x72, 0xa1, + 0x44, 0x37, 0xcc, 0x37, 0x4e, 0xc1, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, + 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, + 0x65, 0x99, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0x12, 0x0d, 0x65, + 0x26, 0xba, 0xc9, 0x19, 0x89, 0x99, 0x79, 0xfa, 0x70, 0x91, 0x0a, 0x78, 0xd4, 0x94, 0x54, 0x16, + 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x65, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x54, 0x16, + 0xb3, 0xbf, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +153,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + PermissionlessMarketListingStatus(ctx context.Context, in *QueryPermissionlessMarketListingStatus, opts ...grpc.CallOption) (*QueryPermissionlessMarketListingStatusResponse, error) } type queryClient struct { @@ -60,22 +164,358 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) PermissionlessMarketListingStatus(ctx context.Context, in *QueryPermissionlessMarketListingStatus, opts ...grpc.CallOption) (*QueryPermissionlessMarketListingStatusResponse, error) { + out := new(QueryPermissionlessMarketListingStatusResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.listing.Query/PermissionlessMarketListingStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { + PermissionlessMarketListingStatus(context.Context, *QueryPermissionlessMarketListingStatus) (*QueryPermissionlessMarketListingStatusResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) PermissionlessMarketListingStatus(ctx context.Context, req *QueryPermissionlessMarketListingStatus) (*QueryPermissionlessMarketListingStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PermissionlessMarketListingStatus not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_PermissionlessMarketListingStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPermissionlessMarketListingStatus) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PermissionlessMarketListingStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.listing.Query/PermissionlessMarketListingStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PermissionlessMarketListingStatus(ctx, req.(*QueryPermissionlessMarketListingStatus)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.listing.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "dydxprotocol/listing/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "PermissionlessMarketListingStatus", + Handler: _Query_PermissionlessMarketListingStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/listing/query.proto", +} + +func (m *QueryPermissionlessMarketListingStatus) 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 *QueryPermissionlessMarketListingStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPermissionlessMarketListingStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPermissionlessMarketListingStatusResponse) 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 *QueryPermissionlessMarketListingStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPermissionlessMarketListingStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryPermissionlessMarketListingStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPermissionlessMarketListingStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Enabled { + n += 2 + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryPermissionlessMarketListingStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPermissionlessMarketListingStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPermissionlessMarketListingStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPermissionlessMarketListingStatusResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPermissionlessMarketListingStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPermissionlessMarketListingStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/listing/types/tx.pb.go b/protocol/x/listing/types/tx.pb.go index 60c163c2b6..9bfc83baa8 100644 --- a/protocol/x/listing/types/tx.pb.go +++ b/protocol/x/listing/types/tx.pb.go @@ -6,10 +6,17 @@ package types import ( context "context" 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" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,19 +30,129 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgEnablePermissionlessMarketListing is used to enable/disable permissionless // market listing +type MsgEnablePermissionlessMarketListing struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // boolean flag to enable/disable permissionless market listing + EnablePermissionlessMarketListing bool `protobuf:"varint,2,opt,name=enablePermissionlessMarketListing,proto3" json:"enablePermissionlessMarketListing,omitempty"` +} + +func (m *MsgEnablePermissionlessMarketListing) Reset() { *m = MsgEnablePermissionlessMarketListing{} } +func (m *MsgEnablePermissionlessMarketListing) String() string { return proto.CompactTextString(m) } +func (*MsgEnablePermissionlessMarketListing) ProtoMessage() {} +func (*MsgEnablePermissionlessMarketListing) Descriptor() ([]byte, []int) { + return fileDescriptor_144a579c1e2dcb94, []int{0} +} +func (m *MsgEnablePermissionlessMarketListing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnablePermissionlessMarketListing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnablePermissionlessMarketListing.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 *MsgEnablePermissionlessMarketListing) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnablePermissionlessMarketListing.Merge(m, src) +} +func (m *MsgEnablePermissionlessMarketListing) XXX_Size() int { + return m.Size() +} +func (m *MsgEnablePermissionlessMarketListing) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnablePermissionlessMarketListing.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnablePermissionlessMarketListing proto.InternalMessageInfo + +func (m *MsgEnablePermissionlessMarketListing) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgEnablePermissionlessMarketListing) GetEnablePermissionlessMarketListing() bool { + if m != nil { + return m.EnablePermissionlessMarketListing + } + return false +} + +type MsgEnablePermissionlessMarketListingResponse struct { +} + +func (m *MsgEnablePermissionlessMarketListingResponse) Reset() { + *m = MsgEnablePermissionlessMarketListingResponse{} +} +func (m *MsgEnablePermissionlessMarketListingResponse) String() string { + return proto.CompactTextString(m) +} +func (*MsgEnablePermissionlessMarketListingResponse) ProtoMessage() {} +func (*MsgEnablePermissionlessMarketListingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_144a579c1e2dcb94, []int{1} +} +func (m *MsgEnablePermissionlessMarketListingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnablePermissionlessMarketListingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnablePermissionlessMarketListingResponse.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 *MsgEnablePermissionlessMarketListingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnablePermissionlessMarketListingResponse.Merge(m, src) +} +func (m *MsgEnablePermissionlessMarketListingResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEnablePermissionlessMarketListingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnablePermissionlessMarketListingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnablePermissionlessMarketListingResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgEnablePermissionlessMarketListing)(nil), "dydxprotocol.listing.MsgEnablePermissionlessMarketListing") + proto.RegisterType((*MsgEnablePermissionlessMarketListingResponse)(nil), "dydxprotocol.listing.MsgEnablePermissionlessMarketListingResponse") +} + func init() { proto.RegisterFile("dydxprotocol/listing/tx.proto", fileDescriptor_144a579c1e2dcb94) } var fileDescriptor_144a579c1e2dcb94 = []byte{ - // 131 bytes of a gzipped FileDescriptorProto + // 316 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, 0x8d, 0x58, 0xb9, - 0x98, 0x7d, 0x8b, 0xd3, 0x9d, 0x82, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, - 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, - 0xca, 0x32, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xc5, 0x82, 0x32, - 0x13, 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x7d, 0xb8, 0x48, 0x05, 0xc2, 0xd2, 0xca, 0x82, 0xd4, - 0xe2, 0x24, 0x36, 0xb0, 0x8c, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x99, 0x01, 0x33, 0x7d, 0x99, - 0x00, 0x00, 0x00, + 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, 0xa0, 0x12, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, + 0x10, 0x0d, 0x20, 0x16, 0x44, 0x54, 0x69, 0x0f, 0x23, 0x97, 0x8a, 0x6f, 0x71, 0xba, 0x6b, 0x5e, + 0x62, 0x52, 0x4e, 0x6a, 0x40, 0x6a, 0x51, 0x6e, 0x66, 0x71, 0x71, 0x66, 0x7e, 0x5e, 0x4e, 0x6a, + 0x71, 0xb1, 0x6f, 0x62, 0x51, 0x76, 0x6a, 0x89, 0x0f, 0xc4, 0x4a, 0x21, 0x33, 0x2e, 0xce, 0xc4, + 0xd2, 0x92, 0x8c, 0xfc, 0xa2, 0xcc, 0x92, 0x4a, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x89, + 0x4b, 0x5b, 0x74, 0x45, 0xa0, 0x96, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, + 0x65, 0xe6, 0xa5, 0x07, 0x21, 0x94, 0x0a, 0xf9, 0x70, 0x29, 0xa6, 0x12, 0x32, 0x5c, 0x82, 0x49, + 0x81, 0x51, 0x83, 0x23, 0x88, 0xb0, 0x42, 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0xa6, 0x2b, + 0xe9, 0x71, 0xe9, 0x10, 0xe3, 0xfa, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0xd5, + 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x8b, 0x19, 0xb9, 0x14, 0x09, 0xfb, 0xd9, 0x4a, 0x0f, + 0x5b, 0xe8, 0xeb, 0x11, 0x63, 0xa3, 0x94, 0x13, 0xf9, 0x7a, 0x61, 0xae, 0x75, 0x0a, 0x3e, 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, 0xcb, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x94, 0x04, 0x54, 0x66, 0xa2, 0x9b, 0x9c, 0x91, 0x98, 0x99, 0xa7, + 0x0f, 0x17, 0xa9, 0x40, 0x24, 0xaa, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x8c, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0xfa, 0x78, 0xae, 0x82, 0x79, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +167,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + EnablePermissionlessMarketListing(ctx context.Context, in *MsgEnablePermissionlessMarketListing, opts ...grpc.CallOption) (*MsgEnablePermissionlessMarketListingResponse, error) } type msgClient struct { @@ -60,22 +178,401 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) EnablePermissionlessMarketListing(ctx context.Context, in *MsgEnablePermissionlessMarketListing, opts ...grpc.CallOption) (*MsgEnablePermissionlessMarketListingResponse, error) { + out := new(MsgEnablePermissionlessMarketListingResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.listing.Msg/EnablePermissionlessMarketListing", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + EnablePermissionlessMarketListing(context.Context, *MsgEnablePermissionlessMarketListing) (*MsgEnablePermissionlessMarketListingResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) EnablePermissionlessMarketListing(ctx context.Context, req *MsgEnablePermissionlessMarketListing) (*MsgEnablePermissionlessMarketListingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EnablePermissionlessMarketListing not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_EnablePermissionlessMarketListing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEnablePermissionlessMarketListing) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EnablePermissionlessMarketListing(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.listing.Msg/EnablePermissionlessMarketListing", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EnablePermissionlessMarketListing(ctx, req.(*MsgEnablePermissionlessMarketListing)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.listing.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "dydxprotocol/listing/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "EnablePermissionlessMarketListing", + Handler: _Msg_EnablePermissionlessMarketListing_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/listing/tx.proto", +} + +func (m *MsgEnablePermissionlessMarketListing) 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 *MsgEnablePermissionlessMarketListing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnablePermissionlessMarketListing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EnablePermissionlessMarketListing { + i-- + if m.EnablePermissionlessMarketListing { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + 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 *MsgEnablePermissionlessMarketListingResponse) 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 *MsgEnablePermissionlessMarketListingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnablePermissionlessMarketListingResponse) 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgEnablePermissionlessMarketListing) 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)) + } + if m.EnablePermissionlessMarketListing { + n += 2 + } + return n +} + +func (m *MsgEnablePermissionlessMarketListingResponse) 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 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgEnablePermissionlessMarketListing) 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: MsgEnablePermissionlessMarketListing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnablePermissionlessMarketListing: 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnablePermissionlessMarketListing", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnablePermissionlessMarketListing = bool(v != 0) + 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 *MsgEnablePermissionlessMarketListingResponse) 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: MsgEnablePermissionlessMarketListingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnablePermissionlessMarketListingResponse: 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)