Reward
The Reward contract handles the distribution of Ethereum 2.0 staking rewards to holders of CW20 bETH. Ethereum 2.0 staking rewards (which are first converted to TerraUSD via Ethereum AMM protocols) are transferred over to the Reward contract, which are subsequently distributed to holders of bETH. bETH holders can send a request to this contract to claim their accrued rewards.
The Reward contract also stores the balance and reward index values for all bETH holders, which is used to calculate the amount of bETH rewards that a specific holder has accrued.
Contract State
Config
Stores information about the contract configuration.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Config {
pub owner: CanonicalAddr,
pub token_contract: Option<CanonicalAddr>,
pub reward_denom: String,
}Key
Type
Description
owner
CanonicalAddr
Address of contract owner
token_contract*
CanonicalAddr
Contract address of bETH Token
reward_denom
String
Native token denomination for distributed bETH rewards
* = not stored until value registered
State
Stores information about the contract state.
Key
Type
Description
global_index
Decimal
Current global reward index of bETH
total_balance
Uint128
Total bETH balance of all holders
prev_reward_balance
Uint128
TerraUSD balance of Reward contract at the time of last global index update
Holder
Stores information for a specific bETH holder.
Key
Type
Description
balance
Uint128
bETH balance of holder
index
Decimal
Holder's reward index value
pending_rewards
Decimal
Amount of holder's pending rewards
InstantiateMsg
Key
Type
Description
owner
String
Address of contract owner
reward_denom
String
Native token denomination for distributed bETH rewards
ExecuteMsg
PostInitialize
Registers the bETH Token contract address.
Key
Type
Description
token_contract
String
Address of bETH Token
UpdateConfig
Updates the Reward contract configuration.
Key
Type
Description
owner
String
Address of new owner
ClaimRewards
Claims bETH holder's accrued rewards to the specified address. Sends rewards to message sender if the recipient is not specified.
Key
Type
Description
recipient*
String
Recipient address of claimed bETH rewards
* = optional
[Internal] IncreaseBalance
Increases stored user's bETH balance. Stores user's accrued rewards to pending rewards and updates user's reward index to the current global reward index. Can only be issued by Token.
Key
Type
Description
address
String
Address of user whose balance has increased
amount
Uint128
Amount of bETH balance increased
[Internal] DecreaseBalance
Decreases stored user's bETH balance. Stores user's accrued rewards to pending rewards and updates user's reward index to the current global reward index. Can only be issued byToken.
Key
Type
Description
address
String
Address of user whose balance has decreased
amount
Uint128
Amount of bETH balance decreased
QueryMsg
Config
Gets the contract configuration of bETH Reward.
State
Gets information about the contract's current state.
AccruedRewards
Gets the amount of rewards accrued to the specified bETH holder.
Holder
Gets information about the specified bETH holder.
Holders
Gets information about all bETH holders.
Request
Key
Type
Description
start_after*
String
Address of bETH holder to start query
limit*
u32
Maximum number of query entries
* = optional
Response
Key
Type
Description
holders
Vec<HolderResponse>
Vector of holder informations
Key
Type
Description
address
String
Address of bETH holder
balance
Uint128
bETH balance of holder
index
Decimal
Holder's reward index value
pending_rewards
Decimal
Amount of holder's pending rewards
Request
Key
Type
Description
start_after*
String
Address of bETH holder to start query
limit*
u32
Maximum number of query entries
* = optional
Response
Key
Type
Description
holders
Vec<HolderResponse>
Vector of holder informations
Key
Type
Description
address
String
Address of bETH holder
balance
Uint128
bETH balance of holder
index
Decimal
Holder's reward index value
pending_rewards
Decimal
Amount of holder's pending rewards
Last updated