Staking

Lock LP tokens to obtain veSEILOR tokens. The total amount of rewards is determined based on the configuration of this contract and the boost locking time. LP tokens can be withdrawn in advance, but the rewards cannot be withdrawn until they expire according to the lock.

Config

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct StakingConfig {
    pub gov: Addr,
    // Immutable variables for staking and rewards tokens
    pub staking_token: Addr,
    pub rewards_token: Addr,
    pub boost: Addr,
    pub fund: Addr,
    pub reward_controller_addr: Addr,
    pub new_gov: Option<Addr>,
}
Key
Type
Description

gov

Addr

The address of the governance contract

staking_token

Addr

The address of the token contract to be staked

rewards_token

Addr

The address of the token contract to be rewarded

boost

Addr

fund

Addr

reward_controller_addr

Addr

The address controlling the amount of SEILOR token rewards for each mining.

new_gov*

Addr

The address of the new governance contract

* = optional

InitMsg

#[cw_serde]
pub struct InstantiateMsg {
    pub gov: Option<Addr>,
    pub staking_token: Addr,
    pub rewards_token: Addr,
    pub boost: Addr,
    pub fund: Addr,
    pub reward_controller_addr: Addr,
    pub duration: Uint128,
}
{
  "gov": "sei1...",
  "staking_token": "sei1...",
  "rewards_token": "sei1...",
  "boost": "sei1...",
  "fund": "sei1...",
  "reward_controller_addr": "sei1...",
  "duration": "2592000"
}
Key
Type
Description

gov

Addr

The address of the governance contract

staking_token

Addr

The address of the token contract to be staked

rewards_token

Addr

The address of the token contract to be rewarded

boost

Addr

fund

Addr

reward_controller_addr

Addr

The address controlling the amount of SEILOR token rewards for each mining

duration

Uint128

The duration of this batch mining reward

ExecuteMsg

Receive

#[cw_serde]
pub enum ExecuteMsg {
    /// Receives a message of type [`Cw20ReceiveMsg`]
    Receive(Cw20ReceiveMsg),
}
#[cw_serde]
pub struct Cw20ReceiveMsg {
    pub sender: String,
    pub amount: Uint128,
    pub msg: Binary,
}
{
  "receive": {
    "cw20_receive_msg": {
        "sender": "sei1...",
        "amount": "1000000",
        "msg": "eyJ0eXBlIjoiY3cyMCIsImFtb3VudCI6IjEwMDAwMCJ9"
      }
  }
}
Key
Type
Description

sender

String

The sender's address

amount

Uint128

Amount to be sent

msg

Binary

Message to be sent

UpdateStakingConfig

#[cw_serde]
pub enum ExecuteMsg {
    UpdateStakingConfig {
        config_msg: UpdateStakingConfigStruct,
    },
}
#[cw_serde]
pub struct UpdateStakingConfigStruct {
    pub gov: Option<Addr>,
    pub staking_token: Option<Addr>,
    pub rewards_token: Option<Addr>,
    pub boost: Option<Addr>,
    pub fund: Option<Addr>,
    pub reward_controller_addr: Option<Addr>,
}
{
  "update_staking_config": {
    "config_msg": {
          "gov": "sei1...",
          "staking_token": "sei1...",
          "rewards_token": "sei1...",
          "boost": "sei1...",
          "fund": "sei1...",
          "reward_controller_addr": "sei1..."
      }
  }
}
Key
Type
Description

gov

Addr

The address of the governance contract

staking_token

Addr

The address of the token contract to be staked

rewards_token

Addr

The address of the token contract to be rewarded

boost

Addr

fund

Addr

reward_controller_addr

Addr

The address controlling the amount of SEILOR token rewards for each mining

UpdateStakingState

#[cw_serde]
pub enum ExecuteMsg {
    UpdateStakingState {
        duration: Uint128,
    },
}
{
  "update_staking_state": {
    "duration": "2592000"
  }
}
Key
Type
Description

duration

Uint128

The duration of this batch mining reward

GetReward

#[cw_serde]
pub enum ExecuteMsg {
    GetReward {},
}
{
  "get_reward": {}
}

Withdraw

#[cw_serde]
pub enum ExecuteMsg {
    Withdraw {
        amount: Uint128,
    },
}
{
  "withdraw": {
    "amount": "1000000"
  }
}
Key
Type
Description

amount

Uint128

Amount to be withdrew

NotifyRewardAmount

#[cw_serde]
pub enum ExecuteMsg {
    NotifyRewardAmount {
        amount: Uint128,
    },
}
{
  "notify_reward_amount": {
    "amount": "1000000"
  }
}
Key
Type
Description

amount

Uint128

The total allocation of mining rewards for this batch

QueryMsg

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(RewardPerTokenResponse)]
    RewardPerToken {},
}
{
  "reward_per_token": {}
}

RewardPerTokenResponse

#[cw_serde]
pub struct RewardPerTokenResponse {
    pub reward_per_token: Uint128,
}
{
  "reward_per_token": "1000000"
}
Key
Type
Description

reward_per_token

Uint128

The rate of reward for each token

LastTimeRewardApplicable

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(LastTimeRewardApplicableResponse)]
    LastTimeRewardApplicable {},
}
{
  "last_time_reward_applicable": {}
}

LastTimeRewardApplicableResponse

#[cw_serde]
pub struct LastTimeRewardApplicableResponse {
    pub last_time_reward_applicable: Uint128,
}
{
  "last_time_reward_applicable": "1000000"
}
Key
Type
Description

last_time_reward_applicable

Uint128

Last time reward applicable

GetBoost

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetBoostResponse)]
    GetBoost { account: Addr },
}
{
  "get_boost": {
    "account": "sei1..."
  }
}

GetBoostResponse

#[cw_serde]
pub struct GetBoostResponse {
    pub boost: Uint128,
}
{
  "boost": "1000000"
}
Key
Type
Description

boost

Uint128

boost value

Earned

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(EarnedResponse)]
    Earned { account: Addr },
}
{
  "earned": {
    "account": "sei1..."
  }
}
Key
Type
Description

account

Addr

The user's address

EarnedResponse

#[cw_serde]
pub struct EarnedResponse {
    pub earned: Uint128,
}
{
  "earned": "1000000"
}
Key
Type
Description

earned

Uint128

The amount of rewards that the user has already received.

QueryStakingConfig

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(StakingConfigResponse)]
    QueryStakingConfig {},
}
{
  "query_staking_config": {}
}

StakingConfigResponse

#[cw_serde]
pub struct StakingConfigResponse {
    pub gov: Addr,
    pub staking_token: Addr,
    pub rewards_token: Addr,
    pub boost: Addr,
    pub fund: Addr,
    pub reward_controller_addr: Addr,
}
{
  "gov": "sei1...",
  "staking_token": "sei1...",
  "rewards_token": "sei1...",
  "boost": "sei1...",
  "fund": "sei1...",
  "reward_controller_addr": "sei1..."
}
Key
Type
Description

gov

Addr

The address of the governance contract

staking_token

Addr

The address of the token contract to be staked

rewards_token

Addr

The address of the token contract to be rewarded

boost

Addr

fund

Addr

reward_controller_addr

Addr

The address controlling the amount of SEILOR token rewards for each mining.

new_gov*

Addr

The address of the new governance contract

* = optional

QueryStakingState

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(StakingStateResponse)]
    QueryStakingState {},
}
{
  "query_staking_state": {}
}

StakingStateResponse

#[cw_serde]
pub struct StakingStateResponse {
    pub duration: Uint128,
    pub finish_at: Uint128,
    pub updated_at: Uint128,
    pub reward_rate: Uint256,
    pub reward_per_token_stored: Uint128,
    pub total_supply: Uint128,
}
{
  "duration": "1000000",
  "finish_at": "1000000",
  "updated_at": "1000000",
  "reward_rate": "1000000",
  "reward_per_token_stored": "1000000",
  "total_supply": "1000000"
}
Key
Type
Description

duration

Uint128

Duration of rewards to be paid out (in seconds) 2_592_000 = 30 days

finish_at

Uint128

Timestamp of when the rewards finish

update_at

Uint128

last updated time

reward_rate

Uint256

Reward to be paid out per second

reward_per_token_stored

Uint128

Sum of (reward rate * dt * 1e6 / total supply)

total_supply

Uint128

The total amount of staked tokens.

GetUserUpdatedAt

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetUserUpdatedAtResponse)]
    GetUserUpdatedAt { account: Addr },
}
{
  "get_user_updated_at": {
    "account": "sei1..."
  }
}
Key
Type
Decription

account

Addr

The user's address

GetUserUpdatedAtResponse

#[cw_serde]
pub struct GetUserUpdatedAtResponse {
    pub updated_at: Uint128,
}
{
  "updated_at": "1000000"
}
Key
Type
Description

updated_at

Uint128

last updated time for user

GetUserRewardPerTokenPaid

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(GetUserRewardPerTokenPaidResponse)]
    GetUserRewardPerTokenPaid { account: Addr },
}
{
  "get_user_reward_per_token_paid": {
    "account": "sei1..."
  }
}
Key
Type
Description

account

Addr

the user's address

GetUserRewardPerTokenPaidResponse

#[cw_serde]
pub struct GetUserRewardPerTokenPaidResponse {
    pub reward_per_token_paid: Uint128,
}
{
  "reward_per_token_paid": "1000000"
}
Key
Type
Description

reward_per_token_paid

Uint128

Calculating the reward rate per Staking token for a specific user after applying the boost

BalanceOf

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(BalanceOfResponse)]
    BalanceOf { account: Addr },
}
{
  "balance_of": {
    "account": "sei1..."
  }
}
Key
Type
Description

account

Addr

the user's address

BalanceOfResponse

#[cw_serde]
pub struct BalanceOfResponse {
    pub balance_of: Uint128,
}
{
  "balance_of": "1000000"
}
Key
Type
Description

balance_of

Uint128

the balance of the user's address

Last updated