diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 415db7acf1..1f72df76a2 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -42,104 +42,111 @@ import * as _45 from "./feetiers/genesis"; import * as _46 from "./feetiers/params"; import * as _47 from "./feetiers/query"; import * as _48 from "./feetiers/tx"; -import * as _49 from "./indexer/events/events"; -import * as _50 from "./indexer/indexer_manager/event"; -import * as _51 from "./indexer/off_chain_updates/off_chain_updates"; -import * as _52 from "./indexer/protocol/v1/clob"; -import * as _53 from "./indexer/protocol/v1/subaccount"; -import * as _54 from "./indexer/redis/redis_order"; -import * as _55 from "./indexer/shared/removal_reason"; -import * as _56 from "./indexer/socks/messages"; -import * as _57 from "./perpetuals/genesis"; -import * as _58 from "./perpetuals/params"; -import * as _59 from "./perpetuals/perpetual"; -import * as _60 from "./perpetuals/query"; -import * as _61 from "./perpetuals/tx"; -import * as _62 from "./prices/genesis"; -import * as _63 from "./prices/market_param"; -import * as _64 from "./prices/market_price"; -import * as _65 from "./prices/query"; -import * as _66 from "./prices/tx"; -import * as _67 from "./rewards/genesis"; -import * as _68 from "./rewards/params"; -import * as _69 from "./rewards/query"; -import * as _70 from "./rewards/reward_share"; -import * as _71 from "./rewards/tx"; -import * as _72 from "./sending/genesis"; -import * as _73 from "./sending/query"; -import * as _74 from "./sending/transfer"; -import * as _75 from "./sending/tx"; -import * as _76 from "./stats/genesis"; -import * as _77 from "./stats/params"; -import * as _78 from "./stats/query"; -import * as _79 from "./stats/stats"; -import * as _80 from "./stats/tx"; -import * as _81 from "./subaccounts/asset_position"; -import * as _82 from "./subaccounts/genesis"; -import * as _83 from "./subaccounts/perpetual_position"; -import * as _84 from "./subaccounts/query"; -import * as _85 from "./subaccounts/subaccount"; -import * as _86 from "./vest/genesis"; -import * as _87 from "./vest/query"; -import * as _88 from "./vest/tx"; -import * as _89 from "./vest/vest_entry"; -import * as _97 from "./assets/query.lcd"; -import * as _98 from "./blocktime/query.lcd"; -import * as _99 from "./bridge/query.lcd"; -import * as _100 from "./clob/query.lcd"; -import * as _101 from "./delaymsg/query.lcd"; -import * as _102 from "./epochs/query.lcd"; -import * as _103 from "./feetiers/query.lcd"; -import * as _104 from "./perpetuals/query.lcd"; -import * as _105 from "./prices/query.lcd"; -import * as _106 from "./rewards/query.lcd"; -import * as _107 from "./stats/query.lcd"; -import * as _108 from "./subaccounts/query.lcd"; -import * as _109 from "./vest/query.lcd"; -import * as _110 from "./assets/query.rpc.Query"; -import * as _111 from "./blocktime/query.rpc.Query"; -import * as _112 from "./bridge/query.rpc.Query"; -import * as _113 from "./clob/query.rpc.Query"; -import * as _114 from "./delaymsg/query.rpc.Query"; -import * as _115 from "./epochs/query.rpc.Query"; -import * as _116 from "./feetiers/query.rpc.Query"; -import * as _117 from "./perpetuals/query.rpc.Query"; -import * as _118 from "./prices/query.rpc.Query"; -import * as _119 from "./rewards/query.rpc.Query"; -import * as _120 from "./sending/query.rpc.Query"; -import * as _121 from "./stats/query.rpc.Query"; -import * as _122 from "./subaccounts/query.rpc.Query"; -import * as _123 from "./vest/query.rpc.Query"; -import * as _124 from "./blocktime/tx.rpc.msg"; -import * as _125 from "./bridge/tx.rpc.msg"; -import * as _126 from "./clob/tx.rpc.msg"; -import * as _127 from "./delaymsg/tx.rpc.msg"; -import * as _128 from "./feetiers/tx.rpc.msg"; -import * as _129 from "./perpetuals/tx.rpc.msg"; -import * as _130 from "./prices/tx.rpc.msg"; -import * as _131 from "./rewards/tx.rpc.msg"; -import * as _132 from "./sending/tx.rpc.msg"; -import * as _133 from "./stats/tx.rpc.msg"; -import * as _134 from "./vest/tx.rpc.msg"; -import * as _135 from "./lcd"; -import * as _136 from "./rpc.query"; -import * as _137 from "./rpc.tx"; +import * as _49 from "./ibcratelimit/capacity"; +import * as _50 from "./ibcratelimit/genesis"; +import * as _51 from "./ibcratelimit/limit_params"; +import * as _52 from "./ibcratelimit/query"; +import * as _53 from "./ibcratelimit/tx"; +import * as _54 from "./indexer/events/events"; +import * as _55 from "./indexer/indexer_manager/event"; +import * as _56 from "./indexer/off_chain_updates/off_chain_updates"; +import * as _57 from "./indexer/protocol/v1/clob"; +import * as _58 from "./indexer/protocol/v1/subaccount"; +import * as _59 from "./indexer/redis/redis_order"; +import * as _60 from "./indexer/shared/removal_reason"; +import * as _61 from "./indexer/socks/messages"; +import * as _62 from "./perpetuals/genesis"; +import * as _63 from "./perpetuals/params"; +import * as _64 from "./perpetuals/perpetual"; +import * as _65 from "./perpetuals/query"; +import * as _66 from "./perpetuals/tx"; +import * as _67 from "./prices/genesis"; +import * as _68 from "./prices/market_param"; +import * as _69 from "./prices/market_price"; +import * as _70 from "./prices/query"; +import * as _71 from "./prices/tx"; +import * as _72 from "./rewards/genesis"; +import * as _73 from "./rewards/params"; +import * as _74 from "./rewards/query"; +import * as _75 from "./rewards/reward_share"; +import * as _76 from "./rewards/tx"; +import * as _77 from "./sending/genesis"; +import * as _78 from "./sending/query"; +import * as _79 from "./sending/transfer"; +import * as _80 from "./sending/tx"; +import * as _81 from "./stats/genesis"; +import * as _82 from "./stats/params"; +import * as _83 from "./stats/query"; +import * as _84 from "./stats/stats"; +import * as _85 from "./stats/tx"; +import * as _86 from "./subaccounts/asset_position"; +import * as _87 from "./subaccounts/genesis"; +import * as _88 from "./subaccounts/perpetual_position"; +import * as _89 from "./subaccounts/query"; +import * as _90 from "./subaccounts/subaccount"; +import * as _91 from "./vest/genesis"; +import * as _92 from "./vest/query"; +import * as _93 from "./vest/tx"; +import * as _94 from "./vest/vest_entry"; +import * as _102 from "./assets/query.lcd"; +import * as _103 from "./blocktime/query.lcd"; +import * as _104 from "./bridge/query.lcd"; +import * as _105 from "./clob/query.lcd"; +import * as _106 from "./delaymsg/query.lcd"; +import * as _107 from "./epochs/query.lcd"; +import * as _108 from "./feetiers/query.lcd"; +import * as _109 from "./perpetuals/query.lcd"; +import * as _110 from "./prices/query.lcd"; +import * as _111 from "./rewards/query.lcd"; +import * as _112 from "./stats/query.lcd"; +import * as _113 from "./subaccounts/query.lcd"; +import * as _114 from "./vest/query.lcd"; +import * as _115 from "./assets/query.rpc.Query"; +import * as _116 from "./blocktime/query.rpc.Query"; +import * as _117 from "./bridge/query.rpc.Query"; +import * as _118 from "./clob/query.rpc.Query"; +import * as _119 from "./delaymsg/query.rpc.Query"; +import * as _120 from "./epochs/query.rpc.Query"; +import * as _121 from "./feetiers/query.rpc.Query"; +import * as _122 from "./ibcratelimit/query.rpc.Query"; +import * as _123 from "./perpetuals/query.rpc.Query"; +import * as _124 from "./prices/query.rpc.Query"; +import * as _125 from "./rewards/query.rpc.Query"; +import * as _126 from "./sending/query.rpc.Query"; +import * as _127 from "./stats/query.rpc.Query"; +import * as _128 from "./subaccounts/query.rpc.Query"; +import * as _129 from "./vest/query.rpc.Query"; +import * as _130 from "./blocktime/tx.rpc.msg"; +import * as _131 from "./bridge/tx.rpc.msg"; +import * as _132 from "./clob/tx.rpc.msg"; +import * as _133 from "./delaymsg/tx.rpc.msg"; +import * as _134 from "./feetiers/tx.rpc.msg"; +import * as _135 from "./ibcratelimit/tx.rpc.msg"; +import * as _136 from "./perpetuals/tx.rpc.msg"; +import * as _137 from "./prices/tx.rpc.msg"; +import * as _138 from "./rewards/tx.rpc.msg"; +import * as _139 from "./sending/tx.rpc.msg"; +import * as _140 from "./stats/tx.rpc.msg"; +import * as _141 from "./vest/tx.rpc.msg"; +import * as _142 from "./lcd"; +import * as _143 from "./rpc.query"; +import * as _144 from "./rpc.tx"; export namespace dydxprotocol { export const assets = { ..._5, ..._6, ..._7, ..._8, - ..._97, - ..._110 + ..._102, + ..._115 }; export const blocktime = { ..._9, ..._10, ..._11, ..._12, ..._13, - ..._98, - ..._111, - ..._124 + ..._103, + ..._116, + ..._130 }; export const bridge = { ..._14, ..._15, @@ -147,9 +154,9 @@ export namespace dydxprotocol { ..._17, ..._18, ..._19, - ..._99, - ..._112, - ..._125 + ..._104, + ..._117, + ..._131 }; export const clob = { ..._20, ..._21, @@ -165,9 +172,9 @@ export namespace dydxprotocol { ..._31, ..._32, ..._33, - ..._100, - ..._113, - ..._126 + ..._105, + ..._118, + ..._132 }; export namespace daemons { export const bridge = { ..._34 @@ -182,104 +189,112 @@ export namespace dydxprotocol { ..._39, ..._40, ..._41, - ..._101, - ..._114, - ..._127 + ..._106, + ..._119, + ..._133 }; export const epochs = { ..._42, ..._43, ..._44, - ..._102, - ..._115 + ..._107, + ..._120 }; export const feetiers = { ..._45, ..._46, ..._47, ..._48, - ..._103, - ..._116, - ..._128 + ..._108, + ..._121, + ..._134 + }; + export const ibcratelimit = { ..._49, + ..._50, + ..._51, + ..._52, + ..._53, + ..._122, + ..._135 }; export namespace indexer { - export const events = { ..._49 + export const events = { ..._54 }; - export const indexer_manager = { ..._50 + export const indexer_manager = { ..._55 }; - export const off_chain_updates = { ..._51 + export const off_chain_updates = { ..._56 }; export namespace protocol { - export const v1 = { ..._52, - ..._53 + export const v1 = { ..._57, + ..._58 }; } - export const redis = { ..._54 + export const redis = { ..._59 }; - export const shared = { ..._55 + export const shared = { ..._60 }; - export const socks = { ..._56 + export const socks = { ..._61 }; } - export const perpetuals = { ..._57, - ..._58, - ..._59, - ..._60, - ..._61, - ..._104, - ..._117, - ..._129 - }; - export const prices = { ..._62, + export const perpetuals = { ..._62, ..._63, ..._64, ..._65, ..._66, - ..._105, - ..._118, - ..._130 + ..._109, + ..._123, + ..._136 }; - export const rewards = { ..._67, + export const prices = { ..._67, ..._68, ..._69, ..._70, ..._71, - ..._106, - ..._119, - ..._131 + ..._110, + ..._124, + ..._137 }; - export const sending = { ..._72, + export const rewards = { ..._72, ..._73, ..._74, ..._75, - ..._120, - ..._132 + ..._76, + ..._111, + ..._125, + ..._138 }; - export const stats = { ..._76, - ..._77, + export const sending = { ..._77, ..._78, ..._79, ..._80, - ..._107, - ..._121, - ..._133 + ..._126, + ..._139 }; - export const subaccounts = { ..._81, + export const stats = { ..._81, ..._82, ..._83, ..._84, ..._85, - ..._108, - ..._122 + ..._112, + ..._127, + ..._140 }; - export const vest = { ..._86, + export const subaccounts = { ..._86, ..._87, ..._88, ..._89, - ..._109, - ..._123, - ..._134 + ..._90, + ..._113, + ..._128 }; - export const ClientFactory = { ..._135, - ..._136, - ..._137 + export const vest = { ..._91, + ..._92, + ..._93, + ..._94, + ..._114, + ..._129, + ..._141 + }; + export const ClientFactory = { ..._142, + ..._143, + ..._144 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/capacity.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/capacity.ts new file mode 100644 index 0000000000..c0a5eabcaf --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/capacity.ts @@ -0,0 +1,89 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** DenomCapacity stores a list of rate limit capacity for a denom. */ + +export interface DenomCapacity { + /** + * denom is the denomination of the token being rate limited. + * e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + */ + denom: string; + /** + * capacity_list is a list of capacity amount tracked for each `Limiter` + * on the denom. This list has a 1:1 mapping to `limiter` list under + * `LimitParams`. + */ + + capacityList: Uint8Array[]; +} +/** DenomCapacity stores a list of rate limit capacity for a denom. */ + +export interface DenomCapacitySDKType { + /** + * denom is the denomination of the token being rate limited. + * e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + */ + denom: string; + /** + * capacity_list is a list of capacity amount tracked for each `Limiter` + * on the denom. This list has a 1:1 mapping to `limiter` list under + * `LimitParams`. + */ + + capacity_list: Uint8Array[]; +} + +function createBaseDenomCapacity(): DenomCapacity { + return { + denom: "", + capacityList: [] + }; +} + +export const DenomCapacity = { + encode(message: DenomCapacity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + + for (const v of message.capacityList) { + writer.uint32(18).bytes(v!); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DenomCapacity { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomCapacity(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + + case 2: + message.capacityList.push(reader.bytes()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): DenomCapacity { + const message = createBaseDenomCapacity(); + message.denom = object.denom ?? ""; + message.capacityList = object.capacityList?.map(e => e) || []; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/genesis.ts new file mode 100644 index 0000000000..35956f214f --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/genesis.ts @@ -0,0 +1,60 @@ +import { LimitParams, LimitParamsSDKType } from "./limit_params"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** GenesisState defines the ibcratelimit module's genesis state. */ + +export interface GenesisState { + /** limit_params_list defines the list of `LimitParams` at genesis. */ + limitParamsList: LimitParams[]; +} +/** GenesisState defines the ibcratelimit module's genesis state. */ + +export interface GenesisStateSDKType { + /** limit_params_list defines the list of `LimitParams` at genesis. */ + limit_params_list: LimitParamsSDKType[]; +} + +function createBaseGenesisState(): GenesisState { + return { + limitParamsList: [] + }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.limitParamsList) { + LimitParams.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.limitParamsList.push(LimitParams.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.limitParamsList = object.limitParamsList?.map(e => LimitParams.fromPartial(e)) || []; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/limit_params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/limit_params.ts new file mode 100644 index 0000000000..d78b9120d7 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/limit_params.ts @@ -0,0 +1,198 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** LimitParams defines rate limit params on a denom. */ + +export interface LimitParams { + /** + * denom is the denomination of the token being rate limited. + * e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + */ + denom: string; + /** + * limiters is a list of rate-limiters on this denom. All limiters + * must be satified for a withdrawal to proceed. + */ + + limiters: Limiter[]; +} +/** LimitParams defines rate limit params on a denom. */ + +export interface LimitParamsSDKType { + /** + * denom is the denomination of the token being rate limited. + * e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + */ + denom: string; + /** + * limiters is a list of rate-limiters on this denom. All limiters + * must be satified for a withdrawal to proceed. + */ + + limiters: LimiterSDKType[]; +} +/** Limiter defines one rate-limiter on a specfic denom. */ + +export interface Limiter { + /** + * period_sec is the rolling time period for which the limit applies + * e.g. 3600 (an hour) + */ + periodSec: number; + /** + * baseline_minimum is the minimum maximum withdrawal coin amount within the + * time period. + * e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT + */ + + baselineMinimum: Uint8Array; + /** + * baseline_tvl_ppm is the maximum ratio of TVL withdrawable in + * the time period, in part-per-million. + * e.g. 100_000 (10%) + */ + + baselineTvlPpm: number; +} +/** Limiter defines one rate-limiter on a specfic denom. */ + +export interface LimiterSDKType { + /** + * period_sec is the rolling time period for which the limit applies + * e.g. 3600 (an hour) + */ + period_sec: number; + /** + * baseline_minimum is the minimum maximum withdrawal coin amount within the + * time period. + * e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT + */ + + baseline_minimum: Uint8Array; + /** + * baseline_tvl_ppm is the maximum ratio of TVL withdrawable in + * the time period, in part-per-million. + * e.g. 100_000 (10%) + */ + + baseline_tvl_ppm: number; +} + +function createBaseLimitParams(): LimitParams { + return { + denom: "", + limiters: [] + }; +} + +export const LimitParams = { + encode(message: LimitParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + + for (const v of message.limiters) { + Limiter.encode(v!, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LimitParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + + case 2: + message.limiters.push(Limiter.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): LimitParams { + const message = createBaseLimitParams(); + message.denom = object.denom ?? ""; + message.limiters = object.limiters?.map(e => Limiter.fromPartial(e)) || []; + return message; + } + +}; + +function createBaseLimiter(): Limiter { + return { + periodSec: 0, + baselineMinimum: new Uint8Array(), + baselineTvlPpm: 0 + }; +} + +export const Limiter = { + encode(message: Limiter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.periodSec !== 0) { + writer.uint32(16).uint32(message.periodSec); + } + + if (message.baselineMinimum.length !== 0) { + writer.uint32(26).bytes(message.baselineMinimum); + } + + if (message.baselineTvlPpm !== 0) { + writer.uint32(32).uint32(message.baselineTvlPpm); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Limiter { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimiter(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 2: + message.periodSec = reader.uint32(); + break; + + case 3: + message.baselineMinimum = reader.bytes(); + break; + + case 4: + message.baselineTvlPpm = reader.uint32(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): Limiter { + const message = createBaseLimiter(); + message.periodSec = object.periodSec ?? 0; + message.baselineMinimum = object.baselineMinimum ?? new Uint8Array(); + message.baselineTvlPpm = object.baselineTvlPpm ?? 0; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.rpc.Query.ts new file mode 100644 index 0000000000..309d7e014a --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.rpc.Query.ts @@ -0,0 +1,49 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { ListLimitParamsRequest, ListLimitParamsResponse, QueryCapacityByDenomRequest, QueryCapacityByDenomResponse } from "./query"; +/** Query defines the gRPC querier service. */ + +export interface Query { + /** List all limit params. */ + listLimitParams(request?: ListLimitParamsRequest): Promise; + /** Query capacity by denom. */ + + capacityByDenom(request: QueryCapacityByDenomRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.listLimitParams = this.listLimitParams.bind(this); + this.capacityByDenom = this.capacityByDenom.bind(this); + } + + listLimitParams(request: ListLimitParamsRequest = {}): Promise { + const data = ListLimitParamsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.ibcratelimit.Query", "ListLimitParams", data); + return promise.then(data => ListLimitParamsResponse.decode(new _m0.Reader(data))); + } + + capacityByDenom(request: QueryCapacityByDenomRequest): Promise { + const data = QueryCapacityByDenomRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.ibcratelimit.Query", "CapacityByDenom", data); + return promise.then(data => QueryCapacityByDenomResponse.decode(new _m0.Reader(data))); + } + +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + listLimitParams(request?: ListLimitParamsRequest): Promise { + return queryService.listLimitParams(request); + }, + + capacityByDenom(request: QueryCapacityByDenomRequest): Promise { + return queryService.capacityByDenom(request); + } + + }; +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.ts new file mode 100644 index 0000000000..def00e01da --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/query.ts @@ -0,0 +1,305 @@ +import { LimitParams, LimitParamsSDKType } from "./limit_params"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** ListLimitParamsRequest is a request type of the ListLimitParams RPC method. */ + +export interface ListLimitParamsRequest {} +/** ListLimitParamsRequest is a request type of the ListLimitParams RPC method. */ + +export interface ListLimitParamsRequestSDKType {} +/** ListLimitParamsResponse is a response type of the ListLimitParams RPC method. */ + +export interface ListLimitParamsResponse { + /** ListLimitParamsResponse is a response type of the ListLimitParams RPC method. */ + limitParamsList: LimitParams[]; +} +/** ListLimitParamsResponse is a response type of the ListLimitParams RPC method. */ + +export interface ListLimitParamsResponseSDKType { + /** ListLimitParamsResponse is a response type of the ListLimitParams RPC method. */ + limit_params_list: LimitParamsSDKType[]; +} +/** + * QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC + * method. + */ + +export interface QueryCapacityByDenomRequest { + /** + * QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC + * method. + */ + denom: string; +} +/** + * QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC + * method. + */ + +export interface QueryCapacityByDenomRequestSDKType { + /** + * QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC + * method. + */ + denom: string; +} +/** CapacityResult is a specific rate limit for a denom. */ + +export interface CapacityResult { + periodSec: number; + capacity: Uint8Array; +} +/** CapacityResult is a specific rate limit for a denom. */ + +export interface CapacityResultSDKType { + period_sec: number; + capacity: Uint8Array; +} +/** + * QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC + * method. + */ + +export interface QueryCapacityByDenomResponse { + /** + * QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC + * method. + */ + results: CapacityResult[]; +} +/** + * QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC + * method. + */ + +export interface QueryCapacityByDenomResponseSDKType { + /** + * QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC + * method. + */ + results: CapacityResultSDKType[]; +} + +function createBaseListLimitParamsRequest(): ListLimitParamsRequest { + return {}; +} + +export const ListLimitParamsRequest = { + encode(_: ListLimitParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListLimitParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListLimitParamsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): ListLimitParamsRequest { + const message = createBaseListLimitParamsRequest(); + return message; + } + +}; + +function createBaseListLimitParamsResponse(): ListLimitParamsResponse { + return { + limitParamsList: [] + }; +} + +export const ListLimitParamsResponse = { + encode(message: ListLimitParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.limitParamsList) { + LimitParams.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListLimitParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListLimitParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.limitParamsList.push(LimitParams.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): ListLimitParamsResponse { + const message = createBaseListLimitParamsResponse(); + message.limitParamsList = object.limitParamsList?.map(e => LimitParams.fromPartial(e)) || []; + return message; + } + +}; + +function createBaseQueryCapacityByDenomRequest(): QueryCapacityByDenomRequest { + return { + denom: "" + }; +} + +export const QueryCapacityByDenomRequest = { + encode(message: QueryCapacityByDenomRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCapacityByDenomRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCapacityByDenomRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryCapacityByDenomRequest { + const message = createBaseQueryCapacityByDenomRequest(); + message.denom = object.denom ?? ""; + return message; + } + +}; + +function createBaseCapacityResult(): CapacityResult { + return { + periodSec: 0, + capacity: new Uint8Array() + }; +} + +export const CapacityResult = { + encode(message: CapacityResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.periodSec !== 0) { + writer.uint32(8).uint32(message.periodSec); + } + + if (message.capacity.length !== 0) { + writer.uint32(18).bytes(message.capacity); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CapacityResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapacityResult(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.periodSec = reader.uint32(); + break; + + case 2: + message.capacity = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): CapacityResult { + const message = createBaseCapacityResult(); + message.periodSec = object.periodSec ?? 0; + message.capacity = object.capacity ?? new Uint8Array(); + return message; + } + +}; + +function createBaseQueryCapacityByDenomResponse(): QueryCapacityByDenomResponse { + return { + results: [] + }; +} + +export const QueryCapacityByDenomResponse = { + encode(message: QueryCapacityByDenomResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.results) { + CapacityResult.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCapacityByDenomResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCapacityByDenomResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.results.push(CapacityResult.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryCapacityByDenomResponse { + const message = createBaseQueryCapacityByDenomResponse(); + message.results = object.results?.map(e => CapacityResult.fromPartial(e)) || []; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.rpc.msg.ts new file mode 100644 index 0000000000..5a4a6a1bd1 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.rpc.msg.ts @@ -0,0 +1,34 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { MsgSetLimitParams, MsgSetLimitParamsResponse, MsgDeleteLimitParams, MsgDeleteLimitParamsResponse } from "./tx"; +/** Msg defines the Msg service. */ + +export interface Msg { + /** SetLimitParams sets a `LimitParams` object in state. */ + setLimitParams(request: MsgSetLimitParams): Promise; + /** DeleteLimitParams removes a `LimitParams` object from state. */ + + deleteLimitParams(request: MsgDeleteLimitParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.setLimitParams = this.setLimitParams.bind(this); + this.deleteLimitParams = this.deleteLimitParams.bind(this); + } + + setLimitParams(request: MsgSetLimitParams): Promise { + const data = MsgSetLimitParams.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.ibcratelimit.Msg", "SetLimitParams", data); + return promise.then(data => MsgSetLimitParamsResponse.decode(new _m0.Reader(data))); + } + + deleteLimitParams(request: MsgDeleteLimitParams): Promise { + const data = MsgDeleteLimitParams.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.ibcratelimit.Msg", "DeleteLimitParams", data); + return promise.then(data => MsgDeleteLimitParamsResponse.decode(new _m0.Reader(data))); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.ts new file mode 100644 index 0000000000..5c6fe30ec9 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/ibcratelimit/tx.ts @@ -0,0 +1,225 @@ +import { LimitParams, LimitParamsSDKType } from "./limit_params"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** MsgSetLimitParams is the Msg/SetLimitParams request type. */ + +export interface MsgSetLimitParams { + authority: string; + /** Defines the parameters to set. All parameters must be supplied. */ + + limitParams?: LimitParams; +} +/** MsgSetLimitParams is the Msg/SetLimitParams request type. */ + +export interface MsgSetLimitParamsSDKType { + authority: string; + /** Defines the parameters to set. All parameters must be supplied. */ + + limit_params?: LimitParamsSDKType; +} +/** MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. */ + +export interface MsgSetLimitParamsResponse {} +/** MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. */ + +export interface MsgSetLimitParamsResponseSDKType {} +/** MsgDeleteLimitParams is the Msg/SetLimitParams request type. */ + +export interface MsgDeleteLimitParams { + authority: string; + /** The denom for which the `LimitParams` should be deleted. */ + + denom: string; +} +/** MsgDeleteLimitParams is the Msg/SetLimitParams request type. */ + +export interface MsgDeleteLimitParamsSDKType { + authority: string; + /** The denom for which the `LimitParams` should be deleted. */ + + denom: string; +} +/** MsgDeleteLimitParamsResponse is the Msg/DeleteLimitParams response type. */ + +export interface MsgDeleteLimitParamsResponse {} +/** MsgDeleteLimitParamsResponse is the Msg/DeleteLimitParams response type. */ + +export interface MsgDeleteLimitParamsResponseSDKType {} + +function createBaseMsgSetLimitParams(): MsgSetLimitParams { + return { + authority: "", + limitParams: undefined + }; +} + +export const MsgSetLimitParams = { + encode(message: MsgSetLimitParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + + if (message.limitParams !== undefined) { + LimitParams.encode(message.limitParams, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetLimitParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetLimitParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + + case 2: + message.limitParams = LimitParams.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgSetLimitParams { + const message = createBaseMsgSetLimitParams(); + message.authority = object.authority ?? ""; + message.limitParams = object.limitParams !== undefined && object.limitParams !== null ? LimitParams.fromPartial(object.limitParams) : undefined; + return message; + } + +}; + +function createBaseMsgSetLimitParamsResponse(): MsgSetLimitParamsResponse { + return {}; +} + +export const MsgSetLimitParamsResponse = { + encode(_: MsgSetLimitParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetLimitParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetLimitParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgSetLimitParamsResponse { + const message = createBaseMsgSetLimitParamsResponse(); + return message; + } + +}; + +function createBaseMsgDeleteLimitParams(): MsgDeleteLimitParams { + return { + authority: "", + denom: "" + }; +} + +export const MsgDeleteLimitParams = { + encode(message: MsgDeleteLimitParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteLimitParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteLimitParams(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + + case 2: + message.denom = reader.string(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgDeleteLimitParams { + const message = createBaseMsgDeleteLimitParams(); + message.authority = object.authority ?? ""; + message.denom = object.denom ?? ""; + return message; + } + +}; + +function createBaseMsgDeleteLimitParamsResponse(): MsgDeleteLimitParamsResponse { + return {}; +} + +export const MsgDeleteLimitParamsResponse = { + encode(_: MsgDeleteLimitParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteLimitParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteLimitParamsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgDeleteLimitParamsResponse { + const message = createBaseMsgDeleteLimitParamsResponse(); + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts index 0439dee6d1..336945f441 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts @@ -16,6 +16,7 @@ export const createRPCQueryClient = async ({ delaymsg: (await import("./delaymsg/query.rpc.Query")).createRpcQueryExtension(client), epochs: (await import("./epochs/query.rpc.Query")).createRpcQueryExtension(client), feetiers: (await import("./feetiers/query.rpc.Query")).createRpcQueryExtension(client), + ibcratelimit: (await import("./ibcratelimit/query.rpc.Query")).createRpcQueryExtension(client), perpetuals: (await import("./perpetuals/query.rpc.Query")).createRpcQueryExtension(client), prices: (await import("./prices/query.rpc.Query")).createRpcQueryExtension(client), rewards: (await import("./rewards/query.rpc.Query")).createRpcQueryExtension(client), 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 0922a81e40..629f261698 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts @@ -10,6 +10,7 @@ export const createRPCMsgClient = async ({ clob: new (await import("./clob/tx.rpc.msg")).MsgClientImpl(rpc), delaymsg: new (await import("./delaymsg/tx.rpc.msg")).MsgClientImpl(rpc), feetiers: new (await import("./feetiers/tx.rpc.msg")).MsgClientImpl(rpc), + ibcratelimit: new (await import("./ibcratelimit/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), rewards: new (await import("./rewards/tx.rpc.msg")).MsgClientImpl(rpc), diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 8cb67f7261..545e2a809e 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 _90 from "./gogo"; -export const gogoproto = { ..._90 +import * as _95 from "./gogo"; +export const gogoproto = { ..._95 }; \ 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 ea586389a8..c920ab8cb5 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 _91 from "./api/annotations"; -import * as _92 from "./api/http"; -import * as _93 from "./protobuf/descriptor"; -import * as _94 from "./protobuf/duration"; -import * as _95 from "./protobuf/timestamp"; -import * as _96 from "./protobuf/any"; +import * as _96 from "./api/annotations"; +import * as _97 from "./api/http"; +import * as _98 from "./protobuf/descriptor"; +import * as _99 from "./protobuf/duration"; +import * as _100 from "./protobuf/timestamp"; +import * as _101 from "./protobuf/any"; export namespace google { - export const api = { ..._91, - ..._92 + export const api = { ..._96, + ..._97 }; - export const protobuf = { ..._93, - ..._94, - ..._95, - ..._96 + export const protobuf = { ..._98, + ..._99, + ..._100, + ..._101 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/ibcratelimit/capacity.proto b/proto/dydxprotocol/ibcratelimit/capacity.proto new file mode 100644 index 0000000000..00f1a1c1ff --- /dev/null +++ b/proto/dydxprotocol/ibcratelimit/capacity.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package dydxprotocol.ibcratelimit; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; + +// DenomCapacity stores a list of rate limit capacity for a denom. +message DenomCapacity { + // denom is the denomination of the token being rate limited. + // e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + string denom = 1; + // capacity_list is a list of capacity amount tracked for each `Limiter` + // on the denom. This list has a 1:1 mapping to `limiter` list under + // `LimitParams`. + repeated bytes capacity_list = 2 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/dydxprotocol/ibcratelimit/genesis.proto b/proto/dydxprotocol/ibcratelimit/genesis.proto new file mode 100644 index 0000000000..0c9d563fd3 --- /dev/null +++ b/proto/dydxprotocol/ibcratelimit/genesis.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package dydxprotocol.ibcratelimit; + +import "gogoproto/gogo.proto"; +import "dydxprotocol/ibcratelimit/limit_params.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; + +// GenesisState defines the ibcratelimit module's genesis state. +message GenesisState { + // limit_params_list defines the list of `LimitParams` at genesis. + repeated LimitParams limit_params_list = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/dydxprotocol/ibcratelimit/limit_params.proto b/proto/dydxprotocol/ibcratelimit/limit_params.proto new file mode 100644 index 0000000000..d5bb20762b --- /dev/null +++ b/proto/dydxprotocol/ibcratelimit/limit_params.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package dydxprotocol.ibcratelimit; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; + +// LimitParams defines rate limit params on a denom. +message LimitParams { + // denom is the denomination of the token being rate limited. + // e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + string denom = 1; + // limiters is a list of rate-limiters on this denom. All limiters + // must be satified for a withdrawal to proceed. + repeated Limiter limiters = 2; +} + +// Limiter defines one rate-limiter on a specfic denom. +message Limiter { + // period_sec is the rolling time period for which the limit applies + // e.g. 3600 (an hour) + uint32 period_sec = 2; + // baseline_minimum is the minimum maximum withdrawal coin amount within the + // time period. + // e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT + bytes baseline_minimum = 3 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; + // baseline_tvl_ppm is the maximum ratio of TVL withdrawable in + // the time period, in part-per-million. + // e.g. 100_000 (10%) + uint32 baseline_tvl_ppm = 4; +} diff --git a/proto/dydxprotocol/ibcratelimit/query.proto b/proto/dydxprotocol/ibcratelimit/query.proto new file mode 100644 index 0000000000..001b43f386 --- /dev/null +++ b/proto/dydxprotocol/ibcratelimit/query.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package dydxprotocol.ibcratelimit; + +import "gogoproto/gogo.proto"; +import "dydxprotocol/ibcratelimit/limit_params.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; + +// Query defines the gRPC querier service. +service Query { + // List all limit params. + rpc ListLimitParams(ListLimitParamsRequest) returns (ListLimitParamsResponse); + + // Query capacity by denom. + rpc CapacityByDenom(QueryCapacityByDenomRequest) + returns (QueryCapacityByDenomResponse); +} + +// ListLimitParamsRequest is a request type of the ListLimitParams RPC method. +message ListLimitParamsRequest {} + +// ListLimitParamsResponse is a response type of the ListLimitParams RPC method. +message ListLimitParamsResponse { repeated LimitParams limit_params_list = 1; } + +// QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC +// method. +message QueryCapacityByDenomRequest { string denom = 1; } + +// CapacityResult is a specific rate limit for a denom. +message CapacityResult { + uint32 period_sec = 1; + bytes capacity = 2 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; +} + +// QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC +// method. +message QueryCapacityByDenomResponse { repeated CapacityResult results = 1; } diff --git a/proto/dydxprotocol/ibcratelimit/tx.proto b/proto/dydxprotocol/ibcratelimit/tx.proto new file mode 100644 index 0000000000..31c2cd1566 --- /dev/null +++ b/proto/dydxprotocol/ibcratelimit/tx.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package dydxprotocol.ibcratelimit; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/ibcratelimit/types"; + +import "cosmos/msg/v1/msg.proto"; +import "dydxprotocol/ibcratelimit/limit_params.proto"; + +// Msg defines the Msg service. +service Msg { + // SetLimitParams sets a `LimitParams` object in state. + rpc SetLimitParams(MsgSetLimitParams) returns (MsgSetLimitParamsResponse); + + // DeleteLimitParams removes a `LimitParams` object from state. + rpc DeleteLimitParams(MsgDeleteLimitParams) + returns (MsgDeleteLimitParamsResponse); +} + +// MsgSetLimitParams is the Msg/SetLimitParams request type. +message MsgSetLimitParams { + // The address that controls the module. + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1; + + // Defines the parameters to set. All parameters must be supplied. + LimitParams limit_params = 2; +} + +// MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. +message MsgSetLimitParamsResponse {} + +// MsgDeleteLimitParams is the Msg/SetLimitParams request type. +message MsgDeleteLimitParams { + // The address that controls the module. + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1; + + // The denom for which the `LimitParams` should be deleted. + string denom = 2; +} + +// MsgDeleteLimitParamsResponse is the Msg/DeleteLimitParams response type. +message MsgDeleteLimitParamsResponse {} diff --git a/protocol/x/ibcratelimit/types/capacity.pb.go b/protocol/x/ibcratelimit/types/capacity.pb.go new file mode 100644 index 0000000000..297758e751 --- /dev/null +++ b/protocol/x/ibcratelimit/types/capacity.pb.go @@ -0,0 +1,385 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ibcratelimit/capacity.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// DenomCapacity stores a list of rate limit capacity for a denom. +type DenomCapacity struct { + // denom is the denomination of the token being rate limited. + // e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // capacity_list is a list of capacity amount tracked for each `Limiter` + // on the denom. This list has a 1:1 mapping to `limiter` list under + // `LimitParams`. + CapacityList []github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,rep,name=capacity_list,json=capacityList,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"capacity_list"` +} + +func (m *DenomCapacity) Reset() { *m = DenomCapacity{} } +func (m *DenomCapacity) String() string { return proto.CompactTextString(m) } +func (*DenomCapacity) ProtoMessage() {} +func (*DenomCapacity) Descriptor() ([]byte, []int) { + return fileDescriptor_1790e9bf7712f620, []int{0} +} +func (m *DenomCapacity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomCapacity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomCapacity.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 *DenomCapacity) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomCapacity.Merge(m, src) +} +func (m *DenomCapacity) XXX_Size() int { + return m.Size() +} +func (m *DenomCapacity) XXX_DiscardUnknown() { + xxx_messageInfo_DenomCapacity.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomCapacity proto.InternalMessageInfo + +func (m *DenomCapacity) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func init() { + proto.RegisterType((*DenomCapacity)(nil), "dydxprotocol.ibcratelimit.DenomCapacity") +} + +func init() { + proto.RegisterFile("dydxprotocol/ibcratelimit/capacity.proto", fileDescriptor_1790e9bf7712f620) +} + +var fileDescriptor_1790e9bf7712f620 = []byte{ + // 236 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x48, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0xcf, 0x4c, 0x4a, 0x2e, 0x4a, 0x2c, 0x49, + 0xcd, 0xc9, 0xcc, 0xcd, 0x2c, 0xd1, 0x4f, 0x4e, 0x2c, 0x48, 0x4c, 0xce, 0x2c, 0xa9, 0xd4, 0x03, + 0x4b, 0x0b, 0x49, 0x22, 0xab, 0xd4, 0x43, 0x56, 0x29, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, + 0xd2, 0x07, 0xb1, 0x20, 0x1a, 0x94, 0xa6, 0x30, 0x72, 0xf1, 0xba, 0xa4, 0xe6, 0xe5, 0xe7, 0x3a, + 0x43, 0x0d, 0x12, 0x12, 0xe1, 0x62, 0x4d, 0x01, 0x09, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, + 0x41, 0x38, 0x42, 0xb9, 0x5c, 0xbc, 0x30, 0xab, 0xe2, 0x73, 0x32, 0x8b, 0x4b, 0x24, 0x98, 0x14, + 0x98, 0x35, 0x78, 0x9c, 0x3c, 0x4e, 0xdc, 0x93, 0x67, 0xb8, 0x75, 0x4f, 0xde, 0x21, 0x3d, 0xb3, + 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xc5, 0xb1, 0x65, 0x26, 0xba, 0xc9, 0x19, + 0x89, 0x99, 0x79, 0xfa, 0x70, 0x91, 0x94, 0x92, 0xca, 0x82, 0xd4, 0x62, 0xbd, 0xe0, 0xd4, 0xa2, + 0xcc, 0xc4, 0x9c, 0xcc, 0xaa, 0xc4, 0xa4, 0x9c, 0x54, 0xcf, 0xbc, 0x92, 0x20, 0x1e, 0x98, 0xf1, + 0x3e, 0x99, 0xc5, 0x25, 0x4e, 0x11, 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, 0x47, 0xbc, 0x4d, 0x15, 0xa8, 0x41, 0x05, 0xb6, 0x37, 0x89, 0x0d, 0x2c, 0x6d, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0xf2, 0x7f, 0xa7, 0xb7, 0x54, 0x01, 0x00, 0x00, +} + +func (m *DenomCapacity) 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 *DenomCapacity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomCapacity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CapacityList) > 0 { + for iNdEx := len(m.CapacityList) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.CapacityList[iNdEx].Size() + i -= size + if _, err := m.CapacityList[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCapacity(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintCapacity(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCapacity(dAtA []byte, offset int, v uint64) int { + offset -= sovCapacity(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DenomCapacity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovCapacity(uint64(l)) + } + if len(m.CapacityList) > 0 { + for _, e := range m.CapacityList { + l = e.Size() + n += 1 + l + sovCapacity(uint64(l)) + } + } + return n +} + +func sovCapacity(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCapacity(x uint64) (n int) { + return sovCapacity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DenomCapacity) 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 ErrIntOverflowCapacity + } + 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: DenomCapacity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCapacity + } + 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 ErrInvalidLengthCapacity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCapacity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CapacityList", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCapacity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCapacity + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCapacity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt + m.CapacityList = append(m.CapacityList, v) + if err := m.CapacityList[len(m.CapacityList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCapacity(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCapacity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCapacity(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, ErrIntOverflowCapacity + } + 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, ErrIntOverflowCapacity + } + 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, ErrIntOverflowCapacity + } + 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, ErrInvalidLengthCapacity + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCapacity + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCapacity + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCapacity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCapacity = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCapacity = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/ibcratelimit/types/genesis.pb.go b/protocol/x/ibcratelimit/types/genesis.pb.go new file mode 100644 index 0000000000..92f4d23e02 --- /dev/null +++ b/protocol/x/ibcratelimit/types/genesis.pb.go @@ -0,0 +1,334 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ibcratelimit/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + 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 + +// GenesisState defines the ibcratelimit module's genesis state. +type GenesisState struct { + // limit_params_list defines the list of `LimitParams` at genesis. + LimitParamsList []LimitParams `protobuf:"bytes,1,rep,name=limit_params_list,json=limitParamsList,proto3" json:"limit_params_list"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_fa1ff5707cde3652, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetLimitParamsList() []LimitParams { + if m != nil { + return m.LimitParamsList + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "dydxprotocol.ibcratelimit.GenesisState") +} + +func init() { + proto.RegisterFile("dydxprotocol/ibcratelimit/genesis.proto", fileDescriptor_fa1ff5707cde3652) +} + +var fileDescriptor_fa1ff5707cde3652 = []byte{ + // 219 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0xcf, 0x4c, 0x4a, 0x2e, 0x4a, 0x2c, 0x49, + 0xcd, 0xc9, 0xcc, 0xcd, 0x2c, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0xcb, + 0x0a, 0x49, 0x22, 0x2b, 0xd4, 0x43, 0x56, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd2, + 0x07, 0xb1, 0x20, 0x1a, 0xa4, 0x74, 0x70, 0x9b, 0x0c, 0x26, 0xe3, 0x0b, 0x12, 0x8b, 0x12, 0x73, + 0xa1, 0xc6, 0x2b, 0x65, 0x70, 0xf1, 0xb8, 0x43, 0xec, 0x0b, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x8a, + 0xe0, 0x12, 0x44, 0x56, 0x15, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x6d, + 0xa4, 0xa6, 0x87, 0xd3, 0x29, 0x7a, 0x3e, 0x20, 0x32, 0x00, 0xac, 0xc5, 0x89, 0xe5, 0xc4, 0x3d, + 0x79, 0x86, 0x20, 0xfe, 0x1c, 0x84, 0x90, 0x4f, 0x66, 0x71, 0x89, 0x53, 0xc4, 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, 0xd9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, + 0xe7, 0xe7, 0xea, 0xa3, 0x38, 0xbe, 0xcc, 0x44, 0x37, 0x39, 0x23, 0x31, 0x33, 0x4f, 0x1f, 0x2e, + 0x52, 0x81, 0xea, 0xa1, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xb4, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0xff, 0x02, 0xf6, 0x8a, 0x54, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LimitParamsList) > 0 { + for iNdEx := len(m.LimitParamsList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LimitParamsList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LimitParamsList) > 0 { + for _, e := range m.LimitParamsList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitParamsList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LimitParamsList = append(m.LimitParamsList, LimitParams{}) + if err := m.LimitParamsList[len(m.LimitParamsList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/ibcratelimit/types/limit_params.pb.go b/protocol/x/ibcratelimit/types/limit_params.pb.go new file mode 100644 index 0000000000..c90d500f5c --- /dev/null +++ b/protocol/x/ibcratelimit/types/limit_params.pb.go @@ -0,0 +1,640 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ibcratelimit/limit_params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// LimitParams defines rate limit params on a denom. +type LimitParams struct { + // denom is the denomination of the token being rate limited. + // e.g. ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5 + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // limiters is a list of rate-limiters on this denom. All limiters + // must be satified for a withdrawal to proceed. + Limiters []*Limiter `protobuf:"bytes,2,rep,name=limiters,proto3" json:"limiters,omitempty"` +} + +func (m *LimitParams) Reset() { *m = LimitParams{} } +func (m *LimitParams) String() string { return proto.CompactTextString(m) } +func (*LimitParams) ProtoMessage() {} +func (*LimitParams) Descriptor() ([]byte, []int) { + return fileDescriptor_9b1618a221d924d8, []int{0} +} +func (m *LimitParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LimitParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LimitParams.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 *LimitParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_LimitParams.Merge(m, src) +} +func (m *LimitParams) XXX_Size() int { + return m.Size() +} +func (m *LimitParams) XXX_DiscardUnknown() { + xxx_messageInfo_LimitParams.DiscardUnknown(m) +} + +var xxx_messageInfo_LimitParams proto.InternalMessageInfo + +func (m *LimitParams) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *LimitParams) GetLimiters() []*Limiter { + if m != nil { + return m.Limiters + } + return nil +} + +// Limiter defines one rate-limiter on a specfic denom. +type Limiter struct { + // period_sec is the rolling time period for which the limit applies + // e.g. 3600 (an hour) + PeriodSec uint32 `protobuf:"varint,2,opt,name=period_sec,json=periodSec,proto3" json:"period_sec,omitempty"` + // baseline_minimum is the minimum maximum withdrawal coin amount within the + // time period. + // e.g. 100_000_000_000 uusdc for 100k USDC; 5e22 adv4tnt for 50k DV4TNT + BaselineMinimum github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=baseline_minimum,json=baselineMinimum,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"baseline_minimum"` + // baseline_tvl_ppm is the maximum ratio of TVL withdrawable in + // the time period, in part-per-million. + // e.g. 100_000 (10%) + BaselineTvlPpm uint32 `protobuf:"varint,4,opt,name=baseline_tvl_ppm,json=baselineTvlPpm,proto3" json:"baseline_tvl_ppm,omitempty"` +} + +func (m *Limiter) Reset() { *m = Limiter{} } +func (m *Limiter) String() string { return proto.CompactTextString(m) } +func (*Limiter) ProtoMessage() {} +func (*Limiter) Descriptor() ([]byte, []int) { + return fileDescriptor_9b1618a221d924d8, []int{1} +} +func (m *Limiter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Limiter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Limiter.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 *Limiter) XXX_Merge(src proto.Message) { + xxx_messageInfo_Limiter.Merge(m, src) +} +func (m *Limiter) XXX_Size() int { + return m.Size() +} +func (m *Limiter) XXX_DiscardUnknown() { + xxx_messageInfo_Limiter.DiscardUnknown(m) +} + +var xxx_messageInfo_Limiter proto.InternalMessageInfo + +func (m *Limiter) GetPeriodSec() uint32 { + if m != nil { + return m.PeriodSec + } + return 0 +} + +func (m *Limiter) GetBaselineTvlPpm() uint32 { + if m != nil { + return m.BaselineTvlPpm + } + return 0 +} + +func init() { + proto.RegisterType((*LimitParams)(nil), "dydxprotocol.ibcratelimit.LimitParams") + proto.RegisterType((*Limiter)(nil), "dydxprotocol.ibcratelimit.Limiter") +} + +func init() { + proto.RegisterFile("dydxprotocol/ibcratelimit/limit_params.proto", fileDescriptor_9b1618a221d924d8) +} + +var fileDescriptor_9b1618a221d924d8 = []byte{ + // 329 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0xcf, 0x4b, 0xfb, 0x30, + 0x1c, 0x6d, 0xb6, 0xef, 0x57, 0x5d, 0xe6, 0x2f, 0xca, 0x0e, 0x55, 0xb0, 0x2b, 0x3b, 0xf5, 0xa0, + 0x2d, 0xa8, 0xe7, 0x21, 0x3b, 0x29, 0x4c, 0x18, 0x9d, 0x07, 0xf1, 0x52, 0xd2, 0x34, 0x6c, 0x81, + 0xa4, 0x09, 0x4d, 0x36, 0x36, 0xff, 0x0a, 0xff, 0x2b, 0x77, 0xdc, 0x51, 0x3c, 0x0c, 0xd9, 0xfe, + 0x11, 0x59, 0xea, 0x46, 0x77, 0x10, 0xbc, 0x84, 0xe4, 0xbd, 0xf7, 0x79, 0xef, 0x91, 0x0f, 0xbc, + 0x4c, 0xa7, 0xe9, 0x44, 0xe6, 0x42, 0x0b, 0x2c, 0x58, 0x48, 0x13, 0x9c, 0x23, 0x4d, 0x18, 0xe5, + 0x54, 0x87, 0xe6, 0x8c, 0x25, 0xca, 0x11, 0x57, 0x81, 0x91, 0xd8, 0x67, 0x65, 0x75, 0x50, 0x56, + 0x9f, 0x37, 0x06, 0x62, 0x20, 0x0c, 0x15, 0xae, 0x6f, 0xc5, 0x40, 0x0b, 0xc3, 0x7a, 0x77, 0x4d, + 0xf7, 0x8c, 0x8b, 0xdd, 0x80, 0xff, 0x53, 0x92, 0x09, 0xee, 0x00, 0x0f, 0xf8, 0xb5, 0xa8, 0x78, + 0xd8, 0x6d, 0x78, 0x60, 0x3c, 0x48, 0xae, 0x9c, 0x8a, 0x57, 0xf5, 0xeb, 0xd7, 0xad, 0xe0, 0xd7, + 0xa0, 0xa0, 0x5b, 0x48, 0xa3, 0xed, 0x4c, 0xeb, 0x1d, 0xc0, 0xfd, 0x1f, 0xd4, 0xbe, 0x80, 0x50, + 0x92, 0x9c, 0x8a, 0x34, 0x56, 0x04, 0x3b, 0x15, 0x0f, 0xf8, 0x47, 0x51, 0xad, 0x40, 0xfa, 0x04, + 0xdb, 0x0a, 0x9e, 0x26, 0x48, 0x11, 0x46, 0x33, 0x12, 0x73, 0x9a, 0x51, 0x3e, 0xe2, 0x4e, 0xd5, + 0x03, 0xfe, 0x61, 0xe7, 0x7e, 0xb6, 0x68, 0x5a, 0x9f, 0x8b, 0xe6, 0xdd, 0x80, 0xea, 0xe1, 0x28, + 0x09, 0xb0, 0xe0, 0xe1, 0xce, 0xdf, 0x8c, 0x6f, 0xaf, 0xf0, 0x10, 0xd1, 0x2c, 0xdc, 0x22, 0xa9, + 0x9e, 0x4a, 0xa2, 0x82, 0x3e, 0xc9, 0x29, 0x62, 0xf4, 0x15, 0x25, 0x8c, 0x3c, 0x64, 0x3a, 0x3a, + 0xd9, 0x24, 0x3c, 0x16, 0x01, 0xb6, 0x5f, 0x0a, 0xd5, 0x63, 0x16, 0x4b, 0xc9, 0x9d, 0x7f, 0xa6, + 0xd9, 0xf1, 0x06, 0x7f, 0x1a, 0xb3, 0x9e, 0xe4, 0x9d, 0xe7, 0xd9, 0xd2, 0x05, 0xf3, 0xa5, 0x0b, + 0xbe, 0x96, 0x2e, 0x78, 0x5b, 0xb9, 0xd6, 0x7c, 0xe5, 0x5a, 0x1f, 0x2b, 0xd7, 0x7a, 0x69, 0xff, + 0xbd, 0xd6, 0x64, 0x77, 0x8d, 0xa6, 0x64, 0xb2, 0x67, 0xe8, 0x9b, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xc0, 0x7d, 0x29, 0xe5, 0xf0, 0x01, 0x00, 0x00, +} + +func (m *LimitParams) 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 *LimitParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LimitParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Limiters) > 0 { + for iNdEx := len(m.Limiters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Limiters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLimitParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintLimitParams(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Limiter) 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 *Limiter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Limiter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BaselineTvlPpm != 0 { + i = encodeVarintLimitParams(dAtA, i, uint64(m.BaselineTvlPpm)) + i-- + dAtA[i] = 0x20 + } + { + size := m.BaselineMinimum.Size() + i -= size + if _, err := m.BaselineMinimum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLimitParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.PeriodSec != 0 { + i = encodeVarintLimitParams(dAtA, i, uint64(m.PeriodSec)) + i-- + dAtA[i] = 0x10 + } + return len(dAtA) - i, nil +} + +func encodeVarintLimitParams(dAtA []byte, offset int, v uint64) int { + offset -= sovLimitParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LimitParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovLimitParams(uint64(l)) + } + if len(m.Limiters) > 0 { + for _, e := range m.Limiters { + l = e.Size() + n += 1 + l + sovLimitParams(uint64(l)) + } + } + return n +} + +func (m *Limiter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PeriodSec != 0 { + n += 1 + sovLimitParams(uint64(m.PeriodSec)) + } + l = m.BaselineMinimum.Size() + n += 1 + l + sovLimitParams(uint64(l)) + if m.BaselineTvlPpm != 0 { + n += 1 + sovLimitParams(uint64(m.BaselineTvlPpm)) + } + return n +} + +func sovLimitParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLimitParams(x uint64) (n int) { + return sovLimitParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LimitParams) 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 ErrIntOverflowLimitParams + } + 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: LimitParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LimitParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLimitParams + } + 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 ErrInvalidLengthLimitParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLimitParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Limiters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLimitParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLimitParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLimitParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Limiters = append(m.Limiters, &Limiter{}) + if err := m.Limiters[len(m.Limiters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLimitParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLimitParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Limiter) 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 ErrIntOverflowLimitParams + } + 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: Limiter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Limiter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PeriodSec", wireType) + } + m.PeriodSec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLimitParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PeriodSec |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaselineMinimum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLimitParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthLimitParams + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthLimitParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BaselineMinimum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BaselineTvlPpm", wireType) + } + m.BaselineTvlPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLimitParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BaselineTvlPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLimitParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLimitParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLimitParams(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, ErrIntOverflowLimitParams + } + 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, ErrIntOverflowLimitParams + } + 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, ErrIntOverflowLimitParams + } + 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, ErrInvalidLengthLimitParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLimitParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLimitParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLimitParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLimitParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLimitParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/ibcratelimit/types/query.pb.go b/protocol/x/ibcratelimit/types/query.pb.go new file mode 100644 index 0000000000..e25ae72262 --- /dev/null +++ b/protocol/x/ibcratelimit/types/query.pb.go @@ -0,0 +1,1148 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ibcratelimit/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" + 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. +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 + +// ListLimitParamsRequest is a request type of the ListLimitParams RPC method. +type ListLimitParamsRequest struct { +} + +func (m *ListLimitParamsRequest) Reset() { *m = ListLimitParamsRequest{} } +func (m *ListLimitParamsRequest) String() string { return proto.CompactTextString(m) } +func (*ListLimitParamsRequest) ProtoMessage() {} +func (*ListLimitParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e49fb82b9f3fb8a9, []int{0} +} +func (m *ListLimitParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListLimitParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListLimitParamsRequest.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 *ListLimitParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListLimitParamsRequest.Merge(m, src) +} +func (m *ListLimitParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *ListLimitParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListLimitParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListLimitParamsRequest proto.InternalMessageInfo + +// ListLimitParamsResponse is a response type of the ListLimitParams RPC method. +type ListLimitParamsResponse struct { + LimitParamsList []*LimitParams `protobuf:"bytes,1,rep,name=limit_params_list,json=limitParamsList,proto3" json:"limit_params_list,omitempty"` +} + +func (m *ListLimitParamsResponse) Reset() { *m = ListLimitParamsResponse{} } +func (m *ListLimitParamsResponse) String() string { return proto.CompactTextString(m) } +func (*ListLimitParamsResponse) ProtoMessage() {} +func (*ListLimitParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e49fb82b9f3fb8a9, []int{1} +} +func (m *ListLimitParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ListLimitParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ListLimitParamsResponse.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 *ListLimitParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListLimitParamsResponse.Merge(m, src) +} +func (m *ListLimitParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *ListLimitParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListLimitParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListLimitParamsResponse proto.InternalMessageInfo + +func (m *ListLimitParamsResponse) GetLimitParamsList() []*LimitParams { + if m != nil { + return m.LimitParamsList + } + return nil +} + +// QueryCapacityByDenomRequest is a request type for the CapacityByDenom RPC +// method. +type QueryCapacityByDenomRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryCapacityByDenomRequest) Reset() { *m = QueryCapacityByDenomRequest{} } +func (m *QueryCapacityByDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCapacityByDenomRequest) ProtoMessage() {} +func (*QueryCapacityByDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e49fb82b9f3fb8a9, []int{2} +} +func (m *QueryCapacityByDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCapacityByDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCapacityByDenomRequest.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 *QueryCapacityByDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCapacityByDenomRequest.Merge(m, src) +} +func (m *QueryCapacityByDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCapacityByDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCapacityByDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCapacityByDenomRequest proto.InternalMessageInfo + +func (m *QueryCapacityByDenomRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// CapacityResult is a specific rate limit for a denom. +type CapacityResult struct { + PeriodSec uint32 `protobuf:"varint,1,opt,name=period_sec,json=periodSec,proto3" json:"period_sec,omitempty"` + Capacity github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=capacity,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"capacity"` +} + +func (m *CapacityResult) Reset() { *m = CapacityResult{} } +func (m *CapacityResult) String() string { return proto.CompactTextString(m) } +func (*CapacityResult) ProtoMessage() {} +func (*CapacityResult) Descriptor() ([]byte, []int) { + return fileDescriptor_e49fb82b9f3fb8a9, []int{3} +} +func (m *CapacityResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CapacityResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CapacityResult.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 *CapacityResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_CapacityResult.Merge(m, src) +} +func (m *CapacityResult) XXX_Size() int { + return m.Size() +} +func (m *CapacityResult) XXX_DiscardUnknown() { + xxx_messageInfo_CapacityResult.DiscardUnknown(m) +} + +var xxx_messageInfo_CapacityResult proto.InternalMessageInfo + +func (m *CapacityResult) GetPeriodSec() uint32 { + if m != nil { + return m.PeriodSec + } + return 0 +} + +// QueryCapacityByDenomResponse is a response type of the CapacityByDenom RPC +// method. +type QueryCapacityByDenomResponse struct { + Results []*CapacityResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *QueryCapacityByDenomResponse) Reset() { *m = QueryCapacityByDenomResponse{} } +func (m *QueryCapacityByDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCapacityByDenomResponse) ProtoMessage() {} +func (*QueryCapacityByDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e49fb82b9f3fb8a9, []int{4} +} +func (m *QueryCapacityByDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCapacityByDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCapacityByDenomResponse.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 *QueryCapacityByDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCapacityByDenomResponse.Merge(m, src) +} +func (m *QueryCapacityByDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCapacityByDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCapacityByDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCapacityByDenomResponse proto.InternalMessageInfo + +func (m *QueryCapacityByDenomResponse) GetResults() []*CapacityResult { + if m != nil { + return m.Results + } + return nil +} + +func init() { + proto.RegisterType((*ListLimitParamsRequest)(nil), "dydxprotocol.ibcratelimit.ListLimitParamsRequest") + proto.RegisterType((*ListLimitParamsResponse)(nil), "dydxprotocol.ibcratelimit.ListLimitParamsResponse") + proto.RegisterType((*QueryCapacityByDenomRequest)(nil), "dydxprotocol.ibcratelimit.QueryCapacityByDenomRequest") + proto.RegisterType((*CapacityResult)(nil), "dydxprotocol.ibcratelimit.CapacityResult") + proto.RegisterType((*QueryCapacityByDenomResponse)(nil), "dydxprotocol.ibcratelimit.QueryCapacityByDenomResponse") +} + +func init() { + proto.RegisterFile("dydxprotocol/ibcratelimit/query.proto", fileDescriptor_e49fb82b9f3fb8a9) +} + +var fileDescriptor_e49fb82b9f3fb8a9 = []byte{ + // 426 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0xab, 0xd3, 0x40, + 0x14, 0xcd, 0x3c, 0x79, 0xea, 0x1b, 0x3f, 0x8a, 0xc3, 0x43, 0x63, 0xd4, 0xbc, 0x12, 0x50, 0x2a, + 0x68, 0x82, 0xad, 0xe8, 0x4e, 0xa4, 0x75, 0xa1, 0xd0, 0x85, 0xa6, 0x1b, 0x71, 0x53, 0x26, 0x93, + 0xa1, 0x1d, 0x48, 0x32, 0x69, 0x66, 0x22, 0x8d, 0x4b, 0x17, 0xae, 0xdd, 0xf8, 0x9f, 0xba, 0xec, + 0x52, 0x5c, 0x14, 0x69, 0xff, 0x88, 0x64, 0x92, 0xd6, 0xb4, 0xb6, 0xc1, 0x6e, 0x42, 0xee, 0x9c, + 0x7b, 0xce, 0xdc, 0x73, 0x0f, 0x03, 0x1f, 0xfa, 0x99, 0x3f, 0x8d, 0x13, 0x2e, 0x39, 0xe1, 0x81, + 0xc3, 0x3c, 0x92, 0x60, 0x49, 0x03, 0x16, 0x32, 0xe9, 0x4c, 0x52, 0x9a, 0x64, 0xb6, 0xc2, 0xd0, + 0xdd, 0x6a, 0x9b, 0x5d, 0x6d, 0x33, 0xce, 0x47, 0x7c, 0xc4, 0x15, 0xe4, 0xe4, 0x7f, 0x05, 0xc1, + 0x78, 0x72, 0x58, 0x57, 0x7d, 0x87, 0x31, 0x4e, 0x70, 0x28, 0x8a, 0x6e, 0x4b, 0x87, 0xb7, 0xfb, + 0x4c, 0xc8, 0x7e, 0x8e, 0xbc, 0x57, 0x80, 0x4b, 0x27, 0x29, 0x15, 0xd2, 0x0a, 0xe1, 0x9d, 0x7f, + 0x10, 0x11, 0xf3, 0x48, 0x50, 0xe4, 0xc2, 0x5b, 0x55, 0xa9, 0x61, 0xc0, 0x84, 0xd4, 0x41, 0xf3, + 0x52, 0xeb, 0x5a, 0xfb, 0x91, 0x7d, 0x70, 0x5e, 0xbb, 0x2a, 0xd5, 0x08, 0xfe, 0x16, 0xf9, 0x35, + 0x56, 0x07, 0xde, 0xfb, 0x90, 0xdb, 0xee, 0xe1, 0x18, 0x13, 0x26, 0xb3, 0x6e, 0xf6, 0x86, 0x46, + 0x3c, 0x2c, 0xa7, 0x41, 0xe7, 0xf0, 0xd4, 0xcf, 0x6b, 0x1d, 0x34, 0x41, 0xeb, 0xcc, 0x2d, 0x0a, + 0xeb, 0x07, 0x80, 0x37, 0xd7, 0x04, 0x97, 0x8a, 0x34, 0x90, 0xe8, 0x01, 0x84, 0x31, 0x4d, 0x18, + 0xf7, 0x87, 0x82, 0x12, 0xd5, 0x7d, 0xc3, 0x3d, 0x2b, 0x4e, 0x06, 0x94, 0x20, 0x1f, 0x5e, 0x25, + 0x25, 0x41, 0x3f, 0x69, 0x82, 0xd6, 0xf5, 0xee, 0xdb, 0xd9, 0xe2, 0x42, 0xfb, 0xb5, 0xb8, 0x78, + 0x3d, 0x62, 0x72, 0x9c, 0x7a, 0x36, 0xe1, 0xa1, 0xb3, 0xb5, 0xc2, 0xcf, 0xcf, 0x9f, 0x92, 0x31, + 0x66, 0x91, 0xb3, 0x39, 0xf1, 0x65, 0x16, 0x53, 0x61, 0x0f, 0x68, 0xc2, 0x70, 0xc0, 0xbe, 0x60, + 0x2f, 0xa0, 0xef, 0x22, 0xe9, 0x6e, 0x94, 0x2d, 0x02, 0xef, 0xef, 0x37, 0x53, 0x2e, 0xb0, 0x07, + 0xaf, 0x24, 0x6a, 0x5c, 0x51, 0xae, 0xed, 0x71, 0xcd, 0xda, 0xb6, 0x0d, 0xba, 0x6b, 0x66, 0xfb, + 0xdb, 0x09, 0x3c, 0x55, 0xb7, 0xa0, 0x29, 0x6c, 0xec, 0x44, 0x85, 0x9e, 0xd5, 0xe6, 0xb0, 0x2f, + 0x70, 0xa3, 0x7d, 0x0c, 0xa5, 0x34, 0xf2, 0x15, 0xc0, 0xc6, 0x8e, 0x49, 0xf4, 0xa2, 0x46, 0xa7, + 0x26, 0x62, 0xe3, 0xe5, 0xd1, 0xbc, 0x62, 0x88, 0xee, 0xc7, 0xd9, 0xd2, 0x04, 0xf3, 0xa5, 0x09, + 0x7e, 0x2f, 0x4d, 0xf0, 0x7d, 0x65, 0x6a, 0xf3, 0x95, 0xa9, 0xfd, 0x5c, 0x99, 0xda, 0xa7, 0x57, + 0xff, 0x9f, 0xe9, 0x74, 0xfb, 0xa9, 0xa8, 0x84, 0xbd, 0xcb, 0x0a, 0xee, 0xfc, 0x09, 0x00, 0x00, + 0xff, 0xff, 0x7b, 0x03, 0x31, 0xdf, 0xac, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// 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 { + // List all limit params. + ListLimitParams(ctx context.Context, in *ListLimitParamsRequest, opts ...grpc.CallOption) (*ListLimitParamsResponse, error) + // Query capacity by denom. + CapacityByDenom(ctx context.Context, in *QueryCapacityByDenomRequest, opts ...grpc.CallOption) (*QueryCapacityByDenomResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) ListLimitParams(ctx context.Context, in *ListLimitParamsRequest, opts ...grpc.CallOption) (*ListLimitParamsResponse, error) { + out := new(ListLimitParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ibcratelimit.Query/ListLimitParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CapacityByDenom(ctx context.Context, in *QueryCapacityByDenomRequest, opts ...grpc.CallOption) (*QueryCapacityByDenomResponse, error) { + out := new(QueryCapacityByDenomResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ibcratelimit.Query/CapacityByDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // List all limit params. + ListLimitParams(context.Context, *ListLimitParamsRequest) (*ListLimitParamsResponse, error) + // Query capacity by denom. + CapacityByDenom(context.Context, *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) ListLimitParams(ctx context.Context, req *ListLimitParamsRequest) (*ListLimitParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListLimitParams not implemented") +} +func (*UnimplementedQueryServer) CapacityByDenom(ctx context.Context, req *QueryCapacityByDenomRequest) (*QueryCapacityByDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CapacityByDenom not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_ListLimitParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListLimitParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ListLimitParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.ibcratelimit.Query/ListLimitParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ListLimitParams(ctx, req.(*ListLimitParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CapacityByDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCapacityByDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CapacityByDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.ibcratelimit.Query/CapacityByDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CapacityByDenom(ctx, req.(*QueryCapacityByDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.ibcratelimit.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListLimitParams", + Handler: _Query_ListLimitParams_Handler, + }, + { + MethodName: "CapacityByDenom", + Handler: _Query_CapacityByDenom_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/ibcratelimit/query.proto", +} + +func (m *ListLimitParamsRequest) 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 *ListLimitParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListLimitParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ListLimitParamsResponse) 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 *ListLimitParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ListLimitParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LimitParamsList) > 0 { + for iNdEx := len(m.LimitParamsList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LimitParamsList[iNdEx].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 (m *QueryCapacityByDenomRequest) 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 *QueryCapacityByDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCapacityByDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CapacityResult) 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 *CapacityResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CapacityResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Capacity.Size() + i -= size + if _, err := m.Capacity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.PeriodSec != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PeriodSec)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCapacityByDenomResponse) 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 *QueryCapacityByDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCapacityByDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].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 *ListLimitParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ListLimitParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LimitParamsList) > 0 { + for _, e := range m.LimitParamsList { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryCapacityByDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *CapacityResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PeriodSec != 0 { + n += 1 + sovQuery(uint64(m.PeriodSec)) + } + l = m.Capacity.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryCapacityByDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.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 *ListLimitParamsRequest) 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: ListLimitParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListLimitParamsRequest: 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 *ListLimitParamsResponse) 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: ListLimitParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListLimitParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitParamsList", 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 + } + m.LimitParamsList = append(m.LimitParamsList, &LimitParams{}) + if err := m.LimitParamsList[len(m.LimitParamsList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCapacityByDenomRequest) 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: QueryCapacityByDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCapacityByDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CapacityResult) 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: CapacityResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CapacityResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PeriodSec", wireType) + } + m.PeriodSec = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PeriodSec |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCapacityByDenomResponse) 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: QueryCapacityByDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCapacityByDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Results", 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 + } + m.Results = append(m.Results, &CapacityResult{}) + if err := m.Results[len(m.Results)-1].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/ibcratelimit/types/tx.pb.go b/protocol/x/ibcratelimit/types/tx.pb.go new file mode 100644 index 0000000000..44e6324d94 --- /dev/null +++ b/protocol/x/ibcratelimit/types/tx.pb.go @@ -0,0 +1,978 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/ibcratelimit/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + 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. +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 + +// MsgSetLimitParams is the Msg/SetLimitParams request type. +type MsgSetLimitParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // Defines the parameters to set. All parameters must be supplied. + LimitParams *LimitParams `protobuf:"bytes,2,opt,name=limit_params,json=limitParams,proto3" json:"limit_params,omitempty"` +} + +func (m *MsgSetLimitParams) Reset() { *m = MsgSetLimitParams{} } +func (m *MsgSetLimitParams) String() string { return proto.CompactTextString(m) } +func (*MsgSetLimitParams) ProtoMessage() {} +func (*MsgSetLimitParams) Descriptor() ([]byte, []int) { + return fileDescriptor_a419c53765e30c3b, []int{0} +} +func (m *MsgSetLimitParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetLimitParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetLimitParams.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 *MsgSetLimitParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetLimitParams.Merge(m, src) +} +func (m *MsgSetLimitParams) XXX_Size() int { + return m.Size() +} +func (m *MsgSetLimitParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetLimitParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetLimitParams proto.InternalMessageInfo + +func (m *MsgSetLimitParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgSetLimitParams) GetLimitParams() *LimitParams { + if m != nil { + return m.LimitParams + } + return nil +} + +// MsgSetLimitParamsResponse is the Msg/SetLimitParams response type. +type MsgSetLimitParamsResponse struct { +} + +func (m *MsgSetLimitParamsResponse) Reset() { *m = MsgSetLimitParamsResponse{} } +func (m *MsgSetLimitParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetLimitParamsResponse) ProtoMessage() {} +func (*MsgSetLimitParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a419c53765e30c3b, []int{1} +} +func (m *MsgSetLimitParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetLimitParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetLimitParamsResponse.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 *MsgSetLimitParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetLimitParamsResponse.Merge(m, src) +} +func (m *MsgSetLimitParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetLimitParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetLimitParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetLimitParamsResponse proto.InternalMessageInfo + +// MsgDeleteLimitParams is the Msg/SetLimitParams request type. +type MsgDeleteLimitParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The denom for which the `LimitParams` should be deleted. + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *MsgDeleteLimitParams) Reset() { *m = MsgDeleteLimitParams{} } +func (m *MsgDeleteLimitParams) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteLimitParams) ProtoMessage() {} +func (*MsgDeleteLimitParams) Descriptor() ([]byte, []int) { + return fileDescriptor_a419c53765e30c3b, []int{2} +} +func (m *MsgDeleteLimitParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteLimitParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteLimitParams.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 *MsgDeleteLimitParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteLimitParams.Merge(m, src) +} +func (m *MsgDeleteLimitParams) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteLimitParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteLimitParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteLimitParams proto.InternalMessageInfo + +func (m *MsgDeleteLimitParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgDeleteLimitParams) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// MsgDeleteLimitParamsResponse is the Msg/DeleteLimitParams response type. +type MsgDeleteLimitParamsResponse struct { +} + +func (m *MsgDeleteLimitParamsResponse) Reset() { *m = MsgDeleteLimitParamsResponse{} } +func (m *MsgDeleteLimitParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteLimitParamsResponse) ProtoMessage() {} +func (*MsgDeleteLimitParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a419c53765e30c3b, []int{3} +} +func (m *MsgDeleteLimitParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteLimitParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteLimitParamsResponse.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 *MsgDeleteLimitParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteLimitParamsResponse.Merge(m, src) +} +func (m *MsgDeleteLimitParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteLimitParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteLimitParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteLimitParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetLimitParams)(nil), "dydxprotocol.ibcratelimit.MsgSetLimitParams") + proto.RegisterType((*MsgSetLimitParamsResponse)(nil), "dydxprotocol.ibcratelimit.MsgSetLimitParamsResponse") + proto.RegisterType((*MsgDeleteLimitParams)(nil), "dydxprotocol.ibcratelimit.MsgDeleteLimitParams") + proto.RegisterType((*MsgDeleteLimitParamsResponse)(nil), "dydxprotocol.ibcratelimit.MsgDeleteLimitParamsResponse") +} + +func init() { + proto.RegisterFile("dydxprotocol/ibcratelimit/tx.proto", fileDescriptor_a419c53765e30c3b) +} + +var fileDescriptor_a419c53765e30c3b = []byte{ + // 336 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, 0x4c, 0x4a, 0x2e, 0x4a, 0x2c, 0x49, + 0xcd, 0xc9, 0xcc, 0xcd, 0x2c, 0xd1, 0x2f, 0xa9, 0xd0, 0x03, 0x4b, 0x08, 0x49, 0x22, 0xab, 0xd1, + 0x43, 0x56, 0x23, 0x25, 0x9e, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0xae, 0x5f, + 0x66, 0x08, 0xa2, 0x20, 0x7a, 0xa4, 0x74, 0x70, 0x9b, 0x0b, 0x26, 0xe3, 0x0b, 0x12, 0x8b, 0x12, + 0x73, 0x8b, 0x21, 0xaa, 0x95, 0x7a, 0x18, 0xb9, 0x04, 0x7d, 0x8b, 0xd3, 0x83, 0x53, 0x4b, 0x7c, + 0x40, 0x92, 0x01, 0x60, 0x39, 0x21, 0x19, 0x2e, 0xce, 0xc4, 0xd2, 0x92, 0x8c, 0xfc, 0xa2, 0xcc, + 0x92, 0x4a, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x84, 0x80, 0x90, 0x27, 0x17, 0x0f, 0xb2, + 0x49, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x6a, 0x7a, 0x38, 0x1d, 0xab, 0x87, 0x64, 0x76, + 0x10, 0x77, 0x0e, 0x82, 0x63, 0xc5, 0xd7, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x68, 0x25, 0x69, 0x2e, + 0x49, 0x0c, 0xd7, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0x45, 0x71, 0x89, 0xf8, + 0x16, 0xa7, 0xbb, 0xa4, 0xe6, 0xa4, 0x96, 0xa4, 0x12, 0xef, 0x5a, 0x11, 0x2e, 0xd6, 0x94, 0xd4, + 0xbc, 0xfc, 0x5c, 0xb0, 0x33, 0x39, 0x83, 0x20, 0x1c, 0x0c, 0x8b, 0xe5, 0xb8, 0x64, 0xb0, 0x99, + 0x0d, 0xb3, 0xdb, 0xe8, 0x17, 0x23, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x09, 0x17, 0x1f, 0x5a, + 0x58, 0xe9, 0xe0, 0xf1, 0x37, 0x86, 0x5f, 0xa4, 0x4c, 0x48, 0x51, 0x0d, 0xb3, 0x5d, 0xa8, 0x96, + 0x4b, 0x10, 0xd3, 0xdb, 0xfa, 0xf8, 0x8d, 0xc2, 0xd0, 0x20, 0x65, 0x4e, 0xa2, 0x06, 0x98, 0xf5, + 0x4e, 0x11, 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, 0x97, 0x9e, 0x59, + 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0x92, 0xee, 0xca, 0x4c, 0x74, 0x93, 0x33, + 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x68, 0x69, 0xbc, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0x2c, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x57, 0x42, 0x04, 0xf6, 0x0d, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// 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 { + // SetLimitParams sets a `LimitParams` object in state. + SetLimitParams(ctx context.Context, in *MsgSetLimitParams, opts ...grpc.CallOption) (*MsgSetLimitParamsResponse, error) + // DeleteLimitParams removes a `LimitParams` object from state. + DeleteLimitParams(ctx context.Context, in *MsgDeleteLimitParams, opts ...grpc.CallOption) (*MsgDeleteLimitParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SetLimitParams(ctx context.Context, in *MsgSetLimitParams, opts ...grpc.CallOption) (*MsgSetLimitParamsResponse, error) { + out := new(MsgSetLimitParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ibcratelimit.Msg/SetLimitParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeleteLimitParams(ctx context.Context, in *MsgDeleteLimitParams, opts ...grpc.CallOption) (*MsgDeleteLimitParamsResponse, error) { + out := new(MsgDeleteLimitParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.ibcratelimit.Msg/DeleteLimitParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SetLimitParams sets a `LimitParams` object in state. + SetLimitParams(context.Context, *MsgSetLimitParams) (*MsgSetLimitParamsResponse, error) + // DeleteLimitParams removes a `LimitParams` object from state. + DeleteLimitParams(context.Context, *MsgDeleteLimitParams) (*MsgDeleteLimitParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SetLimitParams(ctx context.Context, req *MsgSetLimitParams) (*MsgSetLimitParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetLimitParams not implemented") +} +func (*UnimplementedMsgServer) DeleteLimitParams(ctx context.Context, req *MsgDeleteLimitParams) (*MsgDeleteLimitParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteLimitParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SetLimitParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetLimitParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetLimitParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.ibcratelimit.Msg/SetLimitParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetLimitParams(ctx, req.(*MsgSetLimitParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeleteLimitParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeleteLimitParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeleteLimitParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.ibcratelimit.Msg/DeleteLimitParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeleteLimitParams(ctx, req.(*MsgDeleteLimitParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.ibcratelimit.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetLimitParams", + Handler: _Msg_SetLimitParams_Handler, + }, + { + MethodName: "DeleteLimitParams", + Handler: _Msg_DeleteLimitParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/ibcratelimit/tx.proto", +} + +func (m *MsgSetLimitParams) 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 *MsgSetLimitParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetLimitParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LimitParams != nil { + { + size, err := m.LimitParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetLimitParamsResponse) 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 *MsgSetLimitParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetLimitParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeleteLimitParams) 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 *MsgDeleteLimitParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteLimitParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDeleteLimitParamsResponse) 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 *MsgDeleteLimitParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteLimitParamsResponse) 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 *MsgSetLimitParams) 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.LimitParams != nil { + l = m.LimitParams.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetLimitParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeleteLimitParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDeleteLimitParamsResponse) 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 *MsgSetLimitParams) 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: MsgSetLimitParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetLimitParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LimitParams == nil { + m.LimitParams = &LimitParams{} + } + if err := m.LimitParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetLimitParamsResponse) 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: MsgSetLimitParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetLimitParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeleteLimitParams) 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: MsgDeleteLimitParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteLimitParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeleteLimitParamsResponse) 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: MsgDeleteLimitParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteLimitParamsResponse: 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") +)