diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml new file mode 100644 index 000000000..f13c6bb6d --- /dev/null +++ b/client/docs/swagger-ui/swagger.yaml @@ -0,0 +1,3891 @@ +swagger: '2.0' +info: + title: Cosmos SDK Liquidity Module - REST and gRPC Gateway docs + description: 'A REST interface for state queries, transactions' + version: 2.2.1 +paths: + /tendermint/liquidity/v1beta1/params: + get: + summary: Get all parameters of the liquidity module. + description: It returns all parameters of the liquidity module. + operationId: LiquidityQueries + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + pool_types: + type: array + items: + type: object + properties: + id: + type: integer + format: uint32 + example: '1' + title: >- + The id of the pool_type to use as pool_type_id for + pool creation. + + Only pool-type-id 1 is supported + + {"id":1,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""} + name: + type: string + example: ConstantProductLiquidityPool + title: name of the pool type + min_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + min number of reserveCoins for LiquidityPoolType + only 2 is allowed on this spec + max_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + max number of reserveCoins for LiquidityPoolType + only 2 is allowed on this spec + description: + type: string + title: description of the pool type + title: >- + Structure for the pool type to distinguish the + characteristics of the reserve pools + title: list of available pool types + min_init_deposit_amount: + type: string + format: sdk.Int + example: '1000000' + title: >- + Minimum number of coins to be deposited to the liquidity + pool upon pool creation + init_pool_coin_mint_amount: + type: string + format: sdk.Int + example: '1000000' + title: Initial mint amount of pool coin upon pool creation + max_reserve_coin_amount: + type: string + format: sdk.Int + example: '1000000000000' + title: >- + Limit the size of each liquidity pool in the beginning + phase of Liquidity Module adoption to minimize risk, 0 + means no limit + pool_creation_fee: + type: array + format: sdk.Coins + example: + - denom: uatom + amount: '100000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Fee to create a Liquidity Pool. + swap_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: Swap fee rate for every executed swap + withdraw_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: >- + Reserve coin withdrawal with less proportion by + withdrawFeeRate + max_order_amount_ratio: + type: string + format: sdk.Dec + example: '0.003' + title: >- + Maximum ratio of reserve coins that can be ordered at a + swap order + unit_batch_height: + type: integer + format: uint32 + example: '1' + title: The smallest unit batch height for every liquidity pool + description: >- + the response type for the QueryParamsResponse RPC method. This + includes current parameter of the liquidity module. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + externalDocs: + description: Find out more about the params + url: >- + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/08_params.md + /tendermint/liquidity/v1beta1/pools: + get: + summary: Get existing liquidity pools. + description: It returns list of all liquidity pools with pagination result. + operationId: LiquidityPools + responses: + '200': + description: A successful response. + schema: + type: object + properties: + pools: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + example: '1' + title: id of the pool + type_id: + type: integer + format: uint32 + example: '1' + title: id of the pool_type + reserve_coin_denoms: + type: array + example: + - denomX + - denomY + items: + type: string + title: denoms of reserve coin pair of the pool + reserve_account_address: + type: string + format: sdk.AccAddress + example: cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3 + title: reserve account address of the pool + pool_coin_denom: + type: string + example: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + title: denom of pool coin of the pool + title: The liquidity pool information + pagination: + description: >- + pagination defines the pagination in the response. not working + on this version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryLiquidityPoolsResponse RPC method. + This includes list of all liquidity pools currently existed and + paging results containing next_key and total count. + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = There are no pools present.: + key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}': + get: + summary: Get specific liquidity pool. + description: It returns the liquidity pool corresponding to the pool_id. + operationId: LiquidityPool + responses: + '200': + description: A successful response. + schema: + type: object + properties: + pool: + type: object + properties: + id: + type: string + format: uint64 + example: '1' + title: id of the pool + type_id: + type: integer + format: uint32 + example: '1' + title: id of the pool_type + reserve_coin_denoms: + type: array + example: + - denomX + - denomY + items: + type: string + title: denoms of reserve coin pair of the pool + reserve_account_address: + type: string + format: sdk.AccAddress + example: cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3 + title: reserve account address of the pool + pool_coin_denom: + type: string + example: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + title: denom of pool coin of the pool + title: The liquidity pool information + description: >- + the response type for the QueryLiquidityPoolResponse RPC method. + It returns the liquidity pool corresponding to the requested + pool_id. + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: pool_id, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = liquidity pool 3 doesn't + exist: key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + in: path + required: true + type: string + format: uint64 + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch': + get: + summary: Get the pool's current batch. + description: It returns the current batch of the pool corresponding to the pool_id. + operationId: LiquidityPoolBatch + responses: + '200': + description: A successful response. + schema: + type: object + properties: + batch: + type: object + properties: + pool_id: + type: string + format: uint64 + example: '1' + title: id of the pool + index: + type: string + format: uint64 + example: '1' + title: index of this batch + begin_height: + type: string + format: int64 + example: '1000' + title: height where this batch is begun + deposit_msg_index: + type: string + format: uint64 + example: '1' + title: last index of DepositMsgStates + withdraw_msg_index: + type: string + format: uint64 + example: '1' + title: last index of WithdrawMsgStates + swap_msg_index: + type: string + format: uint64 + example: '1' + title: last index of SwapMsgStates + executed: + type: boolean + example: true + title: 'true if executed, false if not executed yet' + description: >- + The batch or batches of a given liquidity pool that contains + indexes of the deposit, withdraw, and swap messages. The index + param increments by 1 if the pool id exists. + description: >- + the response type for the QueryLiquidityPoolBatchResponse RPC + method. It returns the liquidity pool batch corresponding to the + requested pool_id. + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: pool_id, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = liquidity pool 3 doesn't + exist: key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/deposits': + get: + summary: Get all deposit messages in the pool's current batch. + description: >- + It returns list of all deposit messages in the current batch of the pool + with pagination result. + operationId: PoolBatchDepositMsgs + responses: + '200': + description: A successful response. + schema: + type: object + properties: + deposits: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this deposit message in this liquidity pool + executed: + type: boolean + example: true + title: >- + true if executed on this batch, false if not executed + yet + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not + ready to be deleted + msg: + title: MsgDepositWithinBatch + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that + supports submitting a deposit requests to the liquidity + pool batch + + The deposit is submitted with the specified `pool_id` + and reserve `deposit_coins` + + The deposit requests are stacked in the liquidity pool + batch and are not immediately processed + + Batch deposit requests are processed in the `endblock` + at the same time as other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + DepositMsgState defines the state of the deposit message + that contains the state information as it is processed in + the next batch or batches + pagination: + description: >- + pagination defines the pagination in the response. not working + on this version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchDeposit RPC method. This + includes a list of all currently existing deposit messages of the + batch and paging results containing next_key and total count. + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: pool_id, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = liquidity pool 3 doesn't + exist: key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/deposits/{msg_index}': + get: + summary: Get specific deposit message in the pool's current batch. + description: >- + It returns the deposit message corresponding to the msg_index in the + pool's current batch. + operationId: PoolBatchDepositMsg + responses: + '200': + description: A successful response. + schema: + type: object + properties: + deposit: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this deposit message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready + to be deleted + msg: + title: MsgDepositWithinBatch + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that + supports submitting a deposit requests to the liquidity + pool batch + + The deposit is submitted with the specified `pool_id` and + reserve `deposit_coins` + + The deposit requests are stacked in the liquidity pool + batch and are not immediately processed + + Batch deposit requests are processed in the `endblock` at + the same time as other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + DepositMsgState defines the state of the deposit message that + contains the state information as it is processed in the next + batch or batches + title: >- + the response type for the QueryPoolBatchDepositMsg RPC method. + This includes a batch swap message of the batch + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: msg_index, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + root: + code: 2 + details: [] + message: >- + rpc error: code = NotFound desc = the msg given msg_index 1 + doesn't exist or deleted: key not found + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: msg_index + description: target msg_index of the pool + in: path + required: true + type: string + format: uint64 + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/swaps': + get: + summary: Get all swap messages in the pool's current batch. + description: >- + It returns list of all swap messages in the current batch of the pool + with pagination result. + operationId: PoolBatchSwapMsgs + responses: + '200': + description: A successful response. + schema: + type: object + properties: + swaps: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this swap message in this liquidity pool + executed: + type: boolean + example: true + title: >- + true if executed on this batch, false if not executed + yet + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not + ready to be deleted + order_expiry_height: + type: string + format: int64 + example: '1000' + title: >- + swap orders are cancelled when current height is equal + or higher than ExpiryHeight + exchanged_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '600000' + title: offer coin exchanged until now + remaining_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '400000' + title: offer coin currently remaining to be exchanged + reserved_offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: reserve fee for pays fee in half offer coin + msg: + title: MsgSwapWithinBatch + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap + request, must match the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for + reservation to pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the + exchange ratio of X/Y where X is the amount of the + first coin and + + Y is the amount of the second coin when their denoms + are sorted alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that + submits a swap offer request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the + specified the `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're + offering + + The `offer_coin_fee` must be half of the offer coin + amount * current `params.swap_fee_rate` for reservation + to pay fees + + This request is added to the pool and executed at the + end of the batch (`endblock`) + + You must submit the request using the same fields as the + pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: + https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + SwapMsgState defines the state of swap message that contains + state information as it is processed in the next batch or + batches + pagination: + description: >- + pagination defines the pagination in the response. not working + on this version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchSwapMsgs RPC method. This + includes list of all currently existing swap messages of the batch + and paging results containing next_key and total count. + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: pool_id, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = liquidity pool 3 doesn't + exist: key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/swaps/{msg_index}': + get: + summary: Get specific swap message in the pool's current batch. + description: >- + It returns the swap message corresponding to the msg_index in the pool's + current batch + operationId: PoolBatchSwapMsg + responses: + '200': + description: A successful response. + schema: + type: object + properties: + swap: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this swap message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready + to be deleted + order_expiry_height: + type: string + format: int64 + example: '1000' + title: >- + swap orders are cancelled when current height is equal or + higher than ExpiryHeight + exchanged_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '600000' + title: offer coin exchanged until now + remaining_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '400000' + title: offer coin currently remaining to be exchanged + reserved_offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: reserve fee for pays fee in half offer coin + msg: + title: MsgSwapWithinBatch + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap + request, must match the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for + reservation to pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the + exchange ratio of X/Y where X is the amount of the + first coin and + + Y is the amount of the second coin when their denoms + are sorted alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that submits + a swap offer request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the + specified the `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're + offering + + The `offer_coin_fee` must be half of the offer coin amount + * current `params.swap_fee_rate` for reservation to pay + fees + + This request is added to the pool and executed at the end + of the batch (`endblock`) + + You must submit the request using the same fields as the + pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: + https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + SwapMsgState defines the state of swap message that contains + state information as it is processed in the next batch or + batches + title: >- + the response type for the QueryPoolBatchSwapMsg RPC method. This + includes a batch swap message of the batch + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: msg_index, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + root: + code: 2 + details: [] + message: >- + rpc error: code = NotFound desc = the msg given msg_index 1 + doesn't exist or deleted: key not found + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: msg_index + description: target msg_index of the pool + in: path + required: true + type: string + format: uint64 + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/withdraws': + get: + summary: Get all withdraw messages in the pool's current batch. + description: >- + It returns list of all withdraw messages in the current batch of the + pool with pagination result. + operationId: PoolBatchWithdrawMsgs + responses: + '200': + description: A successful response. + schema: + type: object + properties: + withdraws: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this withdraw message in this liquidity pool + executed: + type: boolean + example: true + title: >- + true if executed on this batch, false if not executed + yet + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not + ready to be deleted + msg: + title: MsgWithdrawWithinBatch + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that + submits a withdraw request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool + with the specified `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity + pool, not immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + WithdrawMsgState defines the state of the withdraw message + that contains state information as it is processed in the + next batch or batches + pagination: + description: >- + pagination defines the pagination in the response. not working + on this version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchWithdraw RPC method. This + includes a list of all currently existing withdraw messages of the + batch and paging results containing next_key and total count. + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: pool_id, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + code: 2 + message: >- + rpc error: code = NotFound desc = liquidity pool 3 doesn't + exist: key not found + details: [] + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' + '/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/withdraws/{msg_index}': + get: + summary: Get specific withdraw message in the pool's current batch. + description: >- + It returns the withdraw message corresponding to the msg_index in the + pool's current batch. + operationId: PoolBatchWithdrawMsg + responses: + '200': + description: A successful response. + schema: + type: object + properties: + withdraw: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this withdraw message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: >- + true if executed successfully on this batch, false if + failed + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready + to be deleted + msg: + title: MsgWithdrawWithinBatch + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that + submits a withdraw request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool with + the specified `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity + pool, not immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + WithdrawMsgState defines the state of the withdraw message + that contains state information as it is processed in the next + batch or batches + title: >- + the response type for the QueryPoolBatchWithdrawMsg RPC method. + This includes a batch swap message of the batch + '400': + description: Bad Request + schema: {} + examples: + application/json: + code: 3 + message: >- + type mismatch, parameter: msg_index, error: strconv.ParseUint: + parsing *: invalid syntax + details: [] + '500': + description: Internal Server Error + schema: {} + examples: + application/json: + root: + code: 2 + details: [] + message: >- + rpc error: code = NotFound desc = the msg given msg_index 1 + doesn't exist or deleted: key not found + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pool_id + description: id of the target pool for query + in: path + required: true + type: string + format: uint64 + - name: msg_index + description: target msg_index of the pool + in: path + required: true + type: string + format: uint64 + tags: + - Query + externalDocs: + description: Find out more about the query and error codes + url: 'https://github.com/tendermint/liquidity/blob/develop/doc/client.md' +definitions: + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + offset: + type: string + format: uint64 + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + limit: + type: string + format: uint64 + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + count_total: + type: boolean + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in UIs. + + count_total is only respected when offset is used. It is ignored when + key + + is set. + description: |- + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + cosmos.base.v1beta1.Coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + google.protobuf.Any: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + grpc.gateway.runtime.Error: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tendermint.liquidity.v1beta1.DepositMsgState: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this deposit message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgDepositWithinBatch + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports + submitting a deposit requests to the liquidity pool batch + + The deposit is submitted with the specified `pool_id` and reserve + `deposit_coins` + + The deposit requests are stacked in the liquidity pool batch and are + not immediately processed + + Batch deposit requests are processed in the `endblock` at the same + time as other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + DepositMsgState defines the state of the deposit message that contains the + state information as it is processed in the next batch or batches + tendermint.liquidity.v1beta1.MsgDepositWithinBatch: + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports submitting + a deposit requests to the liquidity pool batch + + The deposit is submitted with the specified `pool_id` and reserve + `deposit_coins` + + The deposit requests are stacked in the liquidity pool batch and are not + immediately processed + + Batch deposit requests are processed in the `endblock` at the same time as + other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + tendermint.liquidity.v1beta1.MsgSwapWithinBatch: + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap request, must match + the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for reservation to + pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the exchange ratio of + X/Y where X is the amount of the first coin and + + Y is the amount of the second coin when their denoms are sorted + alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that submits a swap offer + request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the specified the + `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're offering + + The `offer_coin_fee` must be half of the offer coin amount * current + `params.swap_fee_rate` for reservation to pay fees + + This request is added to the pool and executed at the end of the batch + (`endblock`) + + You must submit the request using the same fields as the pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + tendermint.liquidity.v1beta1.MsgWithdrawWithinBatch: + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that submits a withdraw + request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool with the specified + `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity pool, not + immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + tendermint.liquidity.v1beta1.Params: + type: object + properties: + pool_types: + type: array + items: + type: object + properties: + id: + type: integer + format: uint32 + example: '1' + title: >- + The id of the pool_type to use as pool_type_id for pool + creation. + + Only pool-type-id 1 is supported + + {"id":1,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""} + name: + type: string + example: ConstantProductLiquidityPool + title: name of the pool type + min_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + min number of reserveCoins for LiquidityPoolType only 2 is + allowed on this spec + max_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + max number of reserveCoins for LiquidityPoolType only 2 is + allowed on this spec + description: + type: string + title: description of the pool type + title: >- + Structure for the pool type to distinguish the characteristics of + the reserve pools + title: list of available pool types + min_init_deposit_amount: + type: string + format: sdk.Int + example: '1000000' + title: >- + Minimum number of coins to be deposited to the liquidity pool upon + pool creation + init_pool_coin_mint_amount: + type: string + format: sdk.Int + example: '1000000' + title: Initial mint amount of pool coin upon pool creation + max_reserve_coin_amount: + type: string + format: sdk.Int + example: '1000000000000' + title: >- + Limit the size of each liquidity pool in the beginning phase of + Liquidity Module adoption to minimize risk, 0 means no limit + pool_creation_fee: + type: array + format: sdk.Coins + example: + - denom: uatom + amount: '100000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Fee to create a Liquidity Pool. + swap_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: Swap fee rate for every executed swap + withdraw_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: Reserve coin withdrawal with less proportion by withdrawFeeRate + max_order_amount_ratio: + type: string + format: sdk.Dec + example: '0.003' + title: Maximum ratio of reserve coins that can be ordered at a swap order + unit_batch_height: + type: integer + format: uint32 + example: '1' + title: The smallest unit batch height for every liquidity pool + description: Params defines the parameters for the liquidity module. + tendermint.liquidity.v1beta1.Pool: + type: object + properties: + id: + type: string + format: uint64 + example: '1' + title: id of the pool + type_id: + type: integer + format: uint32 + example: '1' + title: id of the pool_type + reserve_coin_denoms: + type: array + example: + - denomX + - denomY + items: + type: string + title: denoms of reserve coin pair of the pool + reserve_account_address: + type: string + format: sdk.AccAddress + example: cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3 + title: reserve account address of the pool + pool_coin_denom: + type: string + example: poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + title: denom of pool coin of the pool + title: The liquidity pool information + tendermint.liquidity.v1beta1.PoolBatch: + type: object + properties: + pool_id: + type: string + format: uint64 + example: '1' + title: id of the pool + index: + type: string + format: uint64 + example: '1' + title: index of this batch + begin_height: + type: string + format: int64 + example: '1000' + title: height where this batch is begun + deposit_msg_index: + type: string + format: uint64 + example: '1' + title: last index of DepositMsgStates + withdraw_msg_index: + type: string + format: uint64 + example: '1' + title: last index of WithdrawMsgStates + swap_msg_index: + type: string + format: uint64 + example: '1' + title: last index of SwapMsgStates + executed: + type: boolean + example: true + title: 'true if executed, false if not executed yet' + description: >- + The batch or batches of a given liquidity pool that contains indexes of + the deposit, withdraw, and swap messages. The index param increments by 1 + if the pool id exists. + tendermint.liquidity.v1beta1.PoolType: + type: object + properties: + id: + type: integer + format: uint32 + example: '1' + title: >- + The id of the pool_type to use as pool_type_id for pool creation. + + Only pool-type-id 1 is supported + + {"id":1,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""} + name: + type: string + example: ConstantProductLiquidityPool + title: name of the pool type + min_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + min number of reserveCoins for LiquidityPoolType only 2 is allowed on + this spec + max_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + max number of reserveCoins for LiquidityPoolType only 2 is allowed on + this spec + description: + type: string + title: description of the pool type + title: >- + Structure for the pool type to distinguish the characteristics of the + reserve pools + tendermint.liquidity.v1beta1.QueryLiquidityPoolBatchResponse: + type: object + properties: + batch: + type: object + properties: + pool_id: + type: string + format: uint64 + example: '1' + title: id of the pool + index: + type: string + format: uint64 + example: '1' + title: index of this batch + begin_height: + type: string + format: int64 + example: '1000' + title: height where this batch is begun + deposit_msg_index: + type: string + format: uint64 + example: '1' + title: last index of DepositMsgStates + withdraw_msg_index: + type: string + format: uint64 + example: '1' + title: last index of WithdrawMsgStates + swap_msg_index: + type: string + format: uint64 + example: '1' + title: last index of SwapMsgStates + executed: + type: boolean + example: true + title: 'true if executed, false if not executed yet' + description: >- + The batch or batches of a given liquidity pool that contains indexes + of the deposit, withdraw, and swap messages. The index param + increments by 1 if the pool id exists. + description: >- + the response type for the QueryLiquidityPoolBatchResponse RPC method. It + returns the liquidity pool batch corresponding to the requested pool_id. + tendermint.liquidity.v1beta1.QueryLiquidityPoolResponse: + type: object + properties: + pool: + type: object + properties: + id: + type: string + format: uint64 + example: '1' + title: id of the pool + type_id: + type: integer + format: uint32 + example: '1' + title: id of the pool_type + reserve_coin_denoms: + type: array + example: + - denomX + - denomY + items: + type: string + title: denoms of reserve coin pair of the pool + reserve_account_address: + type: string + format: sdk.AccAddress + example: cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3 + title: reserve account address of the pool + pool_coin_denom: + type: string + example: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + title: denom of pool coin of the pool + title: The liquidity pool information + description: >- + the response type for the QueryLiquidityPoolResponse RPC method. It + returns the liquidity pool corresponding to the requested pool_id. + tendermint.liquidity.v1beta1.QueryLiquidityPoolsResponse: + type: object + properties: + pools: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + example: '1' + title: id of the pool + type_id: + type: integer + format: uint32 + example: '1' + title: id of the pool_type + reserve_coin_denoms: + type: array + example: + - denomX + - denomY + items: + type: string + title: denoms of reserve coin pair of the pool + reserve_account_address: + type: string + format: sdk.AccAddress + example: cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3 + title: reserve account address of the pool + pool_coin_denom: + type: string + example: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + title: denom of pool coin of the pool + title: The liquidity pool information + pagination: + description: >- + pagination defines the pagination in the response. not working on this + version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryLiquidityPoolsResponse RPC method. This + includes list of all liquidity pools currently existed and paging results + containing next_key and total count. + tendermint.liquidity.v1beta1.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + pool_types: + type: array + items: + type: object + properties: + id: + type: integer + format: uint32 + example: '1' + title: >- + The id of the pool_type to use as pool_type_id for pool + creation. + + Only pool-type-id 1 is supported + + {"id":1,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""} + name: + type: string + example: ConstantProductLiquidityPool + title: name of the pool type + min_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + min number of reserveCoins for LiquidityPoolType only 2 is + allowed on this spec + max_reserve_coin_num: + type: integer + format: uint32 + example: '2' + title: >- + max number of reserveCoins for LiquidityPoolType only 2 is + allowed on this spec + description: + type: string + title: description of the pool type + title: >- + Structure for the pool type to distinguish the characteristics + of the reserve pools + title: list of available pool types + min_init_deposit_amount: + type: string + format: sdk.Int + example: '1000000' + title: >- + Minimum number of coins to be deposited to the liquidity pool upon + pool creation + init_pool_coin_mint_amount: + type: string + format: sdk.Int + example: '1000000' + title: Initial mint amount of pool coin upon pool creation + max_reserve_coin_amount: + type: string + format: sdk.Int + example: '1000000000000' + title: >- + Limit the size of each liquidity pool in the beginning phase of + Liquidity Module adoption to minimize risk, 0 means no limit + pool_creation_fee: + type: array + format: sdk.Coins + example: + - denom: uatom + amount: '100000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Fee to create a Liquidity Pool. + swap_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: Swap fee rate for every executed swap + withdraw_fee_rate: + type: string + format: sdk.Dec + example: '0.003' + title: Reserve coin withdrawal with less proportion by withdrawFeeRate + max_order_amount_ratio: + type: string + format: sdk.Dec + example: '0.003' + title: Maximum ratio of reserve coins that can be ordered at a swap order + unit_batch_height: + type: integer + format: uint32 + example: '1' + title: The smallest unit batch height for every liquidity pool + description: >- + the response type for the QueryParamsResponse RPC method. This includes + current parameter of the liquidity module. + tendermint.liquidity.v1beta1.QueryPoolBatchDepositMsgResponse: + type: object + properties: + deposit: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this deposit message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgDepositWithinBatch + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports + submitting a deposit requests to the liquidity pool batch + + The deposit is submitted with the specified `pool_id` and reserve + `deposit_coins` + + The deposit requests are stacked in the liquidity pool batch and + are not immediately processed + + Batch deposit requests are processed in the `endblock` at the same + time as other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + DepositMsgState defines the state of the deposit message that contains + the state information as it is processed in the next batch or batches + title: >- + the response type for the QueryPoolBatchDepositMsg RPC method. This + includes a batch swap message of the batch + tendermint.liquidity.v1beta1.QueryPoolBatchDepositMsgsResponse: + type: object + properties: + deposits: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this deposit message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgDepositWithinBatch + type: object + properties: + depositor_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + deposit_coins: + type: array + format: sdk.Coins + example: + - denom: denomX + amount: '1000000' + - denom: denomY + amount: '2000000' + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + title: reserve coin pair of the pool to deposit + description: >- + `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports + submitting a deposit requests to the liquidity pool batch + + The deposit is submitted with the specified `pool_id` and + reserve `deposit_coins` + + The deposit requests are stacked in the liquidity pool batch and + are not immediately processed + + Batch deposit requests are processed in the `endblock` at the + same time as other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + DepositMsgState defines the state of the deposit message that + contains the state information as it is processed in the next batch + or batches + pagination: + description: >- + pagination defines the pagination in the response. not working on this + version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchDeposit RPC method. This includes + a list of all currently existing deposit messages of the batch and paging + results containing next_key and total count. + tendermint.liquidity.v1beta1.QueryPoolBatchSwapMsgResponse: + type: object + properties: + swap: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this swap message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + order_expiry_height: + type: string + format: int64 + example: '1000' + title: >- + swap orders are cancelled when current height is equal or higher + than ExpiryHeight + exchanged_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '600000' + title: offer coin exchanged until now + remaining_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '400000' + title: offer coin currently remaining to be exchanged + reserved_offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: reserve fee for pays fee in half offer coin + msg: + title: MsgSwapWithinBatch + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap request, must + match the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for + reservation to pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the exchange + ratio of X/Y where X is the amount of the first coin and + + Y is the amount of the second coin when their denoms are + sorted alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that submits a swap + offer request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the specified + the `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're offering + + The `offer_coin_fee` must be half of the offer coin amount * + current `params.swap_fee_rate` for reservation to pay fees + + This request is added to the pool and executed at the end of the + batch (`endblock`) + + You must submit the request using the same fields as the pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + SwapMsgState defines the state of swap message that contains state + information as it is processed in the next batch or batches + title: >- + the response type for the QueryPoolBatchSwapMsg RPC method. This includes + a batch swap message of the batch + tendermint.liquidity.v1beta1.QueryPoolBatchSwapMsgsResponse: + type: object + properties: + swaps: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this swap message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + order_expiry_height: + type: string + format: int64 + example: '1000' + title: >- + swap orders are cancelled when current height is equal or higher + than ExpiryHeight + exchanged_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '600000' + title: offer coin exchanged until now + remaining_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '400000' + title: offer coin currently remaining to be exchanged + reserved_offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: reserve fee for pays fee in half offer coin + msg: + title: MsgSwapWithinBatch + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap request, + must match the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for + reservation to pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the exchange + ratio of X/Y where X is the amount of the first coin and + + Y is the amount of the second coin when their denoms are + sorted alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that submits a swap + offer request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the specified + the `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're offering + + The `offer_coin_fee` must be half of the offer coin amount * + current `params.swap_fee_rate` for reservation to pay fees + + This request is added to the pool and executed at the end of the + batch (`endblock`) + + You must submit the request using the same fields as the pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + SwapMsgState defines the state of swap message that contains state + information as it is processed in the next batch or batches + pagination: + description: >- + pagination defines the pagination in the response. not working on this + version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchSwapMsgs RPC method. This includes + list of all currently existing swap messages of the batch and paging + results containing next_key and total count. + tendermint.liquidity.v1beta1.QueryPoolBatchWithdrawMsgResponse: + type: object + properties: + withdraw: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this withdraw message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgWithdrawWithinBatch + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that submits a + withdraw request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool with the + specified `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity pool, not + immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + WithdrawMsgState defines the state of the withdraw message that + contains state information as it is processed in the next batch or + batches + title: >- + the response type for the QueryPoolBatchWithdrawMsg RPC method. This + includes a batch swap message of the batch + tendermint.liquidity.v1beta1.QueryPoolBatchWithdrawMsgsResponse: + type: object + properties: + withdraws: + type: array + items: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this withdraw message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgWithdrawWithinBatch + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that submits + a withdraw request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool with the + specified `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity pool, + not immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + WithdrawMsgState defines the state of the withdraw message that + contains state information as it is processed in the next batch or + batches + pagination: + description: >- + pagination defines the pagination in the response. not working on this + version. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + the response type for the QueryPoolBatchWithdraw RPC method. This includes + a list of all currently existing withdraw messages of the batch and paging + results containing next_key and total count. + tendermint.liquidity.v1beta1.SwapMsgState: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this swap message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + order_expiry_height: + type: string + format: int64 + example: '1000' + title: >- + swap orders are cancelled when current height is equal or higher than + ExpiryHeight + exchanged_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '600000' + title: offer coin exchanged until now + remaining_offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '400000' + title: offer coin currently remaining to be exchanged + reserved_offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: reserve fee for pays fee in half offer coin + msg: + title: MsgSwapWithinBatch + type: object + properties: + swap_requester_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + title: address of swap requester + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + swap_type_id: + type: integer + format: uint32 + example: '1' + description: id of swap type. Must match the value in the pool. + offer_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '1000000' + demand_coin_denom: + type: string + example: denomB + description: >- + denom of demand coin to be exchanged on the swap request, must + match the denom in the pool. + offer_coin_fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: denomX + amount: '5000' + title: >- + half of offer coin amount * params.swap_fee_rate for reservation + to pay fees + order_price: + type: string + format: sdk.Dec + example: '1.1' + title: >- + limit order price for the order, the price is the exchange ratio + of X/Y where X is the amount of the first coin and + + Y is the amount of the second coin when their denoms are sorted + alphabetically + description: >- + `MsgSwapWithinBatch` defines an sdk.Msg type that submits a swap offer + request to the liquidity pool batch + + Submit swap offer to the liquidity pool batch with the specified the + `pool_id`, `swap_type_id`, + + `demand_coin_denom` with the coin and the price you're offering + + The `offer_coin_fee` must be half of the offer coin amount * current + `params.swap_fee_rate` for reservation to pay fees + + This request is added to the pool and executed at the end of the batch + (`endblock`) + + You must submit the request using the same fields as the pool + + Only the default `swap_type_id`1 is supported + + The detailed swap algorithm is shown here. + + + See: https://github.com/tendermint/liquidity/tree/develop/doc + + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + SwapMsgState defines the state of swap message that contains state + information as it is processed in the next batch or batches + tendermint.liquidity.v1beta1.WithdrawMsgState: + type: object + properties: + msg_height: + type: string + format: int64 + example: '1000' + title: height where this message is appended to the batch + msg_index: + type: string + format: uint64 + example: '1' + title: index of this withdraw message in this liquidity pool + executed: + type: boolean + example: true + title: 'true if executed on this batch, false if not executed yet' + succeeded: + type: boolean + example: true + title: 'true if executed successfully on this batch, false if failed' + to_be_deleted: + type: boolean + example: true + title: >- + true if ready to be deleted on kvstore, false if not ready to be + deleted + msg: + title: MsgWithdrawWithinBatch + type: object + properties: + withdrawer_address: + type: string + format: sdk.AccAddress + example: cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun + description: account address of the origin of this message + pool_id: + type: string + format: uint64 + example: '1' + title: id of the target pool + pool_coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + format: sdk.Coin + example: + denom: >- + poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4 + amount: '1000' + description: >- + `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that submits a + withdraw request to the liquidity pool batch + + Withdraw submit to the batch from the Liquidity pool with the + specified `pool_id`, `pool_coin` of the pool + + this requests are stacked in the batch of the liquidity pool, not + immediately processed and + + processed in the `endblock` at once with other requests. + + + See: + https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md + title: >- + WithdrawMsgState defines the state of the withdraw message that contains + state information as it is processed in the next batch or batches diff --git a/proto/tendermint/liquidity/v1beta1/genesis.proto b/proto/tendermint/liquidity/v1beta1/genesis.proto new file mode 100644 index 000000000..d5cde9ede --- /dev/null +++ b/proto/tendermint/liquidity/v1beta1/genesis.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package tendermint.liquidity.v1beta1; + +import "tendermint/liquidity/v1beta1/liquidity.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/tendermint/liquidity/x/liquidity/types"; + +// record of the state of each pool after genesis export or import, used to check variables +message PoolRecord { + Pool pool = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"pool\""]; + PoolMetadata pool_metadata = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"pool_metadata\""]; + PoolBatch pool_batch = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"pool_batch\""]; + repeated DepositMsgState deposit_msg_states = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_msg_states\""]; + repeated WithdrawMsgState withdraw_msg_states = 5 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"withdraw_msg_states\""]; + repeated SwapMsgState swap_msg_states = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"swap_msg_states\""]; +} + +// GenesisState defines the liquidity module's genesis state. +message GenesisState { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // params defines all the parameters of related to liquidity. + Params params = 1 [(gogoproto.nullable) = false]; + repeated PoolRecord pool_records = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"pools\""]; +} diff --git a/proto/tendermint/liquidity/v1beta1/liquidity.proto b/proto/tendermint/liquidity/v1beta1/liquidity.proto new file mode 100644 index 000000000..1886b3a78 --- /dev/null +++ b/proto/tendermint/liquidity/v1beta1/liquidity.proto @@ -0,0 +1,415 @@ +syntax = "proto3"; +package tendermint.liquidity.v1beta1; + +import "tendermint/liquidity/v1beta1/tx.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/coin.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option go_package = "github.com/tendermint/liquidity/x/liquidity/types"; +option (gogoproto.goproto_getters_all) = false; + +// Structure for the pool type to distinguish the characteristics of the reserve pools +message PoolType { + option (gogoproto.equal) = true; + + // The id of the pool_type to use as pool_type_id for pool creation. + // Only pool-type-id 1 is supported + // {"id":1,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""} + uint32 id = 1 [(gogoproto.moretags) = "yaml:\"id\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint32" + }]; + + // name of the pool type + string name = 2 [(gogoproto.moretags) = "yaml:\"name\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"ConstantProductLiquidityPool\"", + }]; + + // min number of reserveCoins for LiquidityPoolType only 2 is allowed on this spec + uint32 min_reserve_coin_num = 3 [(gogoproto.moretags) = "yaml:\"min_reserve_coin_num\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"2\"", + format: "uint32" + }]; + + // max number of reserveCoins for LiquidityPoolType only 2 is allowed on this spec + uint32 max_reserve_coin_num = 4 [(gogoproto.moretags) = "yaml:\"max_reserve_coin_num\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"2\"", + format: "uint32" + }]; + + // description of the pool type + string description = 5 [(gogoproto.moretags) = "yaml:\"description\""]; +} + +// Params defines the parameters for the liquidity module. +message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // list of available pool types + repeated PoolType pool_types = 1 [ + (gogoproto.moretags) = "yaml:\"pool_types\"", + (gogoproto.nullable) = false + ]; + + // Minimum number of coins to be deposited to the liquidity pool upon pool creation + string min_init_deposit_amount = 2 [ + (gogoproto.moretags) = "yaml:\"min_init_deposit_amount\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000000\"", + format: "sdk.Int" + }]; + + // Initial mint amount of pool coin upon pool creation + string init_pool_coin_mint_amount = 3 [ + (gogoproto.moretags) = "yaml:\"init_pool_coin_mint_amount\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000000\"", + format: "sdk.Int" + }]; + + // Limit the size of each liquidity pool in the beginning phase of Liquidity Module adoption to minimize risk, 0 means no limit + string max_reserve_coin_amount = 4 [ + (gogoproto.moretags) = "yaml:\"max_reserve_coin_amount\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000000000000\"", + format: "sdk.Int" + }]; + + // Fee to create a Liquidity Pool. + repeated cosmos.base.v1beta1.Coin pool_creation_fee = 5 [ + (gogoproto.moretags) = "yaml:\"pool_creation_fee\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "[{\"denom\": \"uatom\", \"amount\": \"100000000\"}]", + format: "sdk.Coins" + } + ]; + + // Swap fee rate for every executed swap + string swap_fee_rate = 6 [ + (gogoproto.moretags) = "yaml:\"swap_fee_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"0.003\"", + format: "sdk.Dec" + }]; + + // Reserve coin withdrawal with less proportion by withdrawFeeRate + string withdraw_fee_rate = 7 [ + (gogoproto.moretags) = "yaml:\"withdraw_fee_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"0.003\"", + format: "sdk.Dec" + }]; + + // Maximum ratio of reserve coins that can be ordered at a swap order + string max_order_amount_ratio = 8 [ + (gogoproto.moretags) = "yaml:\"max_order_amount_ratio\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"0.003\"", + format: "sdk.Dec" + }]; + + // The smallest unit batch height for every liquidity pool + uint32 unit_batch_height = 9 [ + (gogoproto.moretags) = "yaml:\"unit_batch_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint32" + }]; +} + +// The liquidity pool information +message Pool { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + + // id of the pool + uint64 id = 1 [(gogoproto.moretags) = "yaml:\"id\"", (gogoproto.jsontag) = "id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // id of the pool_type + uint32 type_id = 2 [(gogoproto.moretags) = "yaml:\"type_id\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint32" + }]; + + // denoms of reserve coin pair of the pool + repeated string reserve_coin_denoms = 3 [(gogoproto.moretags) = "yaml:\"reserve_coin_denoms\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "[\"denomX\",\"denomY\"]" + }]; + + // reserve account address of the pool + string reserve_account_address = 4 [(gogoproto.moretags) = "yaml:\"reserve_account_address\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"cosmos16ddqestwukv0jzcyfn3fdfq9h2wrs83cr4rfm3\"", + format: "sdk.AccAddress" + }]; + + // denom of pool coin of the pool + string pool_coin_denom = 5 [(gogoproto.moretags) = "yaml:\"pool_coin_denom\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4\"", + }]; +} + +// Metadata for the state of each pool for invariant checking after genesis export or import +message PoolMetadata { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + + // id of the pool + uint64 pool_id = 1 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // pool coin issued at the pool + cosmos.base.v1beta1.Coin pool_coin_total_supply = 2 [ + (gogoproto.moretags) = "yaml:\"pool_coin_total_supply\"", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4\", \"amount\": \"1000000\"}", + format: "sdk.Coin" + }]; + + // reserve coins deposited in the pool + repeated cosmos.base.v1beta1.Coin reserve_coins = 3 [ + (gogoproto.moretags) = "yaml:\"reserve_coins\"", + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "[{\"denom\": \"denomX\", \"amount\": \"1000000\"}, {\"denom\": \"denomY\", \"amount\": \"2000000\"}]", + format: "sdk.Coins" + }]; +} + +// The batch or batches of a given liquidity pool that contains indexes of the deposit, withdraw, and swap messages. The index param increments by 1 if the pool id exists. +message PoolBatch { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = true; + + // id of the pool + uint64 pool_id = 1 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // index of this batch + uint64 index = 2 [(gogoproto.moretags) = "yaml:\"index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // height where this batch is begun + int64 begin_height = 3 [(gogoproto.moretags) = "yaml:\"begin_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000\"", + format: "int64" + }]; + + // last index of DepositMsgStates + uint64 deposit_msg_index = 4 [(gogoproto.moretags) = "yaml:\"deposit_msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // last index of WithdrawMsgStates + uint64 withdraw_msg_index = 5 [(gogoproto.moretags) = "yaml:\"withdraw_msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // last index of SwapMsgStates + uint64 swap_msg_index = 6 [(gogoproto.moretags) = "yaml:\"swap_msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // true if executed, false if not executed yet + bool executed = 7 [(gogoproto.moretags) = "yaml:\"executed\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; +} + +// DepositMsgState defines the state of the deposit message that contains the state information as it is processed in the next batch or batches +message DepositMsgState { + + // height where this message is appended to the batch + int64 msg_height = 1 [(gogoproto.moretags) = "yaml:\"msg_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000\"", + format: "int64" + }]; + + // index of this deposit message in this liquidity pool + uint64 msg_index = 2 [(gogoproto.moretags) = "yaml:\"msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // true if executed on this batch, false if not executed yet + bool executed = 3 [(gogoproto.moretags) = "yaml:\"executed\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if executed successfully on this batch, false if failed + bool succeeded = 4 [(gogoproto.moretags) = "yaml:\"succeeded\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if ready to be deleted on kvstore, false if not ready to be deleted + bool to_be_deleted = 5 [(gogoproto.moretags) = "yaml:\"to_be_deleted\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // MsgDepositWithinBatch + MsgDepositWithinBatch msg = 6 [(gogoproto.moretags) = "yaml:\"msg\""]; +} + +// WithdrawMsgState defines the state of the withdraw message that contains state information as it is processed in the next batch or batches +message WithdrawMsgState { + + // height where this message is appended to the batch + int64 msg_height = 1 [(gogoproto.moretags) = "yaml:\"msg_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000\"", + format: "int64" + }]; + + // index of this withdraw message in this liquidity pool + uint64 msg_index = 2 [(gogoproto.moretags) = "yaml:\"msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // true if executed on this batch, false if not executed yet + bool executed = 3 [(gogoproto.moretags) = "yaml:\"executed\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if executed successfully on this batch, false if failed + bool succeeded = 4 [(gogoproto.moretags) = "yaml:\"succeeded\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if ready to be deleted on kvstore, false if not ready to be deleted + bool to_be_deleted = 5 [(gogoproto.moretags) = "yaml:\"to_be_deleted\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // MsgWithdrawWithinBatch + MsgWithdrawWithinBatch msg = 6 [(gogoproto.moretags) = "yaml:\"msg\""]; +} + +// SwapMsgState defines the state of swap message that contains state information as it is processed in the next batch or batches +message SwapMsgState { + + // height where this message is appended to the batch + int64 msg_height = 1 [(gogoproto.moretags) = "yaml:\"msg_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000\"", + format: "int64" + }]; + + // index of this swap message in this liquidity pool + uint64 msg_index = 2 [(gogoproto.moretags) = "yaml:\"msg_index\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // true if executed on this batch, false if not executed yet + bool executed = 3 [(gogoproto.moretags) = "yaml:\"executed\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if executed successfully on this batch, false if failed + bool succeeded = 4 [(gogoproto.moretags) = "yaml:\"succeeded\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // true if ready to be deleted on kvstore, false if not ready to be deleted + bool to_be_deleted = 5 [(gogoproto.moretags) = "yaml:\"to_be_deleted\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "true", + }]; + + // swap orders are cancelled when current height is equal or higher than ExpiryHeight + int64 order_expiry_height = 6 [(gogoproto.moretags) = "yaml:\"order_expiry_height\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1000\"", + format: "int64" + }]; + + // offer coin exchanged until now + cosmos.base.v1beta1.Coin exchanged_offer_coin = 7 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"exchanged_offer_coin\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"denomX\", \"amount\": \"600000\"}", + format: "sdk.Coin" + }]; + + // offer coin currently remaining to be exchanged + cosmos.base.v1beta1.Coin remaining_offer_coin = 8 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"remaining_offer_coin\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"denomX\", \"amount\": \"400000\"}", + format: "sdk.Coin" + }]; + + // reserve fee for pays fee in half offer coin + cosmos.base.v1beta1.Coin reserved_offer_coin_fee = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"reserved_offer_coin_fee\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"denomX\", \"amount\": \"5000\"}", + format: "sdk.Coin" + } + ]; + + // MsgSwapWithinBatch + MsgSwapWithinBatch msg = 10 [(gogoproto.moretags) = "yaml:\"msg\""]; +} diff --git a/proto/tendermint/liquidity/v1beta1/query.proto b/proto/tendermint/liquidity/v1beta1/query.proto new file mode 100644 index 000000000..f835a4e99 --- /dev/null +++ b/proto/tendermint/liquidity/v1beta1/query.proto @@ -0,0 +1,433 @@ +syntax = "proto3"; +package tendermint.liquidity.v1beta1; + +import "gogoproto/gogo.proto"; +import "tendermint/liquidity/v1beta1/liquidity.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/pagination.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option go_package = "github.com/tendermint/liquidity/x/liquidity/types"; + +// Query defines the gRPC querier service for liquidity module. +service Query { + // Get existing liquidity pools. + rpc LiquidityPools (QueryLiquidityPoolsRequest) returns (QueryLiquidityPoolsResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns list of all liquidity pools with pagination result."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = There are no pools present.: key not found","details":[]}' + } + } + } + }; + } + + // Get specific liquidity pool. + rpc LiquidityPool (QueryLiquidityPoolRequest) returns (QueryLiquidityPoolResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns the liquidity pool corresponding to the pool_id."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = liquidity pool 3 doesn\'t exist: key not found","details":[]}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: pool_id, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get the pool's current batch. + rpc LiquidityPoolBatch (QueryLiquidityPoolBatchRequest) returns (QueryLiquidityPoolBatchResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns the current batch of the pool corresponding to the pool_id."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = liquidity pool 3 doesn\'t exist: key not found","details":[]}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: pool_id, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get all swap messages in the pool's current batch. + rpc PoolBatchSwapMsgs(QueryPoolBatchSwapMsgsRequest) returns (QueryPoolBatchSwapMsgsResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/swaps"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns list of all swap messages in the current batch of the pool with pagination result."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = liquidity pool 3 doesn\'t exist: key not found","details":[]}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: pool_id, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get specific swap message in the pool's current batch. + rpc PoolBatchSwapMsg(QueryPoolBatchSwapMsgRequest) returns (QueryPoolBatchSwapMsgResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/swaps/{msg_index}"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns the swap message corresponding to the msg_index in the pool's current batch"; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"root":{"code":2,"details":[],"message":"rpc error: code = NotFound desc = the msg given msg_index 1 doesn\'t exist or deleted: key not found"}}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: msg_index, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get all deposit messages in the pool's current batch. + rpc PoolBatchDepositMsgs(QueryPoolBatchDepositMsgsRequest) returns (QueryPoolBatchDepositMsgsResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/deposits"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns list of all deposit messages in the current batch of the pool with pagination result."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = liquidity pool 3 doesn\'t exist: key not found","details":[]}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: pool_id, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + + }; + } + + // Get specific deposit message in the pool's current batch. + rpc PoolBatchDepositMsg(QueryPoolBatchDepositMsgRequest) returns (QueryPoolBatchDepositMsgResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/deposits/{msg_index}"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns the deposit message corresponding to the msg_index in the pool's current batch."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"root":{"code":2,"details":[],"message":"rpc error: code = NotFound desc = the msg given msg_index 1 doesn\'t exist or deleted: key not found"}}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: msg_index, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get all withdraw messages in the pool's current batch. + rpc PoolBatchWithdrawMsgs(QueryPoolBatchWithdrawMsgsRequest) returns (QueryPoolBatchWithdrawMsgsResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/withdraws"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns list of all withdraw messages in the current batch of the pool with pagination result."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"code":2,"message":"rpc error: code = NotFound desc = liquidity pool 3 doesn\'t exist: key not found","details":[]}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: pool_id, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + + }; + } + + // Get specific withdraw message in the pool's current batch. + rpc PoolBatchWithdrawMsg(QueryPoolBatchWithdrawMsgRequest) returns (QueryPoolBatchWithdrawMsgResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/pools/{pool_id}/batch/withdraws/{msg_index}"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns the withdraw message corresponding to the msg_index in the pool's current batch."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/doc/client.md"; + description: "Find out more about the query and error codes"; + } + responses: { + key: "500" + value: { + description: "Internal Server Error" + examples: { + key: "application/json" + value: '{"root":{"code":2,"details":[],"message":"rpc error: code = NotFound desc = the msg given msg_index 1 doesn\'t exist or deleted: key not found"}}' + } + } + } + responses: { + key: "400" + value: { + description: "Bad Request" + examples: { + key: "application/json" + value: '{"code":3,"message":"type mismatch, parameter: msg_index, error: strconv.ParseUint: parsing *: invalid syntax","details":[]}' + } + } + } + }; + } + + // Get all parameters of the liquidity module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/tendermint/liquidity/v1beta1/params"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + description: "It returns all parameters of the liquidity module."; + external_docs: { + url: "https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/08_params.md"; + description: "Find out more about the params"; + } + }; + } +} + +// the request type for the QueryLiquidityPool RPC method. requestable specified pool_id. +message QueryLiquidityPoolRequest { + uint64 pool_id = 1; +} + +// the response type for the QueryLiquidityPoolResponse RPC method. It returns the liquidity pool corresponding to the requested pool_id. +message QueryLiquidityPoolResponse { + Pool pool = 1 [(gogoproto.nullable) = false]; +} + +// the request type for the QueryLiquidityPoolBatch RPC method. requestable including specified pool_id. +message QueryLiquidityPoolBatchRequest { + // id of the target pool for query + uint64 pool_id = 1; +} + +// the response type for the QueryLiquidityPoolBatchResponse RPC method. It returns the liquidity pool batch corresponding to the requested pool_id. +message QueryLiquidityPoolBatchResponse { + PoolBatch batch = 1 [(gogoproto.nullable) = false]; +} + +// the request type for the QueryLiquidityPools RPC method. requestable including pagination offset, limit, key. +message QueryLiquidityPoolsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// the response type for the QueryLiquidityPoolsResponse RPC method. This includes list of all liquidity pools currently existed and paging results containing next_key and total count. +message QueryLiquidityPoolsResponse { + repeated Pool pools = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. not working on this version. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryParamsRequest is request type for the QueryParams RPC method. +message QueryParamsRequest {} + +// the response type for the QueryParamsResponse RPC method. This includes current parameter of the liquidity module. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; +} + +// the request type for the QueryPoolBatchSwapMsgs RPC method. requestable including specified pool_id and pagination offset, limit, key. +message QueryPoolBatchSwapMsgsRequest { + // id of the target pool for query + uint64 pool_id = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// the request type for the QueryPoolBatchSwap RPC method. requestable including specified pool_id and msg_index +message QueryPoolBatchSwapMsgRequest { + // id of the target pool for query + uint64 pool_id = 1; + // target msg_index of the pool + uint64 msg_index = 2; +} + +// the response type for the QueryPoolBatchSwapMsgs RPC method. This includes list of all currently existing swap messages of the batch and paging results containing next_key and total count. +message QueryPoolBatchSwapMsgsResponse { + repeated SwapMsgState swaps = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. not working on this version. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// the response type for the QueryPoolBatchSwapMsg RPC method. This includes a batch swap message of the batch +message QueryPoolBatchSwapMsgResponse { + SwapMsgState swap = 1 [(gogoproto.nullable) = false]; +} + +// the request type for the QueryPoolBatchDeposit RPC method. requestable including specified pool_id and pagination offset, limit, key. +message QueryPoolBatchDepositMsgsRequest { + // id of the target pool for query + uint64 pool_id = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// the request type for the QueryPoolBatchDeposit RPC method. requestable including specified pool_id and msg_index +message QueryPoolBatchDepositMsgRequest { + // id of the target pool for query + uint64 pool_id = 1; + // target msg_index of the pool + uint64 msg_index = 2; +} + +// the response type for the QueryPoolBatchDeposit RPC method. This includes a list of all currently existing deposit messages of the batch and paging results containing next_key and total count. +message QueryPoolBatchDepositMsgsResponse { + repeated DepositMsgState deposits = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. not working on this version. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// the response type for the QueryPoolBatchDepositMsg RPC method. This includes a batch swap message of the batch +message QueryPoolBatchDepositMsgResponse { + DepositMsgState deposit = 1 [(gogoproto.nullable) = false]; +} + + +// the request type for the QueryPoolBatchWithdraw RPC method. requestable including specified pool_id and pagination offset, limit, key. +message QueryPoolBatchWithdrawMsgsRequest { + // id of the target pool for query + uint64 pool_id = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// the request type for the QueryPoolBatchWithdraw RPC method. requestable including specified pool_id and msg_index +message QueryPoolBatchWithdrawMsgRequest { + // id of the target pool for query + uint64 pool_id = 1; + // target msg_index of the pool + uint64 msg_index = 2; +} + +// the response type for the QueryPoolBatchWithdraw RPC method. This includes a list of all currently existing withdraw messages of the batch and paging results containing next_key and total count. +message QueryPoolBatchWithdrawMsgsResponse { + repeated WithdrawMsgState withdraws = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. not working on this version. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// the response type for the QueryPoolBatchWithdrawMsg RPC method. This includes a batch swap message of the batch +message QueryPoolBatchWithdrawMsgResponse { + WithdrawMsgState withdraw = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/tendermint/liquidity/v1beta1/tx.proto b/proto/tendermint/liquidity/v1beta1/tx.proto new file mode 100644 index 000000000..f73f1ebbb --- /dev/null +++ b/proto/tendermint/liquidity/v1beta1/tx.proto @@ -0,0 +1,206 @@ +syntax = "proto3"; +package tendermint.liquidity.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/coin.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option go_package = "github.com/tendermint/liquidity/x/liquidity/types"; + +// Msg defines the liquidity Msg service. +service Msg { + + // Submit create liquidity pool message. + rpc CreatePool(MsgCreatePool) returns (MsgCreatePoolResponse); + + // Submit deposit to the liquidity pool batch. + rpc DepositWithinBatch(MsgDepositWithinBatch) returns (MsgDepositWithinBatchResponse); + + // Submit withdraw from the liquidity pool batch. + rpc WithdrawWithinBatch(MsgWithdrawWithinBatch) returns (MsgWithdrawWithinBatchResponse); + + // Submit swap to the liquidity pool batch. + rpc Swap(MsgSwapWithinBatch) returns (MsgSwapWithinBatchResponse); +} + +// MsgCreatePool defines an sdk.Msg type that creates a liquidity pool +// +// See: https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md +message MsgCreatePool { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string pool_creator_address = 1 [(gogoproto.moretags) = "yaml:\"pool_creator_address\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "account address of the origin of this message", + example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"", + format: "sdk.AccAddress" + }]; + + // id of the target pool type. Must match the value in the pool. + uint32 pool_type_id = 2 [(gogoproto.moretags) = "yaml:\"pool_type_id\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint32" + }]; + + // reserve coin pair to deposit to the pool + repeated cosmos.base.v1beta1.Coin deposit_coins = 4 [(gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"deposit_coins\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "[{\"denom\": \"denomX\", \"amount\": \"1000000\"}, {\"denom\": \"denomY\", \"amount\": \"2000000\"}]", + format: "sdk.Coins" + }]; +} + +// MsgCreatePoolResponse defines the Msg/CreatePool response type. +message MsgCreatePoolResponse {} + +// `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports submitting a deposit requests to the liquidity pool batch +// The deposit is submitted with the specified `pool_id` and reserve `deposit_coins` +// The deposit requests are stacked in the liquidity pool batch and are not immediately processed +// Batch deposit requests are processed in the `endblock` at the same time as other requests. +// +// See: https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md +message MsgDepositWithinBatch { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string depositor_address = 1 [(gogoproto.moretags) = "yaml:\"depositor_address\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "account address of the origin of this message", + example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"", + format: "sdk.AccAddress" + }]; + + // id of the target pool + uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // reserve coin pair of the pool to deposit + repeated cosmos.base.v1beta1.Coin deposit_coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"deposit_coins\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "[{\"denom\": \"denomX\", \"amount\": \"1000000\"}, {\"denom\": \"denomY\", \"amount\": \"2000000\"}]", + format: "sdk.Coins" + }]; + +} + +// MsgDepositWithinBatchResponse defines the Msg/DepositWithinBatch response type. +message MsgDepositWithinBatchResponse {} + +// `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that submits a withdraw request to the liquidity pool batch +// Withdraw submit to the batch from the Liquidity pool with the specified `pool_id`, `pool_coin` of the pool +// this requests are stacked in the batch of the liquidity pool, not immediately processed and +// processed in the `endblock` at once with other requests. +// +// See: https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md +message MsgWithdrawWithinBatch { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string withdrawer_address = 1 [ (gogoproto.moretags) = "yaml:\"withdrawer_address\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "account address of the origin of this message", + example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"", + format: "sdk.AccAddress" + }]; + // id of the target pool + uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + cosmos.base.v1beta1.Coin pool_coin = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"pool_coin\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"poolD35A0CC16EE598F90B044CE296A405BA9C381E38837599D96F2F70C2F02A23A4\", \"amount\": \"1000\"}", + format: "sdk.Coin" + }]; +} + +// MsgWithdrawWithinBatchResponse defines the Msg/WithdrawWithinBatch response type. +message MsgWithdrawWithinBatchResponse {} + +// `MsgSwapWithinBatch` defines an sdk.Msg type that submits a swap offer request to the liquidity pool batch +// Submit swap offer to the liquidity pool batch with the specified the `pool_id`, `swap_type_id`, +// `demand_coin_denom` with the coin and the price you're offering +// The `offer_coin_fee` must be half of the offer coin amount * current `params.swap_fee_rate` for reservation to pay fees +// This request is added to the pool and executed at the end of the batch (`endblock`) +// You must submit the request using the same fields as the pool +// Only the default `swap_type_id`1 is supported +// The detailed swap algorithm is shown here. +// +// See: https://github.com/tendermint/liquidity/tree/develop/doc +// https://github.com/tendermint/liquidity/blob/develop/x/liquidity/spec/04_messages.md +message MsgSwapWithinBatch { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // address of swap requester + string swap_requester_address = 1 [(gogoproto.moretags) = "yaml:\"swap_requester_address\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: "account address of the origin of this message", + example: "\"cosmos1e35y69rhrt7y4yce5l5u73sjnxu0l33wvznyun\"", + format: "sdk.AccAddress" + }]; + // id of the target pool + uint64 pool_id = 2 [(gogoproto.moretags) = "yaml:\"pool_id\"", (gogoproto.jsontag) = "pool_id", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint64" + }]; + + // id of swap type. Must match the value in the pool. + uint32 swap_type_id = 3 [(gogoproto.moretags) = "yaml:\"swap_type_id\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1\"", + format: "uint32" + }]; + + // offer sdk.coin for the swap request, must match the denom in the pool. + cosmos.base.v1beta1.Coin offer_coin = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"offer_coin\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"denomX\", \"amount\": \"1000000\"}", + format: "sdk.Coin" + }]; + + // denom of demand coin to be exchanged on the swap request, must match the denom in the pool. + string demand_coin_denom = 5 [(gogoproto.moretags) = "yaml:\"demand_coin_denom\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"denomB\"", + }]; + + // half of offer coin amount * params.swap_fee_rate for reservation to pay fees + cosmos.base.v1beta1.Coin offer_coin_fee = 6 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"offer_coin_fee\"", + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "{\"denom\": \"denomX\", \"amount\": \"5000\"}", + format: "sdk.Coin" + } + ]; + + // limit order price for the order, the price is the exchange ratio of X/Y where X is the amount of the first coin and + // Y is the amount of the second coin when their denoms are sorted alphabetically + string order_price = 7 [ + (gogoproto.moretags) = "yaml:\"order_price\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + example: "\"1.1\"", + format: "sdk.Dec" + }]; +} + +// MsgSwapWithinBatchResponse defines the Msg/Swap response type. +message MsgSwapWithinBatchResponse {}