Pool types
There are two pool types: constant product (XYK) and stableswap.XYK Pool
The XYK pool uses a constant product invariant: Where X and Y are the reserves for each token, and k is constant. To determine the ask asset amount (\Delta y) given the offered asset (\Delta x): The spread between executed and expected trade is:Stableswap
Implements the StableSwap curve described by Curve:https://curve.fi/files/stableswap-paper.pdf.
Supports 2–4 assets and is designed for low slippage stable-asset trading.
Instantiate
ExecuteMsg
CreatePool
Creates a new pool with assets, decimals, fees, pool type, and identifier. Pool identifiers:- Auto-assigned pools get prefix
p.(e.g.p.1) - Custom identifiers get prefix
o.(e.g.o.my_pool)
Pool identifiers are immutable on-chain strings. Existing pools created before the rebranding may still reference legacy denom names (e.g.
uom) in their identifiers.XYK example
Stableswap example
ProvideLiquidity
Provides liquidity to a pool. Iflock_position_identifier is set, LP tokens are locked in the farm manager for the specified duration; otherwise they are sent to the receiver.
Swap
Swaps an offer asset to an ask asset in a specific pool. Offer amount is provided ininfo.funds.
WithdrawLiquidity
Withdraws liquidity from a pool. LP tokens must be sent with the transaction.ExecuteSwapOperations
Executes multiple swap operations (multi-hop). Routes are computed off-chain.UpdateConfig
UpdateOwnership (::cw_ownable)
QueryMsg
Config
AssetDecimals
Simulation
ReverseSimulation
SimulateSwapOperations / ReverseSimulateSwapOperations
See legacy examples in_tmp_gitbook/mantra-smart-contracts/mantra-swap/pool-manager.md (ported here verbatim in structure).