Module
Liquidity
A constant-product automated market maker. It holds two-denom pools, mints LP shares through the token factory, and governs the whole pool lifecycle.
On-chain name: liquidity · Consensus version 5
What the module owns
- The LP share denom is always
factory/liquidity/pool/{pool_id}and is only ever administered by the liquidity module account. - Every number is an integer and every division floors. The fee scale is 1,000,000 parts per million, and a message that leaves the field empty defaults to a 3,000 ppm swap fee, 300,000 ppm to LPs and 700,000 ppm to stakers.
- A swap too small to cover its own fee is rejected rather than rounded to a zero output.
- Caps: 10,000 pools, 10,000 farm positions with 1,000 per pool, 100,000 lots with 10,000 per position, 64 denoms per fee record.
Key features
Constant-product AMM
Two-denom pools with constant-product pricing. LP shares minted through token factory.
LP farming
Stake LP shares to earn emission rewards. Configurable emission schedules per pool.
Pool lifecycle
Create, pause, resume, close pools. Pool owner controls fees, ownership, emission schedules.
Fee split
Swap fee split: default 300,000 ppm to LPs, 700,000 ppm to stakers. Configurable per pool.
Messages
- MsgCreatePool -- Create a new two-denom pool with initial liquidity.
- MsgAddLiquidity -- Add liquidity to an existing pool (mints LP shares).
- MsgRemoveLiquidity -- Remove liquidity (burns LP shares, returns underlying).
- MsgSwap -- Swap one denom for another within the pool.
- MsgSwapExactAmountIn / MsgSwapExactAmountOut -- Exact input/output swaps.
- MsgCreateFarm -- Create a farming position for a pool.
- MsgStakeFarm / MsgUnstakeFarm -- Stake/unstake LP shares in a farm.
- MsgClaimFarmRewards -- Claim accumulated farming rewards.
- MsgUpdatePoolFee / MsgUpdatePoolOwner -- Pool owner actions.
- MsgPausePool / MsgResumePool / MsgClosePool -- Pool lifecycle control.
Queries
- Pool / Pools -- Fetch a single pool or paginated list of pools.
- PoolLiquidity -- Current reserves of both denoms in a pool.
- PoolFee -- Current swap fee configuration.
- Farm / Farms -- Farm configuration and emission state.
- FarmPosition / FarmPositions -- User's staked LP shares and unclaimed rewards.
- FeeRecord / FeeRecords -- Historical fee accumulation records.
- Params -- Module parameters (caps, default fee, etc.).
Caps and limits
- Total pools: ≤ 10,000
- Farm positions: ≤ 10,000 total, ≤ 1,000 per pool
- Lots: ≤ 100,000 total, ≤ 10,000 per position
- Denoms per fee record: ≤ 64
- Default swap fee: 3,000 ppm
- Default LP share: 300,000 ppm, Staker share: 700,000 ppm
Integration guide
Provide liquidity or swap
LP farming
Where the rules live
Liquidity mints LP shares through the token factory, and the LP denom is fixed tofactory/liquidity/pool/{pool_id}. The liquidity module account is the only admin of the LP denom.