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
  • How it works
  • Farms
  • Positions
  • Claiming Farm Rewards
  • Instantiate
  • ExecuteMsg
  • ManageFarm
  • ManagePosition
  • Claim
  • UpdateConfig
  • UpdateOwnership(::cw_ownable::Action)
  • QueryMsg
  • Config
  • Farms
  • Positions
  • Rewards
  • LpWeight
  • Ownership
  • MigrateMsg
  1. MANTRA Smart Contracts
  2. MANTRA Dex

Farm Manager

The Farm Manager is a monolithic contract that handles all the farms-related logic for the pools.

How it works

The Farm Manager has two main concepts; a Farm, containing a reward to be distributed and a Position, defined as a user's liquidity in a pool locked in the contract.

Users of the Liquidity Hub, when providing liquidity, can opt to lock their LP shares which will in turn send them to the Farm Manager until they are unlocked.

Farms

Creating farms is permissionless, and farms can be perpetual. This means they can be expanded forever. Anyone can create a farm by calling the ManageFarm message with the FarmAction::Fill action and paying the farm creation fee, which is sent to the Fee Collector.

Users can decide to provide an identifier, which they can later use to top up or close the farm. If no identifier is provided, the contract will generate one.

The farm identifiers have a prefix, if the farm is created without an identifier it will get the prefix f-, followed by a number. On the other hand, if the farm is created with a custom identifier, the prefix will be m-, followed by the custom identifier provided.

Topping up a Farm

To top up a farm, the owner of the farm must call ManageFarm with the FarmAction::Fill action. The user must provide the identifier of the farm it intends to top up, including the prefix assigned by the contract. The farm can only be topped up with the same token as the original reward, and the amount must be a multiple of the original reward's amount.

A farm is considered expired after the time defined in the contract configuration as farm_expiration_time has passed once the farm has ended. Once a farm is expired it cannot be expanded, and expired farms are closed automatically when creating new farms.

Closing a Farm

To close a farm, the owner of the farm or the owner of the contract must call ManageFarm with the FarmAction::Close action with the identifier of the farm to be closed, including the prefix assigned by the contract. The farm will be closed, and the remaining tokens will be sent to the owner of the farm.

Reward Distribution

Farm rewards are distributed every epoch, and the user can claim rewards for as long as the farm is live. Based on the parameters used when creating the farm, the rewards will get an emission rate per epoch. The emission rate is the amount of tokens distributed per epoch.

The user rewards are calculated as follows:

user rewards=∑lp=aNdenoms∑f=bNfarms∑e=startcurrentulpwetlpwe⋅re\text{user rewards} = \sum_{\text{lp}=a}^{N_\text{denoms}} \sum_{f=b}^{N_\text{farms}} \sum_{e=\text{start}}^{\text{current}} \frac{u\text{lp}\text{w}_e}{t\text{lp}\text{w}_e} \cdot r_euser rewards=lp=a∑Ndenoms​​f=b∑Nfarms​​e=start∑current​tlpwe​ulpwe​​⋅re​

where lp are the unique LP denoms the user has locked in the contract, f are the active farms, e the epochs, ranging from the start epoch, which is either the epoch at which the farm starts, or the subsequent epoch after the user's last claimed epoch, until the current epoch which is the one at the moment the claim or query is made. ulpw is the user's LP weight, tlpw is the total LP weight, and r is the reward allocation for a given epoch.

The maximum number of concurrent farms for a given LP denom is defined when the contract is instantiated, and it is stored in the config as max_concurrent_farms.

Note: If a user has pending rewards the moment a farm is closed, the user loses the possibility to claim those tokens as all unclaimed tokens are reimbursed to the farm owner.

Positions

Positions can be created, expanded (topped up), or withdrawn. This is done via the ManagePosition message, followed by the desired action, i.e. PositionAction::Create, PositionAction::Expand, PositionAction::Close or PositionAction::Withdraw.

When a user creates a position, it must provide an unlocking duration and an identifier (optional). The longer the unlocking duration, the higher the weight of the LP position, which equates to higher rewards. Choosing an unlocking duration of one day gives the user a multiplier of 1x, while the maximum period of 365 days gives the user a multiplier of 16x.

Like the farm identifiers, the position identifiers also get a prefix assigned by the contract. If the position is created without a custom identifier, it will get the prefix p-, followed by a number. On the other hand, if the position is created with a custom identifier, the prefix will be u-, followed by the custom identifier provided.

The unlocking duration is the time it takes in seconds to unlock the position, which is necessary to withdraw the LP tokens from the contract.

There's a limit of 100 open positions, as well as 100 closed positions per user.

Note: The unlocking duration is defined as how long the user needs to wait after hitting the Close action to be able to withdraw the LP tokens from the contract. Not to be confused with how long the LP tokens are locked in the farm. The LP tokens are locked in the farm for as long as the user has a position in the farm manager.

Topping up a Position

To expand a position, the user must call ManagePosition with the PositionAction::Expand action using the position identifier of the position to expand. Expanding a position only involves adding more LP tokens to the position. The unlocking period of the original position is kept.

Only open positions can be expanded.

Closing a Position

When a user creates a position, the LP tokens are locked in the contract. The user can't withdraw them until the unlocking duration is complete. The clock starts ticking the moment the user closes the position.

Closing a position is done by calling ManagePosition with the PositionAction::Close action. The user must provide the identifier of the position to be closed. Once this action is triggered, the Position.open state is set to false, and expiring_at is set to the block height after which the position will be able to be withdrawn.

It is possible to close a position partially by providing the amount of LP tokens to remove from the position.

Withdrawing a Position

Once the unlocking duration is complete after closing a position, the user can withdraw the LP tokens from the contract by calling the ManagePosition with the PositionAction::Withdraw action. Alternatively, if the user doesn't want to wait for the unlocking duration to complete, it is possible to do an emergency withdrawal by passing true on theemergency_unlock parameter. This will unlock and withdraw the position immediately, and the user will pay a penalty fee in case the unlocking period has not passed. Half of the penalty is distributed among the farm owners of the given LP, while the other half goes to the Fee Collector.

Once the user closes and withdraws the position, they receive their LP tokens back.

Note: The emergency unlock feature can be used on both open and closed positions. However, if this feature is used, the user renounces all unclaimed rewards for the given position.

Claiming Farm Rewards

Users can claim farm rewards from active farms for their LP tokens, only if they have a position in the farm manager. Users can only claim rewards for future epochs, i.e. after the epoch in which the position was created.

Farm rewards are distributed based on the user's share of the total LP tokens in the contract. So if there's a total of 100 LP tokens in the contract, and a user has 10 LP tokens, the user will receive 10% of the rewards for that epoch, for that given farm.

To claim rewards, the user must call the Claim message. Once that's done, the contract will save the epoch in which the claim was made in LAST_CLAIMED_EPOCH, and will sync the user's LP weight history saved in LP_WEIGHT_HISTORY. This helps computing the rewards for the user.


Instantiate

Instantiates an instance of the farm manager contract

{
  "owner": "mantra1...",
  "epoch_manager_addr": "mantra1...",
  "fee_collector_addr": "mantra1...",
  "pool_manager_addr": "mantra1...",
  "create_farm_fee": {
    "denom": "uom",
    "amount": "1000000000"
  },
  "max_concurrent_farms": 7,
  "max_farm_epoch_buffer": 14,
  "min_unlocking_duration": 86400,
  "max_unlocking_duration": 31536000,
  "farm_expiration_time": 2629746,
  "emergency_unlock_penalty": "0.01"
}
Key
Type
Description

owner

String

The owner of the contract.

epoch_manager_addr

String

The epoch manager address, where the epochs are managed.

fee_collector_addr

String

The address of the fee collector, where protocol fees go.

pool_manager_addr

String

The address of the pool manager, used to verify the LP tokens locked in the contract.

create_farm_fee

Coin

The fee that must be paid to create a farm.

max_concurrent_farms

u32

The maximum amount of farms that can exist for a single LP token at a time.

max_farm_epoch_buffer

u32

New farms are allowed to start up to current_epoch + start_epoch_buffer into the future.

min_unlocking_duration

u64

The minimum amount of time that a user can lock their tokens for. In seconds.

max_unlocking_duration

u64

The maximum amount of time that a user can lock their tokens for. In seconds.

farm_expiration_time

u64

The amount of time after which a farm is considered to be expired after it ended. In seconds. Minimum a month. Once a farm is expired it cannot be expanded, and expired farms can be closed.

emergency_unlock_penalty

Decimal

The penalty for unlocking a position before the unlocking duration finishes. In percentage.

ExecuteMsg

ManageFarm

Manages a farm based on the action, which can be:

  • Fill: Fills a farm. If the farm doesn't exist, it creates a new one. If it exists already, it expands it given the sender created the original farm and the params are correct.

  • Close: Closes a farm with the given identifier. If the farm has expired, anyone can close it. Otherwise, only the farm creator or the owner of the contract can close a farm.

Once created, farms are stored in the FARMS map.

{
  "manage_farm": {
    "action": {
      "fill": {
        "params": {
          "lp_denom": "factory/mantra1.../LP",
          "start_epoch": 10,
          "preliminary_end_epoch": 24,
          "curve": "linear",
          "farm_asset": {
            "denom": "uom",
            "amount": "1000000000"
          },
          "farm_identifier": "farm_identifier"
        }
      }
    }
  }
}
Key
Type
Description

lp_denom

String

The LP asset denom to create the farm for.

start_epoch

Option<u64>

The epoch at which the farm will start. If unspecified, it will start at the current epoch.

preliminary_end_epoch

Option<u64>

The epoch at which the farm should preliminarily end (if it's not expanded). If unspecified, the farm will default to end at 14 epochs from the current one.

curve

Option<Curve>

The type of distribution curve. If unspecified, the distribution will be linear.

farm_asset

Coin

The asset to be distributed in this farm.

farm_identifier

Option<String>

If set, it will be used to identify the farm.

{
  "manage_farm": {
    "action": {
      "close": {
        "farm_identifier": "farm_identifier"
      }
    }
  }
}
Key
Type
Description

farm_identifier

String

The farm identifier to close.

ManagePosition

Manages a position based on the action, which can be:

  • Create: Creates a position.

  • Expand: Expands a position.

  • Close: Closes an existing position. The position stops earning farm rewards.

  • Withdraw: Withdraws the LP tokens from a position after the position has been closed and the unlocking duration has passed.

Positions are stored in the POSITIONS map.

{
  "manage_position": {
    "action": {
      "create": {
        "identifier": "position_identifier",
        "unlocking_duration": 86400,
        "receiver": "mantra1..."
      }
    }
  }
}
Key
Type
Description

identifier

Option<String>

The identifier of the position.

unlocking_duration

u64

The time it takes in seconds to unlock this position.

receiver

Option<String>

The receiver for the position. If left empty, defaults to the message sender.

{
  "manage_position": {
    "action": {
      "expand": {
        "identifier": "position_identifier"
      }
    }
  }
}
Key
Type
Description

identifier

String

The identifier of the position.

{
  "manage_position": {
    "action": {
      "close": {
        "identifier": "position_identifier",
        "lp_asset": {
          "denom": "factory/mantra1.../LP",
          "amount": "1000000000"
        }
      }
    }
  }
}
Key
Type
Description

identifier

String

The identifier of the position.

lp_asset

String

The asset to remove from the position. If not set, the position will be closed in full. If not, it could be partially closed.

{
  "manage_position": {
    "action": {
      "withdraw": {
        "identifier": "position_identifier",
        "emergency_unlock": true
      }
    }
  }
}
Key
Type
Description

identifier

String

The identifier of the position.

emergency_unlock

Option<bool>

Whether to unlock the position in an emergency. If set to true, the position will be unlocked immediately, but with a penalty.

Claim

Claims the rewards for the user.

{
  "claim": {}
}

UpdateConfig

Updates the contract configuration.

{
  "update_config": {
    "fee_collector_addr": "mantra1...",
    "epoch_manager_addr": "mantra1...",
    "pool_manager_addr": "mantra1...",
    "create_farm_fee": {
      "denom": "uom",
      "amount": "1000000000"
    },
    "max_concurrent_farms": 7,
    "max_farm_epoch_buffer": 14,
    "min_unlocking_duration": 86400,
    "max_unlocking_duration": 31536000,
    "farm_expiration_time": 2629746,
    "emergency_unlock_penalty": "0.01"
  }
}
Key
Type
Description

fee_collector_addr

Option<String>

The address to of the fee collector, to send fees to.

epoch_manager_addr

Option<String>

The epoch manager address, where the epochs are managed.

pool_manager_addr

Option<String>

The pool manager address.

create_farm_fee

Option<Coin>

The fee that must be paid to create a farm.

max_concurrent_farms

Option<u32>

The maximum amount of farms that can exist for a single LP token at a time.

max_farm_epoch_buffer

Option<u32>

The maximum amount of epochs in the future a new farm is allowed to start in.

min_unlocking_duration

Option<u64>

The minimum amount of time that a user can lock their tokens for. In seconds.

max_unlocking_duration

Option<u64>

The maximum amount of time that a user can lock their tokens for. In seconds.

farm_expiration_time

Option<u64>

The amount of time after which a farm is considered to be expired after it ended. In seconds. Minimum a month. Once a farm is expired it cannot be expanded, and expired farms can be closed.

emergency_unlock_penalty

Option<Decimal>

The penalty for unlocking a position before the unlocking duration finishes. In percentage.

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": {}
}
{
  "fee_collector_addr": "mantra1...",
  "epoch_manager_addr": "mantra1...",
  "pool_manager_addr": "mantra1...",
  "create_farm_fee": {
    "denom": "uom",
    "amount": "1000000000"
  },
  "max_concurrent_farms": 7,
  "max_farm_epoch_buffer": 14,
  "min_unlocking_duration": 86400,
  "max_unlocking_duration": 31536000,
  "farm_expiration_time": 2629746,
  "emergency_unlock_penalty": "0.01"
}
Key
Type
Description

fee_collector_addr

Addr

The address to of the fee collector, to send fees to.

epoch_manager_addr

Addr

The epoch manager address, where the epochs are managed.

pool_manager_addr

Addr

The pool manager address.

create_farm_fee

Coin

The fee that must be paid to create a farm.

max_concurrent_farms

u32

The maximum amount of farms that can exist for a single LP token at a time.

max_farm_epoch_buffer

u32

The maximum amount of epochs in the future a new farm is allowed to start in.

min_unlocking_duration

u64

The minimum amount of time that a user can lock their tokens for. In seconds.

max_unlocking_duration

u64

The maximum amount of time that a user can lock their tokens for. In seconds.

farm_expiration_time

u64

The amount of time after which a farm is considered to be expired after it ended. In seconds. Minimum a month. Once a farm is expired it cannot be expanded, and expired farms can be closed.

emergency_unlock_penalty

Decimal

The penalty for unlocking a position before the unlocking duration finishes. In percentage.

Farms

Retrieves the configuration of the manager.

{
  "farms": {
    "filter_by": {
      "identifier": "farm_identifier"
    },
    "start_after": "identifier_123",
    "limit": 30
  }
}
Key
Type
Description

filter_by

Option<FarmsBy>

An optional parameter specifying what to filter farms by. Can be either the farm identifier, lp denom or the farm asset.

start_after

Option<String>

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

limit

Option<u32>

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

{
  "farms": {
    "filter_by": {
      "lp_denom": "factory/mantra1.../LP"
    },
    "start_after": "identifier_123",
    "limit": 30
  }
}
Key
Type
Description

filter_by

Option<FarmsBy>

An optional parameter specifying what to filter farms by. Can be either the farm identifier, lp denom or the farm asset.

start_after

Option<String>

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

limit

Option<u32>

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

{
  "farms": {
    "filter_by": {
      "farm_asset": "uom"
    },
    "start_after": "identifier_123",
    "limit": 30
  }
}
Key
Type
Description

filter_by

Option<FarmsBy>

An optional parameter specifying what to filter farms by. Can be either the farm identifier, lp denom or the farm asset.

start_after

Option<String>

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

limit

Option<u32>

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

{
  "farms": [
    {
      "identifier": "farm_identifier",
      "owner": "mantra1...",
      "lp_denom": "factory/mantra1.../LP",
      "farm_asset": {
        "denom": "uom",
        "amount": "1000000000"
      },
      "claimed_amount": "1000000000",
      "emission_rate": "1000000000",
      "curve": "linear",
      "start_epoch": 10,
      "preliminary_end_epoch": 24,
      "last_epoch_claimed": 15
    },
    {
      "identifier": "identifier_123",
      "owner": "mantra1...",
      "lp_denom": "factory/mantra1.../LP",
      "farm_asset": {
        "denom": "uluna",
        "amount": "1000000000"
      },
      "claimed_amount": "1000000000",
      "emission_rate": "100000000",
      "curve": "linear",
      "start_epoch": 10,
      "preliminary_end_epoch": 20,
      "last_epoch_claimed": 15
    }
  ]
}
Key
Type
Description

farms

Vec<Farm>

The list of farms.

Positions

Retrieves the positions for an address.

{
  "positions": {
    "filter_by": {
      "identifier": "position_identifier"
    },
    "open_state": true,
    "start_after": "identifier_123",
    "limit": 30
  }
}
Key
Type
Description

filter_by

Option<PositionBy>

An optional parameter specifying what to filter positions by. Can be either the position identifier or receiver.

open_state

Option<bool>

An optional parameter specifying to return only positions that match the given open state. If true, it will return open positions. If false, it will return closed positions.

start_after

Option<String>

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

limit

Option<u32>

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

{
  "positions": {
    "filter_by": {
      "receiver": "mantra1..."
    },
    "open_state": true,
    "start_after": "identifier_123",
    "limit": 30
  }
}
Key
Type
Description

filter_by

Option<PositionBy>

An optional parameter specifying what to filter positions by. Can be either the position identifier or receiver.

open_state

Option<bool>

An optional parameter specifying to return only positions that match the given open state. If true, it will return open positions. If false, it will return closed positions.

start_after

Option<String>

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

limit

Option<u32>

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

{
  "positions": [
    {
      "identifier": "farm_identifier",
      "lp_asset": {
        "denom": "factory/mantra1.../LP",
        "amount": "1000000000"
      },
      "unlocking_duration": 86400,
      "open": true,
      "receiver": "mantra1..."
    },
    {
      "identifier": "farm_identifier",
      "lp_asset": {
        "denom": "factory/mantra1.../LP",
        "amount": "888888"
      },
      "unlocking_duration": 86400,
      "open": false,
      "expiring_at": 1571797,
      "receiver": "mantra1..."
    }
  ]
}
Key
Type
Description

positions

Vec<Position>

The list of positions.

Rewards

Retrieves the rewards for an address.

{
  "rewards": {
    "address": "mantra1..."
  }
}
Key
Type
Description

address

String

The address to get all the farm rewards for.

{
  "rewards_response": {
    "total_rewards": [
      {
        "denom": "uom",
        "amount": "1000000000"
      }
    ],
    "rewards_per_lp_denom": [
      [
        "factory/mantra1.../1.LP",
        [
          {
            "denom": "uom",
            "amount": "888"
          }
        ]
      ],
      [
        "factory/mantra1.../2.LP",
        [
          {
            "denom": "uusdc",
            "amount": "1000"
          }
        ]
      ]
    ]
  }
}
Key
Type
Description

rewards

Vec<Coin>

The rewards that is available to a user if they executed the claim function at this point.

rewards_per_lp_denom

Vec<(String, Vec<Coin>)>

The rewards per LP denom that is available to a user if they executed the claim function at this point.

LpWeight

Retrieves the total LP weight in the contract for a given denom on a given epoch.

{
  "lp_weight": {
    "address": "mantra1...",
    "denom": "uom",
    "epoch_id": 50
  }
}
Key
Type
Description

address

String

The address to get the LP weight for.

denom

String

The denom to get the total LP weight for.

epoch_id

u64

The epoch id to get the LP weight for.

{
  "lp_weight": "1000000000",
  "epoch_id": 50
}
Key
Type
Description

lp_weight

Uint128

The total lp weight in the contract.

epoch_id

u64

The epoch id corresponding to the lp weight in the contract.

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.

{}
PreviousPool ManagerNextClaimdrop Contract

Last updated 1 month ago

🎁