MANTRA Chain
  • Introduction
    • Overview
    • Why MANTRA Chain
    • Building on MANTRA Chain
    • MANTRA RWA Suite
  • Using MANTRA Chain
    • MANTRA Chain Wallet Setup
      • Connect to Testnet
      • Connect to Mainnet
      • Testnet Faucet
    • MANTRA Zone
    • MANTRA Bridge
      • MANTRA Bridge User Guide
      • MANTRA Bridge FAQs
    • Stake
      • Stake User Guide
      • Stake FAQs
    • MANTRA Swap
      • MANTRA Swap User Guide
      • Liquidity Pools User Guide
      • MANTRA Swap FAQs
    • Claiming Journey
      • Check If You're Eligible
      • Claiming Journey User Guide
      • I've redeemed my rewards, now what?
    • Chakra Pool
      • What can I do with my USDY
      • Chakra Pool Deposit Guide
      • How KARMA works for Chakra Pool
        • How much KARMA do I get for depositing into Chakra Pool?
        • Can I make multiple deposits and how will KARMA be calculated then?
        • My KARMA is not updated even though I make multiple deposits?
        • Will I get daily KARMA for my deposit on USDY Chakra Pool launched on Hongbai earlier?
      • Chakra Pool FAQs
    • MANTRA Zone Leaderboard
      • MANTRA Zone Leaderboard User Guide
        • Mission Guides
          • Pledge your OM 🕉️
          • Claim OM Staking Rewards
          • OMly Drip 💧
      • MANTRA Zone Leaderboard FAQs
  • Developing on MANTRA Chain
    • Getting Started
      • DuKong Testnet
      • Install Prerequisites
      • Setting Up Dev Environment
      • Compiling a Contract
      • Deployment and Interaction
    • CosmWasm Quick Start Guide
      • CosmWasm Contracts
      • Understanding CosmWasm File Structure
    • DAPP Tooling
      • Cosmos SDK
      • Important Libraries
      • Developer Resources
    • Developer FAQs
  • MANTRA Smart Contracts
    • Overview
    • MANTRA Dex
      • 🚢Deployments
      • 📚Common Types
      • 💰Fee Collector
      • ⌛Epoch Manager
      • 🌊Pool Manager
      • 🎁Farm Manager
    • Claimdrop Contract
    • Audits
  • Node & Validator Operations
    • Overview
    • Node Setup & Deployment
      • Node System Requirements
      • Running a Node
      • How to run Mantrachain with Systemd
      • Validator Nodes
        • Connect sidecar
    • Validator Architecture Recommendations
      • Secure Validator
    • Governance
      • Draft a Proposal
        • Text Proposal
        • Community Spend Proposal
        • Software Upgrade
        • Cancel Software Upgrade
      • Submitting a Proposal
      • Verifying your transaction
      • Depositing funds
      • Voting on a Proposal
    • Download nodes snapshots
  • MANTRA Chain with EVM (Alpha)
    • Getting Started on OMSTEAD Testnet
  • Setup Instructions
  • Using Foundry
    • Deployment with Foundry
  • Using Hardhat
    • Deployment with Hardhat
  • Mainnet OM Information
    • Background
    • Updated OM Tokenomics
    • OM Distribution Updates
    • Inflation & Vesting Schedule
    • Legacy tokens to mainnet staking tokens
  • Appendix
    • Frequently Asked Questions
      • General FAQs
        • What is MANTRA Chain?
        • What are the key features/ modules available to builders on MANTRA Chain?
        • What support is available for developers and validators that join the ecosystem
        • Where can i find MANTRA Social Accounts & Communities?
        • How can an Issue or a bug be reported?
        • How can I identify official MANTRA communication and websites?
      • Validator FAQs
        • What does a new validator’s journey look like?
        • What are my key responsibilities as a validator?
        • What is uptime and how is it maintained?
        • What are the hardware requirements?
        • How to get validator keys?
        • How can I connect a validator from an older testnet to the newest testnet?
        • How do I create a backup snapshot of a node?
        • How do I restore a node from a snapshot?
        • What are the different states a validator can be in?
        • How do I unjail a validator?
        • How do I edit a validator's description?
        • What is self-delegation?
        • Is there a minimum amount of OM that must be delegated to be an active validator?
      • Developer FAQs
        • What is MANTRA Chain, and how does it utilize the Cosmos ecosystem?
        • How does MANTRA Chain ensure interoperability with other blockchains in the Cosmos ecosystem?
        • What is the Cosmos ecosystem, and how does it differ from other blockchain platforms?
        • Which programming languages are commonly used for developing on the Cosmos ecosystem?
        • How do I get started with development on the Cosmos ecosystem?
        • What are Cosmos SDK and Tendermint, and how do they work together?
        • What are Cosmos zones and how do they interact?
        • How do I build and deploy smart contracts on the Cosmos ecosystem?
        • How do I interact with Cosmos chains and applications programmatically?
        • What is the best way to learn about developing for the MANTRA Chain and Cosmos ecosystem?
      • Hongbai FAQs
        • Where do I sign up for Hongbai?
        • Why do I need to provide 2 wallets during signup?
        • How can I Login?
        • What should I do if I forgot my password?
        • What can I do if i forget my registered email?
        • Where do i verify my email?
        • How to connect my Metamask wallet?
        • Is Hongbai app a testnet or live app?
        • Can I change my wallet ?
        • Error “invalid user credentials“
        • Why can i not Invest?
      • How to Guides
        • Install Keplr Wallet
        • Keplr and Ledger
        • Add DuKong Testnet to Keplr
        • Get Tokens from Faucet
        • Track activity on Leaderboard
      • More Help & Support
      • MANTRA Zone FAQs
        • MANTRA Zone General FAQs
          • What wallets are currently supported on the MANTRA Zone?
          • How do I connect my wallet to the MANTRA Zone?
          • How do I copy my connected wallet’s address?
          • How do I connect a different wallet to the MANTRA Zone?
          • Can I disconnect my wallet from MANTRA Zone?
          • How can I resolve seeing multiple entires of the same amount of testnet OM in my Keplr wallet?
          • The question that I have is not covered by the FAQ, what should I do?
        • MANTRA Bridge FAQs
          • What is MANTRA Bridge?
          • Why should I use the MANTRA Bridge?
          • Is there a fee for using the MANTRA Bridge?
          • Do I have to pay gas fees?
          • What tokens will I receive?
          • How does the migration process work?
          • How long should the MANTRA Bridge order take?
          • How can I track the status of my MANTRA Bridge order?
          • What happens to my ERC20 OM tokens once I use the MANTRA Bridge?
          • Which network can I use on the MANTRA Bridge?
          • What should I do if I see ‘Wrong network’ error on the app?
          • Will there be a two-way bridge in the future?
          • My MANTRA Bridge order is stuck on Ethereum?! How can I fix this?
          • Who can I contact for support during the migration process?
          • Which EVM chains can I bridge from?
          • Are the OM tokens I receive wrapped tokens or the native MANTRA Chain OM tokens?
          • Is the MANTRA Bridge a non-custodial solution?
          • What happens if the MANTRA Bridge is hacked or goes offline?
          • Are there any risks associated with using the MANTRA Bridge?
          • How does the MANTRA Bridge ensure the security of my tokens during migration?
          • Can I use my existing Ethereum wallet to access the MANTRA Bridge?
          • How does wallet linking and airdrop participation work?
        • Stake FAQs
          • What is Stake?
          • What are validators, and how do I choose one?
          • What rewards can I earn by staking $OM?
          • How are staking rewards calculated?
          • Can I choose to unstake my $OM coins?
          • What is the unbonding period?
          • Can I change validators after staking $OM?
          • Can I stake $OM with multiple validators?
          • Are there any risks involved with staking $OM?
          • Will my rewards gets automatically restaked after redemption?
          • Do I lose my claimable rewards when performing actions with a validator with unclaimed rewards?
          • My wallet is showing a 0 balance even though I have funds. What should I do?
          • How do I know if my $OM is staked?
        • Chakra Pool FAQs
          • What are the Chakra Pool rewards?
          • What is USDY?
          • How do I get the yield from the treasury bonds by holding USDY?
          • Can I change my linked wallet?
          • I don’t remember my linked wallet - what can I do?
          • What are the bonus rewards and where I can see my rewards?
          • How are the USDY rewards calculated and when can I redeem my USDY rewards?
          • How are the $OM rewards calculated and when can I redeem my $OM rewards?
          • How are the $ONDO rewards calculated and when can I redeem my $ONDO rewards?
          • What can I do with my USDY and $OM rewards after redemption?
        • MANTRA Zone Leaderboard FAQs
          • I have someone that wants to participate in the MANTRA Zone Leaderboard but they don’t know how.
          • What does the ⚡icon and ‘Get + x KARMA’ text under the ‘KARMA’ section refer to?
          • The KARMA on the Zone Leaderboard only lists MANTRA Chain wallets, how to check my EVM wallet rank?
          • Which wallet IDs are visible on the Leaderboard Ranking Table?
          • Why are there three different categories for the Leaderboard Ranking Table?
          • How can I get the Leaderboard Ranking Table to show where my connected wallet ranks currently?
          • How can I search where a specific wallet ID ranks in the Leaderboard Ranking Table?
          • How can I search what wallet ID currently ranks in a specific ranking number?
          • My KARMA and/or multiplier amount did not update on the Leaderboard Ranking Table, why is that?
          • What is the calculation for the KARMA?
          • I’m unable to see the OMly Faucet on my Keplr/Cosmostation wallet
          • I'm unable to see my OMly Faucet Claim transaction on the explorer
          • The question that I have is not covered by the FAQ, what should I do?
        • MANTRA Swap FAQs
          • What is Swap?
          • How can I swap?
          • I have connected my EVM wallet, but I’m still unable to swap. Why?
          • Where can I view my past transactions?
          • Why is my swap button disabled?
          • Why can’t I swap with a slippage more than 5%?
          • What is Exchange Rate?
          • How do I get OM tokens in my wallet?
          • How do I get other tokens in my wallet?
          • Will the swap fee be deducted from my sell or buy token?
          • Why can’t I see the balance of tokens in my wallet but on the Swap panel?
          • How do I add liquidity to a pool?
          • I am unable to provide liquidity to the pool.
          • While adding liquidity, why are the two tokens USD value not equal?
          • How do I withdraw my funds from Liquidity Pools?
          • Why can I not see my tokens for withdrawal?
          • Why can I not remove liquidity?
          • Why is my deposited value of the two tokens changing in my position?
          • Do liquidity pools have a bonding period?
          • What are LP tokens?
          • What can I do with my LP tokens?
          • Why can I not see any LP token balance?
          • I am connected with my MANTRA wallet, but still cannot view my positions?
          • I provided liquidity, but I can’t see my position. What should I do?
          • Why is my transaction not successful?
    • Glossary
    • MANTRA's Incentivised Testnet
      • Testnet Phase 1
      • Hongbai - Testnet Phase 2
  • Third Party Bridges
    • Base Bridge
    • Polygon Bridge
Powered by GitBook
On this page
  • Pool types
  • XYK Pool
  • Stableswap
  • Instantiate
  • ExecuteMsg
  • CreatePool
  • ProvideLiquidity
  • Swap
  • WithdrawLiquidity
  • ExecuteSwapOperations
  • UpdateConfig
  • UpdateOwnership(::cw_ownable::Action)
  • QueryMsg
  • Config
  • AssetDecimals
  • Simulation
  • ReverseSimulation
  • SimulateSwapOperations
  • ReverseSimulateSwapOperations
  • Pools
  • Ownership
  • MigrateMsg
  1. MANTRA Smart Contracts
  2. MANTRA Dex

Pool Manager

PreviousEpoch ManagerNextFarm Manager

Last updated 1 month ago

The Pool Manager is a contract that handles liquidity pools in the MANTRA DEX. The contract facilitates the creation and management of various types of liquidity pools, liquidity provision, token swaps, and multi-hop operations across different pools.

The Pool Manager enables permissionless creation of liquidity pools, requiring a fee to prevent spam. It supports multiple pools for the same asset pair, each with a unique identifier. Users can provide liquidity, perform swaps, and execute multi-hop operations across different pools.

Pool types

There are two types of pools supported by the Pool Manager, constant product (xyk) and stableswaps.

XYK Pool

The xyk pool is based on a constant product invariant:

XY=kXY=kXY=k

Where X and Y are the reserves for each token in the pool, while k is a constant. The product of the number of tokens on each side of the pool should remain constant across trading operations. With X being the current balance of the pool's source asset and Y being that of the target asset:

XY=k=(X+∆x)(Y−∆y)XY=k=(X+∆x)(Y−∆y)XY=k=(X+∆x)(Y−∆y)

To determine the value of the ask asset ∆y given the trader's offered asset ∆x:

∆y=Y∆x/(X+∆x)∆y = Y∆x/(X+∆x)∆y=Y∆x/(X+∆x)

The market price is calculated by dividing the number of pool's target token into the source asset (also called the pool ratio).

The spread between the executed and the expected trade is:

The deeper the pool the smaller the spread.

Stableswap

It is possible to create a stableswap pool with 2-4 assets in it, and it is designed to have a low slippage for stable assets, making it ideal for stablecoin trading.

Instantiate

Instantiates an instance of the pool manager contract

{
  "fee_collector_addr": "mantra1...",
  "farm_manager_addr": "mantra1...",
  "pool_creation_fee": {
    "denom": "uom",
    "amount": "1000000000"
  }
}
Key
Type
Description

fee_collector_addr

String

The fee collector contract address.

farm_manager_addr

String

The farm manager contract address.

pool_creation_fee

Coin

How much it costs to create a pool.

ExecuteMsg

CreatePool

Creates a new pool with the provided assets, their decimals for calculation fees, pool type and the identifier for a pool.

Creation of pools in the pool manager is permissionless, but a fee must be paid to create a pool which is specified in the contract configuration. Additionally, the user creating the pool must pay the token factory fee to create a subdenom, since the pool manager uses the token factory to issue the LP tokens.

All pools and their information are stored in the pool manager contract on the POOLS map, and any amount of pools with any variation of assets can be created.

For example, two or more pools with the assets uom and uusdc can be created at anytime with different pool identifiers. A good example is two pools, same assets different pool types (stableswap vs constant product) however any variation is possible.

The contract will assign a prefix to the pool identifier. If the user creates a pool without specifying a custom identifier, the contract will assign the prefix p., followed by a number. For example, p.1, p.2, etc. On the other hand, if the user specifies a custom identifier, the contract will use the prefix o., followed by the custom identifier. For example, o.my_pool.

{
  "create_pool": {
    "asset_denoms": [
      "uom",
      "uusdc"
    ],
    "asset_decimals": [
      6,
      6
    ],
    "pool_fees": {
      "protocol_fee": {
        "share": "0.001"
      },
      "swap_fee": {
        "share": "0.002"
      },
      "burn_fee": {
        "share": "0"
      },
      "extra_fees": [
        {
          "share": "0.001"
        }
      ]
    },
    "pool_type": "constant_product",
    "pool_identifier": "uom.uusdy.pool"
  }
}
{
  "create_pool": {
    "asset_denoms": [
      "uusdt",
      "uusdc"
    ],
    "asset_decimals": [
      6,
      6
    ],
    "pool_fees": {
      "protocol_fee": {
        "share": "0.0002"
      },
      "swap_fee": {
        "share": "0.0003"
      },
      "burn_fee": {
        "share": "0"
      },
      "extra_fees": []
    },
    "pool_type": {
      "stable_swap": {
        "amp": 85
      }
    },
    "pool_identifier": "uusdt.uusdc.pool"
  }
}
Key
Type
Description

asset_denoms

Vec<String>

The asset denoms for the pool.

asset_decimals

Vec<u8>

The decimals for the given asset denoms, provided in the same order as asset_denoms.

pool_fees

PoolFee

The fees for the pool.

pool_type

PoolType

The type of pool to create. It can be either constant product or stableswap.

pool_identifier

Option<String>

The identifier for the pool. If not set, a number (pool counter) will be assigned as pool id.

ProvideLiquidity

Provides liquidity to the pool specified by the pool_identifier. Liquidity balances are stored on a per-pool basis in order to not double count the assets of other pools with the same assets.

If lock_position_identifier is provided, the LP tokens will be locked in the farm manager for the specified duration.

Otherwise, the LP tokens will be sent to the receiver address.

The amount of liquidity to be provided is determined by the amount of assets provided in info.funds. If only one asset is provided then a single sided liquidity provision will be attempted.

Note: It's only possible to lock an LP position in the farm for the same user providing the liquidity, and not do it on behalf of another user.

{
  "provide_liquidity": {
    "slippage_tolerance": "0.01",
    "max_spread": "0.1",
    "receiver": "mantra1...",
    "pool_identifier": "uom.uusdy.pool",
    "unlocking_duration": 2678400,
    "lock_position_identifier": "lp.lock.identifier"
  }
}
Key
Type
Description

slippage_tolerance

Option<Decimal>

A percentage value representing the acceptable slippage for the operation. When provided, if the slippage exceeds this value, the liquidity provision will not be executed.

max_spread

Option<Decimal>

The decimals for the given asset denoms, provided in the same order as asset_denoms. The maximum allowable spread between the bid and ask prices for the pool. When provided, if the spread exceeds this value, the liquidity provision will not be executed.

receiver

Option<String>

The receiver of the LP.

pool_identifier

String

The identifier for the pool to provide liquidity for.

unlocking_duration

Option<u64>

The amount of time in seconds to unlock tokens if taking part on the farms. If not passed, the tokens will not be locked and the LP tokens will be returned to the user.

lock_position_identifier

Option<String>

The identifier of the position to lock the LP tokens in the farm manager, if any.

Swap

Swaps an offer asset to another asset in the pool specified by the pool_identifier. By providing a pool identifier when performing a swap, only the desired asset need be specified in the swap message The amount to be swapped is provided in info.funds

{
  "swap": {
    "ask_asset_denom": "uusdc",
    "belief_price": "0.5",
    "max_spread": "5000",
    "receiver": "mantra1...",
    "pool_identifier": "uom.uusdy.pool"
  }
}
Key
Type
Description

ask_asset_denom

String

The return asset of the swap.

belief_price

Option<Decimal>

The belief price of the swap.

max_spread

Option<Decimal>

The maximum spread to incur when performing the swap. If the spread exceeds this value, the swap will not be executed.

receiver

Option<String>

The recipient of the output tokens. If not provided, the tokens will be sent to the sender of the message.

pool_identifier

String

The identifier for the pool to swap in.

WithdrawLiquidity

Withdraws liquidity from the pool specified by the pool_identifier. A withdrawal of liquidity will result in the burning of any LP tokens that are returned as a part of the withdrawal. The LP token should be sent in the transaction.

{
  "withdraw_liquidity": {
    "pool_identifier": "uom.uusdy.pool"
  }
}
Key
Type
Description

pool_identifier

String

The identifier for the pool to withdraw from.

ExecuteSwapOperations

Execute multiple SwapOperations to allow for multi-hop swaps. The routes are to be computed off-chain and passed in to the contract.

{
  "execute_swap_operations": {
    "operations": [
      {
        "mantra_swap": {
          "token_in_denom": "uluna",
          "token_out_denom": "uom",
          "pool_identifier": "uluna_uom_pool"
        }
      },
      {
        "mantra_swap": {
          "token_in_denom": "uom",
          "token_out_denom": "uusdc",
          "pool_identifier": "uom.uusdy.pool"
        }
      }
    ],
    "minimum_receive": "1000000",
    "receiver": "mantra1...",
    "max_spread": "0.1"
  }
}
Key
Type
Description

operations

Vec<SwapOperation>

The operations that should be performed in sequence. The amount in each swap will be the output from the previous swap. The first swap will use whatever funds are sent in the [MessageInfo].

minimum_receive

Option<Uint128>

The minimum amount of the output (i.e., final swap operation token) required for the message to succeed.

receiver

Option<String>

The (optional) recipient of the output tokens. If left unspecified, tokens will be sent to the sender of the message.

max_spread

Option<Decimal>

The (optional) maximum spread to incur when performing any swap. Maximum 50%. If left unspecified, it will use the default max spread value from the contract.

UpdateConfig

Updates the configuration of the contract. If a field is not specified (i.e., set to None), it will not be modified.

{
  "update_config": {
    "fee_collector_addr": "mantra1...",
    "farm_manager_addr": "mantra1...",
    "pool_creation_fee": {
      "denom": "uom",
      "amount": "1000000000"
    },
    "feature_toggle": {
      "withdrawals_enabled": true,
      "deposits_enabled": true,
      "swaps_enabled": true
    }
  }
}
Key
Type
Description

fee_collector_addr

Option<String>

The new fee collector contract address.

farm_manager_addr

Option<String>

The new farm manager contract address.

pool_creation_fee

Option<Coin>

The new fee that must be paid when a pool is created.

feature_toggle

Option<FeatureToggle>

The new feature toggles of the contract, allowing fine-tuned control over which operations are allowed.

UpdateOwnership(::cw_ownable::Action)

Implements cw_ownable. Updates the contract's ownership. ::cw_ownable::Action can be TransferOwnership, AcceptOwnership and RenounceOwnership.

Note: This is a cw_ownable message.

Propose to transfer the contract's ownership to another account, optionally with an expiry time. Can only be called by the contract's current owner. Any existing pending ownership transfer is overwritten.

{
  "update_ownership": {
    "transfer_ownership": {
      "new_owner": "mantra1...",
      "expiry": {
        "at_height": "424242424242"
      }
    }
  }
}
Key
Type
Description

new_owner

String

The new owner proposed,

expiry

Option<Expiration>

Optional expiration time parameter.

Accept the pending ownership transfer. Can only be called by the pending owner.

{
  "update_ownership": "accept_ownership"
}

Give up the contract's ownership and the possibility of appointing a new owner. Can only be invoked by the contract's current owner. Any existing pending ownership transfer is canceled.

{
  "update_ownership": "renounce_ownership"
}

QueryMsg

Config

Returns the configuration of the contract.

{
  "config": {}
}
{
  "config": {
    "fee_collector_addr": "mantra1...",
    "farm_manager_addr": "mantra1...",
    "pool_creation_fee": {
      "denom": "uom",
      "amount": "1000000"
    },
    "feature_toggle": {
      "withdrawals_enabled": true,
      "deposits_enabled": true,
      "swaps_enabled": true
    }
  }
}
Key
Type
Description

config

Config

The contract configuration.

AssetDecimals

Retrieves the decimals for the given asset in a specific pool.

{
  "asset_decimals": {
    "pool_identifier": "om-usdc-1",
    "denom": "uom"
  }
}
Key
Type
Description

pool_identifier

String

The pool identifier to do the query for.

denom

String

The queried denom in the given pool_identifier.

{
  "pool_identifier": "om-usdc-1",
  "denom": "uom",
  "decimals": 6
}
Key
Type
Description

pool_identifier

String

The pool identifier to do the query for.

denom

String

The queried denom in the given pool_identifier.

decimals

u8

The decimals for the requested denom.

Simulation

Simulates a swap.

{
  "simulation": {
    "offer_asset": {
      "denom": "uom",
      "amount": "1000000"
    },
    "ask_asset_denom": "uusdc",
    "pool_identifier": "om-usdc-1"
  }
}
Key
Type
Description

offer_asset

Coin

The offer asset to swap.

ask_asset_denom

String

The ask asset denom to get.

pool_identifier

String

The pool identifier to swap in.

{
  "return_amount": "990000",
  "spread_amount": "5000",
  "swap_fee_amount": "3000",
  "protocol_fee_amount": "2000",
  "burn_fee_amount": "0",
  "extra_fees_amount": "0"
}
Key
Type
Description

return_amount

Uint128

The return amount of the ask asset given the offer amount.

spread_amount

Uint128

The spread amount of the swap.

swap_fee_amount

Uint128

The swap fee amount of the swap.

protocol_fee_amount

Uint128

The protocol fee amount of the swap.

burn_fee_amount

Uint128

The burn fee amount of the swap.

extra_fees_amount

Uint128

The extra fees amount of the swap.

ReverseSimulation

Simulates a reverse swap.

{
  "reverse_simulation": {
    "ask_asset": {
      "denom": "uusdc",
      "amount": "990000"
    },
    "offer_asset_denom": "uom",
    "pool_identifier": "om-usdc-1"
  }
}
Key
Type
Description

ask_asset

Coin

The ask asset to get after the swap.

offer_asset_denom

String

The offer asset denom to input.

pool_identifier

String

The pool identifier to swap in.

{
  "offer_amount": "1000000",
  "spread_amount": "5000",
  "swap_fee_amount": "3000",
  "protocol_fee_amount": "2000",
  "burn_fee_amount": "0",
  "extra_fees_amount": "0"
}
Key
Type
Description

offer_amount

Uint128

The amount of the offer asset needed to get the ask amount.

spread_amount

Uint128

The spread amount of the swap.

swap_fee_amount

Uint128

The swap fee amount of the swap.

protocol_fee_amount

Uint128

The protocol fee amount of the swap.

burn_fee_amount

Uint128

The burn fee amount of the swap.

extra_fees_amount

Uint128

The extra fees amount of the swap.

SimulateSwapOperations

Simulates swap operations.

{
  "simulate_swap_operations": {
    "offer_amount": "1000000",
    "operations": [
      {
        "mantra_swap": {
          "token_in_denom": "uom",
          "token_out_denom": "uusdc",
          "pool_identifier": "om-usdc-1"
        }
      },
      {
        "mantra_swap": {
          "token_in_denom": "uusdc",
          "token_out_denom": "uatom",
          "pool_identifier": "usdc-atom-1"
        }
      }
    ]
  }
}
Key
Type
Description

offer_amount

Uint128

The amount to swap.

operations

Vec<SwapOperation>

The operations to perform.

{
  "return_amount": "980000",
  "spreads": [
    {
      "denom": "uusdc",
      "amount": "3"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ],
  "swap_fees": [
    {
      "denom": "uusdc",
      "amount": "500"
    },
    {
      "denom": "uatom",
      "amount": "100"
    }
  ],
  "protocol_fees": [
    {
      "denom": "uusdc",
      "amount": "100"
    },
    {
      "denom": "uatom",
      "amount": "50"
    }
  ],
  "burn_fees": [
    {
      "denom": "uusdc",
      "amount": "10"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ],
  "extra_fees": [
    {
      "denom": "uusdc",
      "amount": "5"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ]
}
Key
Type
Description

return_amount

Uint128

The return amount of the ask asset after the swap operations.

spreads

Vec<Coin>

The spreads of the swap.

swap_fees

Vec<Coin>

The swap fees of the swap.

protocol_fees

Vec<Coin>

The protocol fees of the swap.

burn_fees

Vec<Coin>

The burn fees of the swap.

extra_fees

Vec<Coin>

The extra fees of the swap.

ReverseSimulateSwapOperations

Simulates reverse swap operations.

{
  "reverse_simulate_swap_operations": {
    "ask_amount": "980000",
    "operations": [
      {
        "mantra_swap": {
          "token_in_denom": "uom",
          "token_out_denom": "uusdc",
          "pool_identifier": "om-usdc-1"
        }
      },
      {
        "mantra_swap": {
          "token_in_denom": "uusdc",
          "token_out_denom": "uatom",
          "pool_identifier": "usdc-atom-1"
        }
      }
    ]
  }
}
Key
Type
Description

ask_amount

Uint128

The amount to get after the swap.

operations

Vec<SwapOperation>

The operations to perform.

{
  "offer_amount": "1000000",
  "spreads": [
    {
      "denom": "uusdc",
      "amount": "3"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ],
  "swap_fees": [
    {
      "denom": "uusdc",
      "amount": "500"
    },
    {
      "denom": "uatom",
      "amount": "100"
    }
  ],
  "protocol_fees": [
    {
      "denom": "uusdc",
      "amount": "100"
    },
    {
      "denom": "uatom",
      "amount": "50"
    }
  ],
  "burn_fees": [
    {
      "denom": "uusdc",
      "amount": "10"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ],
  "extra_fees": [
    {
      "denom": "uusdc",
      "amount": "5"
    },
    {
      "denom": "uatom",
      "amount": "5"
    }
  ]
}
Key
Type
Description

offer_amount

Uint128

The amount of the initial token needed to get the final token after the swap operations.

spreads

Vec<Coin>

The spreads of the swap.

swap_fees

Vec<Coin>

The swap fees of the swap.

protocol_fees

Vec<Coin>

The protocol fees of the swap.

burn_fees

Vec<Coin>

The burn fees of the swap.

extra_fees

Vec<Coin>

The extra fees of the swap.

Pools

Retrieves the pool information for the given pool identifier or all pools.

{
  "pools": {
    "pool_identifier": "om-usdc-1",
    "start_after": null,
    "limit": 10
  }
}
Key
Type
Description

pool_identifier

Option<String>

An optional parameter specifying the pool identifier to do the query for. If not provided, it will return all pools based on the pagination parameters.

start_after

Option<String>

An optional parameter specifying what pool (identifier) to start searching after.

limit

Option<u32>

The amount of pools to return. If unspecified, will default to a value specified by the contract.

{
  "pools": [
    {
      "pool_info": {
        "pool_identifier": "om-usdc-1",
        "asset_denoms": [
          "uom",
          "uusdc"
        ],
        "lp_denom": "uom_uusdc_lp",
        "asset_decimals": [
          6,
          6
        ],
        "assets": [
          {
            "denom": "uom",
            "amount": "1000000"
          },
          {
            "denom": "uusdc",
            "amount": "1000000"
          }
        ],
        "pool_type": {
          "constant_product": {}
        },
        "pool_fees": {
          "protocol_fee": "0.003",
          "swap_fee": "0.003",
          "burn_fee": "0.0"
        }
      },
      "total_share": {
        "denom": "uom_uusdc_lp",
        "amount": "1000000"
      }
    }
  ]
}
Key
Type
Description

pools

Vec<PoolInfoResponse>

The pools information responses.

Ownership

Returns the ownership of the contract.

Note: This is a cw_ownable query.

{
  "ownership": {}
}
{
  "owner": "mantra1...",
  "pending_owner": "mantra1...",
  "pending_expiry": 424242424242
}
Key
Type
Description

owner

Option

The contract's current owner. None if the ownership has been renounced.

pending_owner

Option

The account who has been proposed to take over the ownership. None if there isn't a pending ownership transfer.

pending_expiry

Option

The deadline for the pending owner to accept the ownership. None if there isn't a pending ownership transfer, or if a transfer exists and it doesn't have a deadline.

MigrateMsg

Message to migrate the contract to a new code ID.

{}
spread=(Y∆x/X)−(Y∆x/(X+∆x))spread= (Y∆x/X) − (Y∆x/ (X+∆x))spread=(Y∆x/X)−(Y∆x/(X+∆x))

The stableswap pool implements the StableSwap curve described by the Curve protocol @ .

🌊
https://curve.fi/files/stableswap-paper.pdf