syntax = "proto3";
package cyber.liquidity.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
// import "google/api/annotations.proto";
// import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cybercongress/go-cyber/x/liquidity/types";
// Msg defines the liquidity Msg service.
service Msg {
// Submit a create liquidity pool message.
rpc CreatePool(MsgCreatePool) returns (MsgCreatePoolResponse);
// Submit a deposit to the liquidity pool batch.
rpc DepositWithinBatch(MsgDepositWithinBatch)
returns (MsgDepositWithinBatchResponse);
// Submit a withdraw from the liquidity pool batch.
rpc WithdrawWithinBatch(MsgWithdrawWithinBatch)
returns (MsgWithdrawWithinBatchResponse);
// Submit a swap to the liquidity pool batch.
rpc Swap(MsgSwapWithinBatch) returns (MsgSwapWithinBatchResponse);
// rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgCreatePool defines an sdk.Msg type that supports submitting a create
// liquidity pool tx.
//
// See:
// https://github.com/gravity-devs/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\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
// id of the target pool type, must match the value in the pool. Only
// pool-type-id 1 is supported.
uint32 pool_type_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_type_id\"" ];
// reserve coin pair of the pool to deposit.
repeated cosmos.base.v1beta1.Coin deposit_coins = 4 [
(gogoproto.moretags) = "yaml:\"deposit_coins\"",
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// MsgCreatePoolResponse defines the Msg/CreatePool response type.
message MsgCreatePoolResponse {}
// `MsgDepositWithinBatch defines` an `sdk.Msg` type that supports submitting
// a deposit request to the batch of the liquidity pool.
// Deposit is submitted to the batch of the Liquidity pool with the specified
// `pool_id`, `deposit_coins` for reserve.
// This request is stacked in the batch of the liquidity pool, is not processed
// immediately, and is processed in the `endblock` at the same time as other
// requests.
//
// See:
// https://github.com/gravity-devs/liquidity/blob/develop/x/liquidity/spec/04_messages.md
message MsgDepositWithinBatch {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string depositor_address = 1 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(gogoproto.moretags) = "yaml:\"depositor_address\""
];
// id of the target pool
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
// reserve coin pair of the pool to deposit
repeated cosmos.base.v1beta1.Coin deposit_coins = 3 [
(gogoproto.moretags) = "yaml:\"deposit_coins\"",
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// MsgDepositWithinBatchResponse defines the Msg/DepositWithinBatch response
// type.
message MsgDepositWithinBatchResponse {}
// `MsgWithdrawWithinBatch` defines an `sdk.Msg` type that supports submitting
// a withdraw request to the batch of the liquidity pool.
// Withdraw is submitted to the batch from the Liquidity pool with the
// specified `pool_id`, `pool_coin` of the pool.
// This request is stacked in the batch of the liquidity pool, is not processed
// immediately, and is processed in the `endblock` at the same time as other
// requests.
//
// See:
// https://github.com/gravity-devs/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\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
// id of the target pool
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
cosmos.base.v1beta1.Coin pool_coin = 3 [
(gogoproto.moretags) = "yaml:\"pool_coin\"",
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin"
];
}
// MsgWithdrawWithinBatchResponse defines the Msg/WithdrawWithinBatch response
// type.
message MsgWithdrawWithinBatchResponse {}
// `MsgSwapWithinBatch` defines an sdk.Msg type that supports submitting a swap
// offer request to the batch of the liquidity pool. 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
// and `offer_coin_fee` must be half of offer coin amount * current
// `params.swap_fee_rate` and ceil for reservation to pay fees. This request is
// stacked in the batch of the liquidity pool, is not processed immediately, and
// is processed in the `endblock` at the same time as other requests. You must
// request the same fields as the pool. Only the default `swap_type_id` 1 is
// supported.
//
// See: https://github.com/gravity-devs/liquidity/tree/develop/doc
// https://github.com/gravity-devs/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\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
// id of swap type, must match the value in the pool. Only `swap_type_id` 1 is
// supported.
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
// id of swap type. Must match the value in the pool.
uint32 swap_type_id = 3 [ (gogoproto.moretags) = "yaml:\"swap_type_id\"" ];
// offer sdk.coin for the swap request, must match the denom in the pool.
cosmos.base.v1beta1.Coin offer_coin = 4 [
(gogoproto.moretags) = "yaml:\"offer_coin\"",
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.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\"" ];
// half of offer coin amount * params.swap_fee_rate and ceil for reservation
// to pay fees.
cosmos.base.v1beta1.Coin offer_coin_fee = 6 [
(gogoproto.moretags) = "yaml:\"offer_coin_fee\"",
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.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\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
// MsgSwapWithinBatchResponse defines the Msg/Swap response type.
message MsgSwapWithinBatchResponse {}
// TODO revisit this and apply, there is issue with cyclic dependency with
// Params import message MsgUpdateParams {
// option (cosmos.msg.v1.signer) = "authority";
//
// string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
//
// Params params = 2 [ (gogoproto.nullable) = false ];
// }
//
// message MsgUpdateParamsResponse {}