Staking
The Staking Contract contains the logic for LP Token staking and reward distribution. ANC tokens allocated for as liquidity incentives are distributed pro-rata to stakers of the ANC-UST Terraswap pair LP token.

Config

Name
Type
Description
anchor_token
CanonicalAddr
Contract address of Anchor Token (ANC)
staking_token
CanonicalAddr
Contract address of ANC-UST Terraswap pair LP token
distribution_schedule
Vec<(u64, u64, Uint128)>
ANC distribution schedule for LP token stakers (start block [block], end block [block], distribution amount)

InstantiateMsg

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InstantiateMsg {
3
pub anchor_token: String,
4
pub staking_token: String,
5
pub distribution_schedule: Vec<(u64, u64, Uint128)>,
6
}
Copied!
1
{
2
"anchor_token": "terra1...",
3
"staking_token": "terra1...",
4
"distribution_schedule": [
5
[123456, 234567, "100000000"],
6
[234567, 345678, "200000000"]
7
]
8
}
Copied!
Name
Type
Description
anchor_token
String
Contract address of Anchor Token (ANC)
staking_token
String
Contract address of ANC-UST Terraswap pair LP token
distribution_schedule
Vec<(u64, u64, Uint128)>
ANC distribution schedule for LP token stakers (start block [block], end block [block], distribution amount)

ExecuteMsg

Receive

Can be called during a CW20 token transfer when the Staking contract is the recipient. Allows the token transfer to execute a Receive Hook as a subsequent action within the same transaction.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
Receive {
5
sender: String,
6
amount: Uint128,
7
msg: Binary,
8
}
9
}
Copied!
1
{
2
"receive": {
3
"amount": "10000000",
4
"sender": "terra1...",
5
"msg": "eyAiZXhlY3V0ZV9tc2ciOiAiYmluYXJ5IiB9"
6
}
7
}
Copied!
Name
Type
Description
sender
String
Sender of the token transfer
amount
Uint128
Amount of tokens received
msg
Binary
Base64-encoded string of JSON of Receive Hook

Unbond

Unbonds specified amount of ANC-UST Terraswap LP tokens and transfers them to the message sender.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
Unbond {
5
amount: Uint128,
6
}
7
}
Copied!
1
{
2
"unbond": {
3
"amount": "100000000"
4
}
5
}
Copied!
Name
Type
Description
amount
Uint128
Amount of LP tokens to unbond

Withdraw

Withdraws user's accrued LP token staking rewards.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
Withdraw {}
5
}
Copied!
1
{
2
"withdraw": {}
3
}
Copied!
Name
Type
Description

MigrateStaking

Migrates ANC LP incentives to a new LP token staking contract.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
MigrateStaking {
5
new_staking_contract: String,
6
}
7
}
Copied!
1
{
2
"migrate_staking": {
3
"new_staking_contract": "terra1...",
4
}
5
}
Copied!
Key
Type
Description
new_staking_contract
String
Contract address of new LP staking contract

Receive Hooks

Bond

WARNING
Sending LP tokens to the Staking contract without issuing this hook will lead to PERMANENT LOSS OF FUNDS.
Bonds LP tokens of the ANC-UST Terraswap pair.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20HookMsg {
4
Bond {}
5
}
Copied!
1
{
2
"bond": {}
3
}
Copied!
Name
Type
Description

QueryMsg

Config

Gets the Staking contract configuration.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Config {}
5
}
Copied!
1
{
2
"config": {}
3
}
Copied!
Name
Type
Description

ConfigResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct ConfigResponse {
3
pub anchor_token: String,
4
pub staking_token: String,
5
pub distribution_schedule: Vec<(u64, u64, Uin128)>,
6
}
Copied!
1
{
2
"anchor_token": "terra1...",
3
"staking_token": "terra1...",
4
"distribution_schedule": [
5
[123456, 234567, "100000000"],
6
[234567, 345678, "200000000"]
7
]
8
}
Copied!
Name
Type
Description
anchor_token
String
Contract address of Anchor Token (ANC)
staking_token
String
Contract address of ANC-UST Terraswap pair LP token
distribution_schedule
Vec<(u64, u64, Uint128)>
ANC distribution schedule for LP token stakers (start block [block], end block [block], amount)

State

Gets state information for the specified block number.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
State {
5
block_height: Option<u64>,
6
}
7
}
Copied!
1
{
2
"state": {
3
"block_height": 123456
4
}
5
}
Copied!
Name
Type
Description
block_height*
u64
Current block number [block]
* = optional

StateResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct StateResponse {
3
pub last_distributed: u64,
4
pub total_bond_amount: Uint128,
5
pub global_reward_index: Decimal,
6
}
Copied!
1
{
2
"last_distributed": 123456,
3
"total_bond_amount": "100000000",
4
"global_reward_index": "123.456"
5
}
Copied!
Name
Type
Description
last_distributed
u64
Block number when rewards where last distributed [block]
total_bond_amount
Uint128
Total amount of bonded LP tokens by all stakers
global_reward_index
Decimal
Global reward index for LP staking rewards

StakerInfo

Gets reward information for the specified LP token staker.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
StakerInfo {
5
staker: String,
6
block_height: Option<u64>,
7
}
8
}
Copied!
1
{
2
"staker_info": {
3
"staker": "terra1...",
4
"block_height": 123456
5
}
6
}
Copied!
Name
Type
Description
staker
String
Address of LP token staker
block_height*
u64
Current block number [block]
* = optional

StakerInfoResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct StakerInfoResponse {
3
pub staker: String,
4
pub reward_index: Decimal,
5
pub bond_amount: Uint128,
6
pub pending_reward: Uint128,
7
}
Copied!
1
{
2
"staker": "terra1...",
3
"reward_index": "123.456",
4
"bond_amount": "100000000",
5
"pending_rewards": "100000000"
6
}
Copied!
Name
Type
Description
staker
String
Address of LP token staker
reward_index
Decimal
Reward index of staker
bond_amount
Uint128
Amount of LP tokens bonded by staker
pending_rewards
Uint128
Amount of pending rewards of staker
Last modified 3mo ago