diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 500f9ff289..2685a389a5 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -76,104 +76,106 @@ import * as _79 from "./ratelimit/tx"; import * as _80 from "./revshare/genesis"; import * as _81 from "./revshare/params"; import * as _82 from "./revshare/query"; -import * as _83 from "./revshare/tx"; -import * as _84 from "./rewards/genesis"; -import * as _85 from "./rewards/params"; -import * as _86 from "./rewards/query"; -import * as _87 from "./rewards/reward_share"; -import * as _88 from "./rewards/tx"; -import * as _89 from "./sending/genesis"; -import * as _90 from "./sending/query"; -import * as _91 from "./sending/transfer"; -import * as _92 from "./sending/tx"; -import * as _93 from "./stats/genesis"; -import * as _94 from "./stats/params"; -import * as _95 from "./stats/query"; -import * as _96 from "./stats/stats"; -import * as _97 from "./stats/tx"; -import * as _98 from "./subaccounts/asset_position"; -import * as _99 from "./subaccounts/genesis"; -import * as _100 from "./subaccounts/perpetual_position"; -import * as _101 from "./subaccounts/query"; -import * as _102 from "./subaccounts/subaccount"; -import * as _103 from "./vault/genesis"; -import * as _104 from "./vault/params"; -import * as _105 from "./vault/query"; -import * as _106 from "./vault/tx"; -import * as _107 from "./vault/vault"; -import * as _108 from "./vest/genesis"; -import * as _109 from "./vest/query"; -import * as _110 from "./vest/tx"; -import * as _111 from "./vest/vest_entry"; -import * as _119 from "./assets/query.lcd"; -import * as _120 from "./blocktime/query.lcd"; -import * as _121 from "./bridge/query.lcd"; -import * as _122 from "./clob/query.lcd"; -import * as _123 from "./delaymsg/query.lcd"; -import * as _124 from "./epochs/query.lcd"; -import * as _125 from "./feetiers/query.lcd"; -import * as _126 from "./perpetuals/query.lcd"; -import * as _127 from "./prices/query.lcd"; -import * as _128 from "./ratelimit/query.lcd"; -import * as _129 from "./rewards/query.lcd"; -import * as _130 from "./stats/query.lcd"; -import * as _131 from "./subaccounts/query.lcd"; -import * as _132 from "./vault/query.lcd"; -import * as _133 from "./vest/query.lcd"; -import * as _134 from "./assets/query.rpc.Query"; -import * as _135 from "./blocktime/query.rpc.Query"; -import * as _136 from "./bridge/query.rpc.Query"; -import * as _137 from "./clob/query.rpc.Query"; -import * as _138 from "./delaymsg/query.rpc.Query"; -import * as _139 from "./epochs/query.rpc.Query"; -import * as _140 from "./feetiers/query.rpc.Query"; -import * as _141 from "./govplus/query.rpc.Query"; -import * as _142 from "./listing/query.rpc.Query"; -import * as _143 from "./perpetuals/query.rpc.Query"; -import * as _144 from "./prices/query.rpc.Query"; -import * as _145 from "./ratelimit/query.rpc.Query"; -import * as _146 from "./revshare/query.rpc.Query"; -import * as _147 from "./rewards/query.rpc.Query"; -import * as _148 from "./sending/query.rpc.Query"; -import * as _149 from "./stats/query.rpc.Query"; -import * as _150 from "./subaccounts/query.rpc.Query"; -import * as _151 from "./vault/query.rpc.Query"; -import * as _152 from "./vest/query.rpc.Query"; -import * as _153 from "./blocktime/tx.rpc.msg"; -import * as _154 from "./bridge/tx.rpc.msg"; -import * as _155 from "./clob/tx.rpc.msg"; -import * as _156 from "./delaymsg/tx.rpc.msg"; -import * as _157 from "./feetiers/tx.rpc.msg"; -import * as _158 from "./govplus/tx.rpc.msg"; -import * as _159 from "./listing/tx.rpc.msg"; -import * as _160 from "./perpetuals/tx.rpc.msg"; -import * as _161 from "./prices/tx.rpc.msg"; -import * as _162 from "./ratelimit/tx.rpc.msg"; -import * as _163 from "./revshare/tx.rpc.msg"; -import * as _164 from "./rewards/tx.rpc.msg"; -import * as _165 from "./sending/tx.rpc.msg"; -import * as _166 from "./stats/tx.rpc.msg"; -import * as _167 from "./vault/tx.rpc.msg"; -import * as _168 from "./vest/tx.rpc.msg"; -import * as _169 from "./lcd"; -import * as _170 from "./rpc.query"; -import * as _171 from "./rpc.tx"; +import * as _83 from "./revshare/revshare"; +import * as _84 from "./revshare/tx"; +import * as _85 from "./rewards/genesis"; +import * as _86 from "./rewards/params"; +import * as _87 from "./rewards/query"; +import * as _88 from "./rewards/reward_share"; +import * as _89 from "./rewards/tx"; +import * as _90 from "./sending/genesis"; +import * as _91 from "./sending/query"; +import * as _92 from "./sending/transfer"; +import * as _93 from "./sending/tx"; +import * as _94 from "./stats/genesis"; +import * as _95 from "./stats/params"; +import * as _96 from "./stats/query"; +import * as _97 from "./stats/stats"; +import * as _98 from "./stats/tx"; +import * as _99 from "./subaccounts/asset_position"; +import * as _100 from "./subaccounts/genesis"; +import * as _101 from "./subaccounts/perpetual_position"; +import * as _102 from "./subaccounts/query"; +import * as _103 from "./subaccounts/subaccount"; +import * as _104 from "./vault/genesis"; +import * as _105 from "./vault/params"; +import * as _106 from "./vault/query"; +import * as _107 from "./vault/tx"; +import * as _108 from "./vault/vault"; +import * as _109 from "./vest/genesis"; +import * as _110 from "./vest/query"; +import * as _111 from "./vest/tx"; +import * as _112 from "./vest/vest_entry"; +import * as _120 from "./assets/query.lcd"; +import * as _121 from "./blocktime/query.lcd"; +import * as _122 from "./bridge/query.lcd"; +import * as _123 from "./clob/query.lcd"; +import * as _124 from "./delaymsg/query.lcd"; +import * as _125 from "./epochs/query.lcd"; +import * as _126 from "./feetiers/query.lcd"; +import * as _127 from "./perpetuals/query.lcd"; +import * as _128 from "./prices/query.lcd"; +import * as _129 from "./ratelimit/query.lcd"; +import * as _130 from "./revshare/query.lcd"; +import * as _131 from "./rewards/query.lcd"; +import * as _132 from "./stats/query.lcd"; +import * as _133 from "./subaccounts/query.lcd"; +import * as _134 from "./vault/query.lcd"; +import * as _135 from "./vest/query.lcd"; +import * as _136 from "./assets/query.rpc.Query"; +import * as _137 from "./blocktime/query.rpc.Query"; +import * as _138 from "./bridge/query.rpc.Query"; +import * as _139 from "./clob/query.rpc.Query"; +import * as _140 from "./delaymsg/query.rpc.Query"; +import * as _141 from "./epochs/query.rpc.Query"; +import * as _142 from "./feetiers/query.rpc.Query"; +import * as _143 from "./govplus/query.rpc.Query"; +import * as _144 from "./listing/query.rpc.Query"; +import * as _145 from "./perpetuals/query.rpc.Query"; +import * as _146 from "./prices/query.rpc.Query"; +import * as _147 from "./ratelimit/query.rpc.Query"; +import * as _148 from "./revshare/query.rpc.Query"; +import * as _149 from "./rewards/query.rpc.Query"; +import * as _150 from "./sending/query.rpc.Query"; +import * as _151 from "./stats/query.rpc.Query"; +import * as _152 from "./subaccounts/query.rpc.Query"; +import * as _153 from "./vault/query.rpc.Query"; +import * as _154 from "./vest/query.rpc.Query"; +import * as _155 from "./blocktime/tx.rpc.msg"; +import * as _156 from "./bridge/tx.rpc.msg"; +import * as _157 from "./clob/tx.rpc.msg"; +import * as _158 from "./delaymsg/tx.rpc.msg"; +import * as _159 from "./feetiers/tx.rpc.msg"; +import * as _160 from "./govplus/tx.rpc.msg"; +import * as _161 from "./listing/tx.rpc.msg"; +import * as _162 from "./perpetuals/tx.rpc.msg"; +import * as _163 from "./prices/tx.rpc.msg"; +import * as _164 from "./ratelimit/tx.rpc.msg"; +import * as _165 from "./revshare/tx.rpc.msg"; +import * as _166 from "./rewards/tx.rpc.msg"; +import * as _167 from "./sending/tx.rpc.msg"; +import * as _168 from "./stats/tx.rpc.msg"; +import * as _169 from "./vault/tx.rpc.msg"; +import * as _170 from "./vest/tx.rpc.msg"; +import * as _171 from "./lcd"; +import * as _172 from "./rpc.query"; +import * as _173 from "./rpc.tx"; export namespace dydxprotocol { export const assets = { ..._5, ..._6, ..._7, ..._8, - ..._119, - ..._134 + ..._120, + ..._136 }; export const blocktime = { ..._9, ..._10, ..._11, ..._12, ..._13, - ..._120, - ..._135, - ..._153 + ..._121, + ..._137, + ..._155 }; export const bridge = { ..._14, ..._15, @@ -181,9 +183,9 @@ export namespace dydxprotocol { ..._17, ..._18, ..._19, - ..._121, - ..._136, - ..._154 + ..._122, + ..._138, + ..._156 }; export const clob = { ..._20, ..._21, @@ -199,9 +201,9 @@ export namespace dydxprotocol { ..._31, ..._32, ..._33, - ..._122, - ..._137, - ..._155 + ..._123, + ..._139, + ..._157 }; export namespace daemons { export const bridge = { ..._34 @@ -216,29 +218,29 @@ export namespace dydxprotocol { ..._39, ..._40, ..._41, - ..._123, - ..._138, - ..._156 + ..._124, + ..._140, + ..._158 }; export const epochs = { ..._42, ..._43, ..._44, - ..._124, - ..._139 + ..._125, + ..._141 }; export const feetiers = { ..._45, ..._46, ..._47, ..._48, - ..._125, - ..._140, - ..._157 + ..._126, + ..._142, + ..._159 }; export const govplus = { ..._49, ..._50, ..._51, - ..._141, - ..._158 + ..._143, + ..._160 }; export namespace indexer { export const events = { ..._52 @@ -263,26 +265,26 @@ export namespace dydxprotocol { export const listing = { ..._61, ..._62, ..._63, - ..._142, - ..._159 + ..._144, + ..._161 }; export const perpetuals = { ..._64, ..._65, ..._66, ..._67, ..._68, - ..._126, - ..._143, - ..._160 + ..._127, + ..._145, + ..._162 }; export const prices = { ..._69, ..._70, ..._71, ..._72, ..._73, - ..._127, - ..._144, - ..._161 + ..._128, + ..._146, + ..._163 }; export const ratelimit = { ..._74, ..._75, @@ -290,69 +292,71 @@ export namespace dydxprotocol { ..._77, ..._78, ..._79, - ..._128, - ..._145, - ..._162 + ..._129, + ..._147, + ..._164 }; export const revshare = { ..._80, ..._81, ..._82, ..._83, - ..._146, - ..._163 + ..._84, + ..._130, + ..._148, + ..._165 }; - export const rewards = { ..._84, - ..._85, + export const rewards = { ..._85, ..._86, ..._87, ..._88, - ..._129, - ..._147, - ..._164 + ..._89, + ..._131, + ..._149, + ..._166 }; - export const sending = { ..._89, - ..._90, + export const sending = { ..._90, ..._91, ..._92, - ..._148, - ..._165 + ..._93, + ..._150, + ..._167 }; - export const stats = { ..._93, - ..._94, + export const stats = { ..._94, ..._95, ..._96, ..._97, - ..._130, - ..._149, - ..._166 + ..._98, + ..._132, + ..._151, + ..._168 }; - export const subaccounts = { ..._98, - ..._99, + export const subaccounts = { ..._99, ..._100, ..._101, ..._102, - ..._131, - ..._150 + ..._103, + ..._133, + ..._152 }; - export const vault = { ..._103, - ..._104, + export const vault = { ..._104, ..._105, ..._106, ..._107, - ..._132, - ..._151, - ..._167 + ..._108, + ..._134, + ..._153, + ..._169 }; - export const vest = { ..._108, - ..._109, + export const vest = { ..._109, ..._110, ..._111, - ..._133, - ..._152, - ..._168 + ..._112, + ..._135, + ..._154, + ..._170 }; - export const ClientFactory = { ..._169, - ..._170, - ..._171 + export const ClientFactory = { ..._171, + ..._172, + ..._173 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts index 8858e6006c..f61432a744 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts @@ -39,6 +39,9 @@ export const createLCDClient = async ({ ratelimit: new (await import("./ratelimit/query.lcd")).LCDQueryClient({ requestClient }), + revshare: new (await import("./revshare/query.lcd")).LCDQueryClient({ + requestClient + }), rewards: new (await import("./rewards/query.lcd")).LCDQueryClient({ requestClient }), diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.lcd.ts new file mode 100644 index 0000000000..84fb76030f --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.lcd.ts @@ -0,0 +1,22 @@ +import { LCDClient } from "@osmonauts/lcd"; +import { QueryMarketMapperRevShareDetails, QueryMarketMapperRevShareDetailsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.marketMapperRevShareDetails = this.marketMapperRevShareDetails.bind(this); + } + /* Queries market mapper revenue share details for a specific market */ + + + async marketMapperRevShareDetails(params: QueryMarketMapperRevShareDetails): Promise { + const endpoint = `dydxprotocol/revshare/market_mapper_rev_share_details/${params.marketId}`; + return await this.req.get(endpoint); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts index ab81adee85..b28fd79e97 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts @@ -1,18 +1,35 @@ import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryMarketMapperRevShareDetails, QueryMarketMapperRevShareDetailsResponse } from "./query"; /** Query defines the gRPC querier service. */ -export interface Query {} +export interface Query { + /** Queries market mapper revenue share details for a specific market */ + marketMapperRevShareDetails(request: QueryMarketMapperRevShareDetails): Promise; +} export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; + this.marketMapperRevShareDetails = this.marketMapperRevShareDetails.bind(this); + } + + marketMapperRevShareDetails(request: QueryMarketMapperRevShareDetails): Promise { + const data = QueryMarketMapperRevShareDetails.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.revshare.Query", "MarketMapperRevShareDetails", data); + return promise.then(data => QueryMarketMapperRevShareDetailsResponse.decode(new _m0.Reader(data))); } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); const queryService = new QueryClientImpl(rpc); - return {}; + return { + marketMapperRevShareDetails(request: QueryMarketMapperRevShareDetails): Promise { + return queryService.marketMapperRevShareDetails(request); + } + + }; }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts index 693da49fc4..827672cd4c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts @@ -1 +1,115 @@ -export {} \ No newline at end of file +import { MarketMapperRevShareDetails, MarketMapperRevShareDetailsSDKType } from "./revshare"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** Queries market mapper revenue share details for a specific market */ + +export interface QueryMarketMapperRevShareDetails { + /** Queries market mapper revenue share details for a specific market */ + marketId: number; +} +/** Queries market mapper revenue share details for a specific market */ + +export interface QueryMarketMapperRevShareDetailsSDKType { + /** Queries market mapper revenue share details for a specific market */ + market_id: number; +} +/** Response type for QueryMarketMapperRevShareDetails */ + +export interface QueryMarketMapperRevShareDetailsResponse { + details?: MarketMapperRevShareDetails; +} +/** Response type for QueryMarketMapperRevShareDetails */ + +export interface QueryMarketMapperRevShareDetailsResponseSDKType { + details?: MarketMapperRevShareDetailsSDKType; +} + +function createBaseQueryMarketMapperRevShareDetails(): QueryMarketMapperRevShareDetails { + return { + marketId: 0 + }; +} + +export const QueryMarketMapperRevShareDetails = { + encode(message: QueryMarketMapperRevShareDetails, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.marketId !== 0) { + writer.uint32(8).uint32(message.marketId); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMarketMapperRevShareDetails { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMarketMapperRevShareDetails(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.marketId = reader.uint32(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryMarketMapperRevShareDetails { + const message = createBaseQueryMarketMapperRevShareDetails(); + message.marketId = object.marketId ?? 0; + return message; + } + +}; + +function createBaseQueryMarketMapperRevShareDetailsResponse(): QueryMarketMapperRevShareDetailsResponse { + return { + details: undefined + }; +} + +export const QueryMarketMapperRevShareDetailsResponse = { + encode(message: QueryMarketMapperRevShareDetailsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.details !== undefined) { + MarketMapperRevShareDetails.encode(message.details, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryMarketMapperRevShareDetailsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMarketMapperRevShareDetailsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.details = MarketMapperRevShareDetails.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryMarketMapperRevShareDetailsResponse { + const message = createBaseQueryMarketMapperRevShareDetailsResponse(); + message.details = object.details !== undefined && object.details !== null ? MarketMapperRevShareDetails.fromPartial(object.details) : undefined; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/revshare.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/revshare.ts new file mode 100644 index 0000000000..52648b0bbf --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/revshare.ts @@ -0,0 +1,65 @@ +import * as _m0 from "protobufjs/minimal"; +import { Long, DeepPartial } from "../../helpers"; +/** + * MarketMapperRevShareDetails specifies any details associated with the market + * mapper revenue share + */ + +export interface MarketMapperRevShareDetails { + /** Unix timestamp recorded when the market revenue share expires */ + expirationTs: Long; +} +/** + * MarketMapperRevShareDetails specifies any details associated with the market + * mapper revenue share + */ + +export interface MarketMapperRevShareDetailsSDKType { + /** Unix timestamp recorded when the market revenue share expires */ + expiration_ts: Long; +} + +function createBaseMarketMapperRevShareDetails(): MarketMapperRevShareDetails { + return { + expirationTs: Long.UZERO + }; +} + +export const MarketMapperRevShareDetails = { + encode(message: MarketMapperRevShareDetails, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.expirationTs.isZero()) { + writer.uint32(8).uint64(message.expirationTs); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MarketMapperRevShareDetails { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMarketMapperRevShareDetails(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.expirationTs = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MarketMapperRevShareDetails { + const message = createBaseMarketMapperRevShareDetails(); + message.expirationTs = object.expirationTs !== undefined && object.expirationTs !== null ? Long.fromValue(object.expirationTs) : Long.UZERO; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 295424a234..6a8c101b83 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _112 from "./gogo"; -export const gogoproto = { ..._112 +import * as _113 from "./gogo"; +export const gogoproto = { ..._113 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index a375c9a798..cefd9154a1 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _113 from "./api/annotations"; -import * as _114 from "./api/http"; -import * as _115 from "./protobuf/descriptor"; -import * as _116 from "./protobuf/duration"; -import * as _117 from "./protobuf/timestamp"; -import * as _118 from "./protobuf/any"; +import * as _114 from "./api/annotations"; +import * as _115 from "./api/http"; +import * as _116 from "./protobuf/descriptor"; +import * as _117 from "./protobuf/duration"; +import * as _118 from "./protobuf/timestamp"; +import * as _119 from "./protobuf/any"; export namespace google { - export const api = { ..._113, - ..._114 + export const api = { ..._114, + ..._115 }; - export const protobuf = { ..._115, - ..._116, + export const protobuf = { ..._116, ..._117, - ..._118 + ..._118, + ..._119 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/revshare/query.proto b/proto/dydxprotocol/revshare/query.proto index 0097e39bf1..02a6b18f67 100644 --- a/proto/dydxprotocol/revshare/query.proto +++ b/proto/dydxprotocol/revshare/query.proto @@ -1,7 +1,25 @@ syntax = "proto3"; package dydxprotocol.revshare; +import "google/api/annotations.proto"; +import "dydxprotocol/revshare/revshare.proto"; + option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; // Query defines the gRPC querier service. -service Query {} \ No newline at end of file +service Query { + // Queries market mapper revenue share details for a specific market + rpc MarketMapperRevShareDetails(QueryMarketMapperRevShareDetails) + returns (QueryMarketMapperRevShareDetailsResponse) { + option (google.api.http).get = + "/dydxprotocol/revshare/market_mapper_rev_share_details/{market_id}"; + } +} + +// Queries market mapper revenue share details for a specific market +message QueryMarketMapperRevShareDetails { uint32 market_id = 1; } + +// Response type for QueryMarketMapperRevShareDetails +message QueryMarketMapperRevShareDetailsResponse { + MarketMapperRevShareDetails details = 1; +} \ No newline at end of file diff --git a/proto/dydxprotocol/revshare/revshare.proto b/proto/dydxprotocol/revshare/revshare.proto new file mode 100644 index 0000000000..210b72d4dc --- /dev/null +++ b/proto/dydxprotocol/revshare/revshare.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package dydxprotocol.revshare; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; + +// MarketMapperRevShareDetails specifies any details associated with the market +// mapper revenue share +message MarketMapperRevShareDetails { + // Unix timestamp recorded when the market revenue share expires + uint64 expiration_ts = 1; +} \ No newline at end of file diff --git a/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details.go b/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details.go new file mode 100644 index 0000000000..3b4978d37a --- /dev/null +++ b/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details.go @@ -0,0 +1,21 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +func (k Keeper) MarketMapperRevShareDetails( + ctx context.Context, + req *types.QueryMarketMapperRevShareDetails, +) (*types.QueryMarketMapperRevShareDetailsResponse, error) { + revShareDetails, err := k.GetMarketMapperRevShareDetails(sdk.UnwrapSDKContext(ctx), req.MarketId) + if err != nil { + return nil, err + } + return &types.QueryMarketMapperRevShareDetailsResponse{ + Details: &revShareDetails, + }, nil +} diff --git a/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details_test.go b/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details_test.go new file mode 100644 index 0000000000..426e79f341 --- /dev/null +++ b/protocol/x/revshare/keeper/grpc_query_marketmapper_revshare_details_test.go @@ -0,0 +1,44 @@ +package keeper_test + +import ( + "testing" + + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" + "github.com/stretchr/testify/require" +) + +func TestQueryMarketMapperRevShareDetails(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + + k := tApp.App.RevShareKeeper + + setDetails := types.MarketMapperRevShareDetails{ + ExpirationTs: 1735707600, + } + marketId := uint32(42) + k.SetMarketMapperRevShareDetails(ctx, marketId, setDetails) + + resp, err := k.MarketMapperRevShareDetails( + ctx, &types.QueryMarketMapperRevShareDetails{ + MarketId: marketId, + }, + ) + require.NoError(t, err) + require.Equal(t, resp.Details.ExpirationTs, setDetails.ExpirationTs) +} + +func TestQueryMarketMapperRevShareDetailsFailure(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.RevShareKeeper + + // Query for revshare details of non-existent market + _, err := k.MarketMapperRevShareDetails( + ctx, &types.QueryMarketMapperRevShareDetails{ + MarketId: 42, + }, + ) + require.ErrorContains(t, err, "MarketMapperRevShareDetails not found for marketId: 42") +} diff --git a/protocol/x/revshare/keeper/revshare.go b/protocol/x/revshare/keeper/revshare.go index 3704420ba2..9d490cb3bb 100644 --- a/protocol/x/revshare/keeper/revshare.go +++ b/protocol/x/revshare/keeper/revshare.go @@ -1,7 +1,11 @@ package keeper import ( + "fmt" + + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/lib" "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" ) @@ -32,3 +36,43 @@ func (k Keeper) GetMarketMapperRevenueShareParams( k.cdc.MustUnmarshal(b, ¶ms) return params } + +// Function to serialize market mapper rev share details for a market +// and store in the module store +func (k Keeper) SetMarketMapperRevShareDetails( + ctx sdk.Context, + marketId uint32, + params types.MarketMapperRevShareDetails, +) { + // Store the rev share details for provided market in module store + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.MarketMapperRevSharePrefix)) + b := k.cdc.MustMarshal(¶ms) + store.Set(lib.Uint32ToKey(marketId), b) +} + +// Function to retrieve marketmapper revshare details for a market from module store +func (k Keeper) GetMarketMapperRevShareDetails( + ctx sdk.Context, + marketId uint32, +) (params types.MarketMapperRevShareDetails, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.MarketMapperRevSharePrefix)) + b := store.Get(lib.Uint32ToKey(marketId)) + if b == nil { + return params, fmt.Errorf("MarketMapperRevShareDetails not found for marketId: %d", marketId) + } + k.cdc.MustUnmarshal(b, ¶ms) + return params, nil +} + +// Function to perform all market creation actions for the revshare module +func (k Keeper) CreateNewMarketRevShare(ctx sdk.Context, marketId uint32) { + revShareParams := k.GetMarketMapperRevenueShareParams(ctx) + + validDurationSeconds := int64(revShareParams.ValidDays * 24 * 60 * 60) + + // set the rev share details for the market + details := types.MarketMapperRevShareDetails{ + ExpirationTs: uint64(ctx.BlockTime().Unix() + validDurationSeconds), + } + k.SetMarketMapperRevShareDetails(ctx, marketId, details) +} diff --git a/protocol/x/revshare/keeper/revshare_test.go b/protocol/x/revshare/keeper/revshare_test.go new file mode 100644 index 0000000000..b9bbb8fe17 --- /dev/null +++ b/protocol/x/revshare/keeper/revshare_test.go @@ -0,0 +1,77 @@ +package keeper_test + +import ( + "testing" + + "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" + + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" + "github.com/stretchr/testify/require" +) + +func TestGetSetMarketMapperRevShareDetails(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + + k := tApp.App.RevShareKeeper + // Set the rev share details for a market + marketId := uint32(42) + setDetails := types.MarketMapperRevShareDetails{ + ExpirationTs: 1735707600, + } + k.SetMarketMapperRevShareDetails(ctx, marketId, setDetails) + + // Get the rev share details for the market + getDetails, err := k.GetMarketMapperRevShareDetails(ctx, marketId) + require.NoError(t, err) + require.Equal(t, getDetails.ExpirationTs, setDetails.ExpirationTs) + + // Set expiration ts to 0 + setDetails.ExpirationTs = 0 + k.SetMarketMapperRevShareDetails(ctx, marketId, setDetails) + + getDetails, err = k.GetMarketMapperRevShareDetails(ctx, marketId) + require.NoError(t, err) + require.Equal(t, getDetails.ExpirationTs, setDetails.ExpirationTs) +} + +func TestGetMarketMapperRevShareDetailsFailure(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.RevShareKeeper + + // Get the rev share details for non-existent market + _, err := k.GetMarketMapperRevShareDetails(ctx, 42) + require.ErrorContains(t, err, "MarketMapperRevShareDetails not found for marketId: 42") +} + +func TestCreateNewMarketRevShare(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + + k := tApp.App.RevShareKeeper + + // Set base rev share params + err := k.SetMarketMapperRevenueShareParams( + ctx, types.MarketMapperRevenueShareParams{ + Address: constants.AliceAccAddress.String(), + RevenueSharePpm: 100_000, // 10% + ValidDays: 240, + }, + ) + require.NoError(t, err) + + // Create a new market rev share + marketId := uint32(42) + k.CreateNewMarketRevShare(ctx, marketId) + require.NoError(t, err) + + // Check if the market rev share exists + details, err := k.GetMarketMapperRevShareDetails(ctx, marketId) + require.NoError(t, err) + + // TODO: is this blocktime call deterministic? + expectedExpirationTs := ctx.BlockTime().Unix() + 240*24*60*60 + require.Equal(t, details.ExpirationTs, uint64(expectedExpirationTs)) +} diff --git a/protocol/x/revshare/types/keys.go b/protocol/x/revshare/types/keys.go index 5d57a91b7d..375536e917 100644 --- a/protocol/x/revshare/types/keys.go +++ b/protocol/x/revshare/types/keys.go @@ -13,4 +13,7 @@ const ( const ( // Key for MarketMapperRevenueShareParams MarketMapperRevenueShareParamsKey = "MarketMapperRevenueShareParams" + + // Key prefix for storing MarketMapperRevShareDetails per market + MarketMapperRevSharePrefix = "MarketMapperRevShare:" ) diff --git a/protocol/x/revshare/types/query.pb.go b/protocol/x/revshare/types/query.pb.go index b65c117d77..0ee74648f4 100644 --- a/protocol/x/revshare/types/query.pb.go +++ b/protocol/x/revshare/types/query.pb.go @@ -8,8 +8,13 @@ import ( fmt "fmt" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" 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 +28,127 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Queries market mapper revenue share details for a specific market +type QueryMarketMapperRevShareDetails struct { + MarketId uint32 `protobuf:"varint,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` +} + +func (m *QueryMarketMapperRevShareDetails) Reset() { *m = QueryMarketMapperRevShareDetails{} } +func (m *QueryMarketMapperRevShareDetails) String() string { return proto.CompactTextString(m) } +func (*QueryMarketMapperRevShareDetails) ProtoMessage() {} +func (*QueryMarketMapperRevShareDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_13d50c6e3048e744, []int{0} +} +func (m *QueryMarketMapperRevShareDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMarketMapperRevShareDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMarketMapperRevShareDetails.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 *QueryMarketMapperRevShareDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMarketMapperRevShareDetails.Merge(m, src) +} +func (m *QueryMarketMapperRevShareDetails) XXX_Size() int { + return m.Size() +} +func (m *QueryMarketMapperRevShareDetails) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMarketMapperRevShareDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMarketMapperRevShareDetails proto.InternalMessageInfo + +func (m *QueryMarketMapperRevShareDetails) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + +// Response type for QueryMarketMapperRevShareDetails +type QueryMarketMapperRevShareDetailsResponse struct { + Details *MarketMapperRevShareDetails `protobuf:"bytes,1,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *QueryMarketMapperRevShareDetailsResponse) Reset() { + *m = QueryMarketMapperRevShareDetailsResponse{} +} +func (m *QueryMarketMapperRevShareDetailsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMarketMapperRevShareDetailsResponse) ProtoMessage() {} +func (*QueryMarketMapperRevShareDetailsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_13d50c6e3048e744, []int{1} +} +func (m *QueryMarketMapperRevShareDetailsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMarketMapperRevShareDetailsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMarketMapperRevShareDetailsResponse.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 *QueryMarketMapperRevShareDetailsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMarketMapperRevShareDetailsResponse.Merge(m, src) +} +func (m *QueryMarketMapperRevShareDetailsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMarketMapperRevShareDetailsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMarketMapperRevShareDetailsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMarketMapperRevShareDetailsResponse proto.InternalMessageInfo + +func (m *QueryMarketMapperRevShareDetailsResponse) GetDetails() *MarketMapperRevShareDetails { + if m != nil { + return m.Details + } + return nil +} + +func init() { + proto.RegisterType((*QueryMarketMapperRevShareDetails)(nil), "dydxprotocol.revshare.QueryMarketMapperRevShareDetails") + proto.RegisterType((*QueryMarketMapperRevShareDetailsResponse)(nil), "dydxprotocol.revshare.QueryMarketMapperRevShareDetailsResponse") +} + func init() { proto.RegisterFile("dydxprotocol/revshare/query.proto", fileDescriptor_13d50c6e3048e744) } var fileDescriptor_13d50c6e3048e744 = []byte{ - // 137 bytes of a gzipped FileDescriptorProto + // 314 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xa9, 0x4c, 0xa9, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2d, 0x2b, 0xce, 0x48, 0x2c, 0x4a, 0xd5, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x8b, 0x0b, 0x89, 0x22, 0x2b, 0xd1, 0x83, - 0x29, 0x31, 0x62, 0xe7, 0x62, 0x0d, 0x04, 0xa9, 0x72, 0x0a, 0x39, 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, 0xab, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, - 0x7d, 0x14, 0x7b, 0xca, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x08, - 0xbb, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x52, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x67, 0x77, 0xeb, 0xea, 0xa1, 0x00, 0x00, 0x00, + 0x29, 0x91, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, + 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0x68, 0x92, 0x52, 0xc1, 0x6e, 0x2e, + 0x8c, 0x01, 0x51, 0xa5, 0x64, 0xcf, 0xa5, 0x10, 0x08, 0xb2, 0xc9, 0x37, 0xb1, 0x28, 0x3b, 0xb5, + 0xc4, 0x37, 0xb1, 0xa0, 0x20, 0xb5, 0x28, 0x28, 0xb5, 0x2c, 0x18, 0xa4, 0xc4, 0x25, 0xb5, 0x24, + 0x31, 0x33, 0xa7, 0x58, 0x48, 0x9a, 0x8b, 0x33, 0x17, 0x2c, 0x1d, 0x9f, 0x99, 0x22, 0xc1, 0xa8, + 0xc0, 0xa8, 0xc1, 0x1b, 0xc4, 0x01, 0x11, 0xf0, 0x4c, 0x51, 0xaa, 0xe0, 0xd2, 0x20, 0x64, 0x40, + 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x0f, 0x17, 0x7b, 0x0a, 0x44, 0x08, 0x6c, + 0x0c, 0xb7, 0x91, 0x91, 0x1e, 0x56, 0x9f, 0xe9, 0xe1, 0x33, 0x0c, 0x66, 0x84, 0xd1, 0x5b, 0x46, + 0x2e, 0x56, 0xb0, 0xd5, 0x42, 0x8f, 0x19, 0xb9, 0xa4, 0xf1, 0x79, 0xc0, 0x1c, 0x87, 0x35, 0x84, + 0x1c, 0x2e, 0x65, 0x4f, 0xa6, 0x46, 0x98, 0x8f, 0x95, 0xbc, 0x9a, 0x2e, 0x3f, 0x99, 0xcc, 0xe4, + 0x22, 0xe4, 0xa4, 0x8f, 0x3d, 0x36, 0xa0, 0xe1, 0x9a, 0x0b, 0x36, 0x24, 0xbe, 0x28, 0xb5, 0x2c, + 0x1e, 0x2c, 0x1e, 0x0f, 0xf5, 0xa3, 0x7e, 0x35, 0x3c, 0xe0, 0x6b, 0x9d, 0x42, 0x4e, 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, 0x2a, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, + 0x39, 0x3f, 0x17, 0xd5, 0x9e, 0x32, 0x13, 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x7d, 0xb8, 0x48, + 0x05, 0xc2, 0xee, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x94, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0x18, 0x56, 0xfe, 0x50, 0x87, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +163,8 @@ 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 { + // Queries market mapper revenue share details for a specific market + MarketMapperRevShareDetails(ctx context.Context, in *QueryMarketMapperRevShareDetails, opts ...grpc.CallOption) (*QueryMarketMapperRevShareDetailsResponse, error) } type queryClient struct { @@ -60,22 +175,405 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) MarketMapperRevShareDetails(ctx context.Context, in *QueryMarketMapperRevShareDetails, opts ...grpc.CallOption) (*QueryMarketMapperRevShareDetailsResponse, error) { + out := new(QueryMarketMapperRevShareDetailsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.revshare.Query/MarketMapperRevShareDetails", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { + // Queries market mapper revenue share details for a specific market + MarketMapperRevShareDetails(context.Context, *QueryMarketMapperRevShareDetails) (*QueryMarketMapperRevShareDetailsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) MarketMapperRevShareDetails(ctx context.Context, req *QueryMarketMapperRevShareDetails) (*QueryMarketMapperRevShareDetailsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MarketMapperRevShareDetails not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_MarketMapperRevShareDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMarketMapperRevShareDetails) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MarketMapperRevShareDetails(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.revshare.Query/MarketMapperRevShareDetails", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MarketMapperRevShareDetails(ctx, req.(*QueryMarketMapperRevShareDetails)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.revshare.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "dydxprotocol/revshare/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "MarketMapperRevShareDetails", + Handler: _Query_MarketMapperRevShareDetails_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/revshare/query.proto", +} + +func (m *QueryMarketMapperRevShareDetails) 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 *QueryMarketMapperRevShareDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMarketMapperRevShareDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MarketId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryMarketMapperRevShareDetailsResponse) 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 *QueryMarketMapperRevShareDetailsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMarketMapperRevShareDetailsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Details != nil { + { + size, err := m.Details.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } + +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 *QueryMarketMapperRevShareDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MarketId != 0 { + n += 1 + sovQuery(uint64(m.MarketId)) + } + return n +} + +func (m *QueryMarketMapperRevShareDetailsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Details != nil { + l = m.Details.Size() + n += 1 + l + sovQuery(uint64(l)) + } + 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 *QueryMarketMapperRevShareDetails) 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: QueryMarketMapperRevShareDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMarketMapperRevShareDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryMarketMapperRevShareDetailsResponse) 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: QueryMarketMapperRevShareDetailsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMarketMapperRevShareDetailsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Details == nil { + m.Details = &MarketMapperRevShareDetails{} + } + if err := m.Details.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func 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/revshare/types/query.pb.gw.go b/protocol/x/revshare/types/query.pb.gw.go new file mode 100644 index 0000000000..be901e4959 --- /dev/null +++ b/protocol/x/revshare/types/query.pb.gw.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dydxprotocol/revshare/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_MarketMapperRevShareDetails_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMarketMapperRevShareDetails + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["market_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "market_id") + } + + protoReq.MarketId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "market_id", err) + } + + msg, err := client.MarketMapperRevShareDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MarketMapperRevShareDetails_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMarketMapperRevShareDetails + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["market_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "market_id") + } + + protoReq.MarketId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "market_id", err) + } + + msg, err := server.MarketMapperRevShareDetails(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_MarketMapperRevShareDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_MarketMapperRevShareDetails_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MarketMapperRevShareDetails_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_MarketMapperRevShareDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MarketMapperRevShareDetails_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MarketMapperRevShareDetails_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_MarketMapperRevShareDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "revshare", "market_mapper_rev_share_details", "market_id"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_MarketMapperRevShareDetails_0 = runtime.ForwardResponseMessage +) diff --git a/protocol/x/revshare/types/revshare.pb.go b/protocol/x/revshare/types/revshare.pb.go new file mode 100644 index 0000000000..ae93064e4f --- /dev/null +++ b/protocol/x/revshare/types/revshare.pb.go @@ -0,0 +1,305 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/revshare/revshare.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MarketMapperRevShareDetails specifies any details associated with the market +// mapper revenue share +type MarketMapperRevShareDetails struct { + // Unix timestamp recorded when the market revenue share expires + ExpirationTs uint64 `protobuf:"varint,1,opt,name=expiration_ts,json=expirationTs,proto3" json:"expiration_ts,omitempty"` +} + +func (m *MarketMapperRevShareDetails) Reset() { *m = MarketMapperRevShareDetails{} } +func (m *MarketMapperRevShareDetails) String() string { return proto.CompactTextString(m) } +func (*MarketMapperRevShareDetails) ProtoMessage() {} +func (*MarketMapperRevShareDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_5b9759663d195798, []int{0} +} +func (m *MarketMapperRevShareDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MarketMapperRevShareDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MarketMapperRevShareDetails.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 *MarketMapperRevShareDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarketMapperRevShareDetails.Merge(m, src) +} +func (m *MarketMapperRevShareDetails) XXX_Size() int { + return m.Size() +} +func (m *MarketMapperRevShareDetails) XXX_DiscardUnknown() { + xxx_messageInfo_MarketMapperRevShareDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_MarketMapperRevShareDetails proto.InternalMessageInfo + +func (m *MarketMapperRevShareDetails) GetExpirationTs() uint64 { + if m != nil { + return m.ExpirationTs + } + return 0 +} + +func init() { + proto.RegisterType((*MarketMapperRevShareDetails)(nil), "dydxprotocol.revshare.MarketMapperRevShareDetails") +} + +func init() { + proto.RegisterFile("dydxprotocol/revshare/revshare.proto", fileDescriptor_5b9759663d195798) +} + +var fileDescriptor_5b9759663d195798 = []byte{ + // 183 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2d, 0x2b, 0xce, 0x48, 0x2c, + 0x4a, 0x85, 0x33, 0xf4, 0xc0, 0x52, 0x42, 0xa2, 0xc8, 0xaa, 0xf4, 0x60, 0x92, 0x4a, 0x4e, 0x5c, + 0xd2, 0xbe, 0x89, 0x45, 0xd9, 0xa9, 0x25, 0xbe, 0x89, 0x05, 0x05, 0xa9, 0x45, 0x41, 0xa9, 0x65, + 0xc1, 0x20, 0x71, 0x97, 0xd4, 0x92, 0xc4, 0xcc, 0x9c, 0x62, 0x21, 0x65, 0x2e, 0xde, 0xd4, 0x8a, + 0x82, 0xcc, 0xa2, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0xf8, 0x92, 0x62, 0x09, 0x46, 0x05, 0x46, 0x0d, + 0x96, 0x20, 0x1e, 0x84, 0x60, 0x48, 0xb1, 0x53, 0xc8, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, + 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, + 0xcb, 0x31, 0x44, 0x59, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa3, + 0xb8, 0xb2, 0xcc, 0x44, 0x37, 0x39, 0x23, 0x31, 0x33, 0x4f, 0x1f, 0x2e, 0x52, 0x81, 0x70, 0x79, + 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x58, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xec, + 0xc5, 0x93, 0xd9, 0xdf, 0x00, 0x00, 0x00, +} + +func (m *MarketMapperRevShareDetails) 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 *MarketMapperRevShareDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MarketMapperRevShareDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExpirationTs != 0 { + i = encodeVarintRevshare(dAtA, i, uint64(m.ExpirationTs)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintRevshare(dAtA []byte, offset int, v uint64) int { + offset -= sovRevshare(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MarketMapperRevShareDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExpirationTs != 0 { + n += 1 + sovRevshare(uint64(m.ExpirationTs)) + } + return n +} + +func sovRevshare(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRevshare(x uint64) (n int) { + return sovRevshare(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MarketMapperRevShareDetails) 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 ErrIntOverflowRevshare + } + 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: MarketMapperRevShareDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MarketMapperRevShareDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationTs", wireType) + } + m.ExpirationTs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRevshare + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationTs |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRevshare(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRevshare + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRevshare(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, ErrIntOverflowRevshare + } + 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, ErrIntOverflowRevshare + } + 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, ErrIntOverflowRevshare + } + 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, ErrInvalidLengthRevshare + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRevshare + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRevshare + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRevshare = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRevshare = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRevshare = fmt.Errorf("proto: unexpected end of group") +)