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 Factory Contract 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.
Name | Type | Description |
| HumanAddr | Address of owner of staking contract |
| HumanAddr | Contract address of the Mirror Token (MIR) |
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]pub struct InitMsg {pub owner: HumanAddr,pub mirror_token: HumanAddr,}
Key | Type | Description |
| HumanAddr | Address of staking contract owner |
| HumanAddr | Contract address of the Mirror Token (MIR) |
Can be called during a CW20 token transfer when the Mint contract is the recipient. Allows the token transfer to execute a Receive Hook as a subsequent action within the same transaction.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {Receive {amount: Uint128,sender: HumanAddr,msg: Option<Binary>,}}
{"receive": {"amount": "10000000","sender": "terra1...","msg": "eyAiZXhlY3V0ZV9tc2ciOiAiYmxhaCBibGFoIiB9"}}
Key | Type | Description |
| Uint128 | Token amount received |
| HumanAddr | Sender of token transaction |
| Binary | Base64-encoded JSON of Receive Hook message |
* = optional
Updates the Staking contract's configuration. Can only be issued by the staking contract's owner.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub struct enum HandleMsg {UpdateConfig {owner: Option<HumanAddr>,}}
{"update_config": {"owner": "terra1..."}}
Key | Type | Description |
| HumanAddr | Address of new owner of staking contract |
* = optional
Registers a new staking pool for an asset token and associates the LP token with the staking pool.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {RegisterAsset {asset_token: HumanAddr,staking_token: HumanAddr,}}
{"register_asset": {"asset_token": "terra1...","staking_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of mAsset/MIR token (staking pool identifier) |
| HumanAddr | Contract address of asset's corresponding LP Token |
Users can issue the unbond message at any time to remove their staked LP tokens from a staking position.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {Unbond {amount: Uint128,asset_token: HumanAddr,}}
{"unbond": {"amount": "10000000","asset_token": "terra1..."}}
Key | Type | Description |
| Uint128 | Amount of LP tokens to unbond |
| HumanAddr | Contract address of mAsset/MIR token (staking pool identifier) |
Withdraws a user's rewards for a specific staking position.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum HandleMsg {Withdraw {asset_token: Option<HumanAddr>,}}
{"withdraw": {"asset_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of asset token (staking pool identifier). If empty, withdraws all rewards from all staking pools involved. |
* = optional
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.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum Cw20HookMsg {Bond {asset_token: HumanAddr,}}
{"bond": {"asset_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of asset token (staking pool identifier). |
[INTERNAL]
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 Factory Contract to deposit newly minted MIR tokens.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum Cw20HookMsg {DepositReward {asset_token: HumanAddr,}}
{"deposit_reward": {"asset_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Contract address of asset token (staking pool identifier) |
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {Config {}}
{"config": {}}
Key | Type | Description |
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {PoolInfo {asset_token: HumanAddr,}}
{"pool_info": {"asset_token": "terra1..."}}
Key | Type | Description |
| HumanAddr | Asset token to query (staking pool identifier) |
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum QueryMsg {RewardInfo {asset_token: Option<HumanAddr>,staker: HumanAddr,}}
{"reward_info": {"asset_token": "terra1...","staker": "terra1..."}}
Key | Type | Description |
| HumanAddr | Asset token to query. If empty, returns info for all staking pools. |
| HumanAddr | Address of staker to query |
* = optional