📚Common Types

The common types are the data structures that are used across the MANTRA DEX contracts.

Struct
Description
Contains

Epoch

The epoch definition

  • id: u64 - Epoch identifier

  • start_time: Timestamp - Epoch start time

EpochConfig

The epoch configuration

  • duration: Uint64 - The duration of an epoch in seconds.

  • genesis_epoch: Uint64 - Timestamp for the first epoch, in seconds.

EpochResponse

The response for the current epoch query

  • epoch: Epoch - The epoch queried.

EpochChangedHookMsg

The hook msg for epoch changed

  • current_epoch: Epoch - The current epoch.

Fee

The definition of the fee, used on the pool and farm managers

  • share: Decimal - the fee.

PoolFee

Represents the fee structure for transactions within a pool

  • protocol_fee: Fee - Fee percentage charged on each transaction for the protocol's benefit.

  • swap_fee: Fee - Fee percentage allocated to liquidity providers on each swap.

  • burn_fee: Fee - Fee percentage that is burned on each transaction. Burning a portion of the transaction fee helps in reducing the overall token supply.

  • extra_fees: Vec<Fee> - A list of custom, additional fees that can be defined for specific use cases or additional functionalities.

FarmParams

Parameters for creating farm

  • 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).

  • 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.

Farm

The definition of an farm

  • identifier: String - The ID of the farm.

  • owner: Addr - The account which opened the farm and can manage it.

  • lp_denom: String - The LP asset denom to create the farm for.

  • farm_asset: Coin - The asset the farm to be distributed.

  • claimed_amount: Uint128 - The amount of the farm_asset that has been claimed so far.

  • emission_rate: Uint128 - The amount of the farm_asset that is to be distributed every epoch.

  • curve: Curve - The type of curve the farm has.

  • start_epoch: u64 - The epoch at which the farm starts.

  • preliminary_end_epoch: u64 - The epoch at which the farm will preliminary end (in case it's not expanded).

  • last_epoch_claimed: u64 - The last epoch this farm was claimed.

Position

Represents an LP position on the farm manager

  • identifier: String - The identifier of the position.

  • lp_asset: Coin - The amount of LP tokens that are put up to earn farm rewards.

  • unlocking_duration: u64 - Represents the amount of time in seconds the user must wait after unlocking for the LP tokens to be released.

  • open: bool - If true, the position is open. If false, the position is closed.

  • expiring_at: Option<u64> - The block height at which the position, after being closed, can be withdrawn.

  • receiver: Addr - The owner of the position.

Enums
Description
Alternatives

FarmsBy

Enum to filter farms by identifier, lp denom or the farm asset. Used in the Farms query.

  • Identifier(String)

  • LpDenom(String)

  • >

  • FarmAsset(String)

PositionsBy

Enum to filter positions by identifier or receiver. Used in the positions query.

  • Identifier(String)

  • >

  • Receiver(String)

FarmAction

Actions to manage a farm

  • Fill { params: FarmParams } - Fills a farm

  • Close { farm_identifier: String } - Closes a farm

PositionAction

Actions to manage a position

  • Create { identifier: Option<String>, unlocking_duration: u64, receiver: Option<String> } - Creates a position

  • Expand { identifier: String } - Expands a position

  • Close { identifier: String, lp_asset: Option<Coin> } - Closes an existing position. The position stops earning farm rewards.

  • Withdraw { identifier: String, emergency_unlock: Option<bool> } - Withdraws the LP tokens from a position after the position has been closed and the unlocking duration has passed.

Curve

Dictates how the farms rewards are released

  • Linear - A linear curve that releases assets uniformly over time.

RewardsResponse

Rewards response used for calculating or querying farm rewards

  • RewardsResponse { total_rewards: Vec<Coin>, rewards_per_lp_denom: Vec<(String, Vec<Coin>) } - The farm rewards response.

  • QueryRewardsResponse { rewards: Vec<Coin> } - Rewards response used internally when querying the rewards.

  • ClaimRewards { rewards: Vec<Coin>, modified_farms: HashMap<String, Uint128> } - Used when claiming rewards on farms.

SwapOperation

The type of swap operation to perform

  • MantraSwap { token_in_denom: String, token_out_denom: String, pool_identifier: String } - A swap operation that uses the MantraSwap router

PoolType

Possible pool types, it can be either a constant product (xyk) pool or a stable swap pool

  • StableSwap { amp: u64 } - A stable swap pool

  • ConstantProduct - xyk pool

Last updated