Messages
Messages (Msg) are objects that trigger state transitions. Msgs are wrapped in transactions (Txs) that clients submit to the network. The Cosmos SDK wraps and unwraps liquidity module messages from transactions.
MsgCreatePool
A liquidity pool is created and initial coins are deposited with the MsgCreatePool message.
Validity Checks
Validity checks are performed for MsgCreatePool messages. The transaction that is triggered with MsgCreatePool fails if:
- if
params.CircuitBreakerEnabledis true PoolCreatoraddress does not existPoolTypeIddoes not exist in parameters- A duplicate
LiquidityPoolwith samePoolTypeIdandReserveCoinDenomsexists - One or more coins in
ReserveCoinDenomsdo not exist inbankmodule - The balance of
PoolCreatordoes not have enough amount of coins forDepositCoins - The balance of
PoolCreatordoes not have enough coins forPoolCreationFee
MsgDepositWithinBatch
Coins are deposited in a batch to a liquidity pool with the MsgDepositWithinBatch message.
Validity Checks
The MsgDepositWithinBatch message performs validity checks. The transaction that is triggered with the MsgDepositWithinBatch message fails if:
- if
params.CircuitBreakerEnabledis true Depositoraddress does not existPoolIddoes not exist- The denoms of
DepositCoinsare not composed of existingReserveCoinDenomsof the specifiedLiquidityPool - The balance of
Depositordoes not have enough coins forDepositCoins
MsgWithdrawWithinBatch
Withdraw coins in batch from liquidity pool with the MsgWithdrawWithinBatch message.
Validity Checks
The MsgWithdrawWithinBatch message performs validity checks. The transaction that is triggered with the MsgWithdrawWithinBatch message fails if:
Withdraweraddress does not existPoolIddoes not exist- The denom of
PoolCoinare not equal to thePoolCoinDenomof theLiquidityPool - The balance of
Depositordoes not have enough coins forPoolCoin
MsgSwapWithinBatch
Swap coins between liquidity pools in batch with the MsgSwapWithinBatch message.
Offer coins are swapped with demand coins for the given order price.
Validity checks
The MsgSwapWithinBatch message performs validity checks. The transaction that is triggered with the MsgSwapWithinBatch message fails if:
- if
params.CircuitBreakerEnabledis true SwapRequesteraddress does not existPoolIddoes not existSwapTypeIddoes not exist- Denoms of
OfferCoinorDemandCoindo not exist inbankmodule - The balance of
SwapRequesterdoes not have enough coins forOfferCoin OrderPrice<= zeroOfferCoinFeeequalsOfferCoin*params.SwapFeeRate*0.5with ceiling- Has sufficient balance
OfferCoinFeeto reserve offer coin fee