Staking
Last updated
Last updated
The Staking Contract contains the logic for LP Token staking and reward distribution. Staking rewards for LP stakers come from the new MIR tokens generated at each block by the and are split between all combined staking pools. The new MIR tokens are distributed in proportion to size of staked LP tokens multiplied by the weight of that asset's staking pool.
owner
HumanAddr
Owner address of Staking contract
mirror_token
HumanAddr
Contract address of the Mirror Token (MIR)
mint_contract
HumanAddr
Contract address of Mirror Mint
oracle_contract
HumanAddr
Contract address of Mirror Oracle
terraswap_factory
HumanAddr
Contract address of Terraswap Factory
base_denom
String
Native token denom for Terraswap pairs (TerraUSD)
premium_min_update_interval
u64
Interval of time denominated in number of blocks which the collateral premium information is updated
Receive
amount
Uint128
Token amount received
sender
HumanAddr
Sender of token transaction
msg
*
Binary
* = optional
UpdateConfig
Updates the Staking contract's configuration. Can only be issued by the staking contract's owner.
owner
*
HumanAddr
Owner address of Staking contract
premium_min_update_interval
*
u64
Interval of time denominated in number of blocks which the collateral premium information is updated
* = optional
RegisterAsset
Registers a new staking pool for an asset token and associates the LP token with the staking pool.
asset_token
HumanAddr
Contract address of mAsset/MIR token (staking pool identifier)
staking_token
HumanAddr
Contract address of asset's corresponding LP Token
Unbond
Users can issue the unbond message at any time to remove their staked LP tokens from a staking position.
amount
Uint128
Amount of LP tokens to unbond
asset_token
HumanAddr
Contract address of mAsset/MIR token (staking pool identifier)
Withdraw
Withdraws a user's rewards for a specific staking position.
asset_token
*
HumanAddr
Contract address of asset token (staking pool identifier). If empty, withdraws all rewards from all staking pools involved.
* = optional
AutoStake
When providing liquidity in Mirror Protocol, asset pair is first sent to Staking contract, and it acts as a relay. When defined assets are sent to the contract, the contract provides liquidity to receive LP tokens and starts AutoStakeHook
.
Note: Executor of the transaction should first increase allowance to spend CW20 tokens
assets
*
Array[Assets]
Information of assets that are provided into liquidity pool
slippage_tolerance
*
Decimal
Maximum price slippage allowed to execute this transaction
*= optional
AutoStakeHook
[INTERNAL]
Hook to stake the minted LP tokens from providing liquidity.
assets_token
HumanAddr
Contract address of the asset token
staking_token
HumanAddr
Contract address of the LP token to be staked
staker_addr
HumanAddr
Address of the staker
prev_staking_token_amount
Uint128
LP staking balance of the staker before this transaction
AdjustPremium
[Permission-less operation]
Changes the price premium rate for a specified mAsset, can be done by anyone. Message can be sent again after a defined premium_min_update_interval
.
asset_tokens
Vec<HumanAddr>
Array of token contract addresses to update new price premium rate
IncreaseShortToken
[Mint contract operation]
Increases the total staked supply of sLP
tokens for a specific staker.
asset_token
HumanAddr
Token contract address of sLP
staker_addr
HumanAddr
Address of the sLP
staker
amount
Uint128
Amount of sLP
supply to be increased
DecreaseShortToken
[Mint contract operations]
Decreases the total staked supply of sLP
tokens for a specific staker.
asset_token
HumanAddr
Token contract address of sLP
staker_addr
HumanAddr
Address of the sLP
staker
amount
Uint128
Amount of sLP
supply to be decreased
Bond
WARNING
If you send LP Tokens to the Staking contract without issuing this hook, they will not be staked and will BE LOST FOREVER.
Can be issued when the user sends LP Tokens to the Staking contract. The LP token must be recognized by the staking pool of the specified asset token.
asset_token
HumanAddr
Contract address of asset token (staking pool identifier).
DepositReward
[INTERNAL]
asset_token
HumanAddr
Contract address of asset token (staking pool identifier)
Config
Response
owner
HumanAddr
Owner address of Staking contract
mirror_token
HumanAddr
Contract address of the Mirror Token (MIR)
mint_contract
HumanAddr
Contract address of Mirror Mint
oracle_contract
HumanAddr
Contract address of Mirror Oracle
terraswap_factory
HumanAddr
Contract address of Terraswap Factory
base_denom
String
Native token denom for Terraswap pairs (TerraUSD)
premium_min_update_interval
u64
Interval of time denominated in number of blocks which the collateral premium information is updated
PoolInfo
asset_token
HumanAddr
Asset token to query (staking pool identifier)
Response
asset_token
HumanAddr
Contract address of mAsset token
staking_token
HumanAddr
Contract address of LP
or sLP
token
total_bond_amount
Uint128
Amount of total LP staked
total_short_amount
Uint128
Amount of total sLP staked
reward_index
Decimal
Amount of reward distributed per 1 LP token
short_reward_index
Decimal
Amount of reward distributed per 1 sLP token
pending_reward
Uint128
Amount of unclaimed rewards by LP stakers
short_pending_reward
Uint128
Amount of unclaimed rewards by sLP stakers
premium_rate
Decimal
Current price premium of the asset pool
short_reward_weight
Decimal
Current reward weight for sLP staking
premium_updated_time
u64
Block height which the price premium data for this asset is most recently updated
RewardInfo
asset_token
*
HumanAddr
Asset token to query. If empty, returns info for all staking pools.
staker
HumanAddr
Address of staker to query
*= optional
Response
asset_token
HumanAddr
Asset token being queried
bond_amount
Uint128
Amount of LP or sLP tokens staked
pending_reward
Uint128
Amount of reward that are not claimed
is_short
bool
Identifies of the pool os LP or sLP pool
Can be called during a CW20 token transfer when the Mint contract is the recipient. Allows the token transfer to execute a as a subsequent action within the same transaction.
Base64-encoded JSON of message
Can be issued when the user sends MIR tokens to the Staking contract, which will be used as rewards for the specified asset's staking pool. Used by to deposit newly minted MIR tokens.