Token
The Token contract is a modified implementation of the CW20 base, refitted to consider for bETH reward accruals.
Details on the CW20 specification can be found here.

Contract State

TokenInfo

Stores information about the bETH token.
1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
#[serde(rename_all = "snake_case")]
3
pub struct TokenInfo {
4
pub name: String,
5
pub symbol: String,
6
pub decimals: u8,
7
pub total_supply: Uint128,
8
pub mint: Option<MinterData>,
9
}
Copied!
Key
Type
Description
name
String
Name of bETH token
symbol
String
Symbol of bETH token
decimals
u8
Number of decimals of bETH
total_supply
Uint128
Total minted supply of bETH
mint*
MinterData
Minter information of bETH
* = not stored until value registered

MinterData

Store information about the bETH minter.
1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
pub struct MinterData {
3
pub minter: Addr,
4
pub cap: Option<Uint128>,
5
}
Copied!
Key
Type
Description
minter
Addr
Address of minter
cap*
Uint128
Maximum number of mintable tokens
* = not stored until value registered

InstantiateMsg

Rust
JSON
1
#[derive(Serialize, Deserialize, JsonSchema)]
2
pub struct TokenInstantiateMsg {
3
pub name: String,
4
pub symbol: String,
5
pub decimals: u8,
6
pub initial_balances: Vec<Cw20CoinHuman>,
7
pub mint: Option<MinterResponse>,
8
pub reward_contract: String,
9
}
Copied!
1
{
2
"name": "Bonded ETH",
3
"symbol": "BETH",
4
"decimals": 6,
5
"total_supply": "100000000",
6
"mint": {
7
"minter": "terra1...",
8
"cap": "1000000000"
9
},
10
"reward_contract": "terra1..."
11
}
Copied!
Key
Type
Description
name
String
Name of bETH token
symbol
String
Symbol of bETH token
decimals
u8
Number of decimals of bETH
total_supply
Uint128
Total minted supply of bETH
mint*
MinterResponse
Minter information of bETH
reward_contract
String
Contract address of bETH Reward
* = optional

ExecuteMsg

Transfer

Transfers tokens to the specified address.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
Transfer {
5
recipient: String,
6
amount: Uint128,
7
}
8
}
Copied!
1
{
2
"transfer": {
3
"recipient": "terra1...",
4
"amount": "100000000"
5
}
6
}
Copied!
Key
Type
Description
recipient
String
Recipient address of token transfer
amount
Uint128
Amount of tokens to transfer

Burn

Burns the specified amount of tokens.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
Burn {
5
amount: Uint128,
6
}
7
}
Copied!
1
{
2
"burn": {
3
"amount": "100000000"
4
}
5
}
Copied!
Key
Type
Description
amount
Uint128
Amount of tokens to burn

Send

Sends tokens to the specified contract address along with a message.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
Send {
5
contract: String,
6
amount: Uint128,
7
msg: Binary,
8
}
9
}
Copied!
1
{
2
"send": {
3
"contract": "terra1...",
4
"amount": "100000000",
5
"msg": "eyAiZXhlY3V0ZV9tc2ciOiAiYmluYXJ5IiB9"
6
}
7
}
Copied!
Key
Type
Description
contract
String
Contract address to send tokens to
amount
Uint128
Amount of tokens to send
msg
Binary
Base64-encoded JSON of receive hook message

Mint

Mints tokens to the specified address. Can only be issued by the minter.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
Mint {
5
recipient: String,
6
amount: Uint128,
7
}
8
}
Copied!
1
{
2
"mint": {
3
"recipient": "terra1...",
4
"amount": "100000000"
5
}
6
}
Copied!
Key
Type
Description
recipient
String
Address to mint tokens to
amount
Uint128
Amount of tokens to mint

IncreaseAllowance

Increases allowance for the specified spender address.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
IncreaseAllowance {
5
spender: String,
6
amount: Uint128,
7
expires: Option<Expiration>,
8
}
9
}
10
11
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, JsonSchema, Debug)]
12
#[serde(rename_all = "snake_case")]
13
pub enum Expiration {
14
AtHeight(u64),
15
AtTime(Timestamp),
16
Never {},
17
}
Copied!
1
{
2
"increase_allowance": {
3
"spender": "terra1...",
4
"amount": "100000000",
5
"expires": {
6
"at_height": 123123,
7
// or
8
"at_time": 123123,
9
// or
10
"never": {}
11
}
12
}
13
}
Copied!
Key
Type
Description
spender
String
Address of spender
amount
Uint128
Amount of tokens to increase allowance for spender
expires*
Expiration
Information on when this allowance expires
* = optional
Key
Type
Description
AtHeight
u64
Allowance expires at specified block height
AtTime
Timestamp
Allowance expires at specified block timestamp
Never
nil
Allowance never expires

DecreaseAllowance

Decreases allowance for the specified spender address.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
DecreaseAllowance {
5
spender: String,
6
amount: Uint128,
7
expires: Option<Expiration>,
8
}
9
}
10
11
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, JsonSchema, Debug)]
12
#[serde(rename_all = "snake_case")]
13
pub enum Expiration {
14
AtHeight(u64),
15
AtTime(Timestamp),
16
Never {},
17
}
Copied!
1
{
2
"decrease_allowance": {
3
"spender": "terra1...",
4
"amount": "100000000",
5
"expires": {
6
"at_height": 123123,
7
// or
8
"at_time": 123123,
9
// or
10
"never": {}
11
}
12
}
13
}
Copied!
Key
Type
Description
spender
String
Address of spender
amount
Uint128
Amount of tokens to decrease allowance for spender
expires*
Expiration
Information on when this allowance expires
Key
Type
Description
AtHeight
u64
Allowance expires at specified block height
AtTime
Timestamp
Allowance expires at specified block timestamp
Never
nil
Allowance never expires

TransferFrom

Transfers tokens from the specified owner to the specified recipient. Requires unexpired allowance to be set beforehand.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
TransferFrom {
5
owner: String,
6
recipient: String,
7
amount: Uint128,
8
}
9
}
Copied!
1
{
2
"transfer_from": {
3
"owner": "terra1...",
4
"recipient": "terra1...",
5
"amount": "100000000"
6
}
7
}
Copied!
Key
Type
Description
owner
String
Address to transfer tokens from
recipient
String
Address to transfer tokens to
amount
Uint128
Amount of tokens to transfer

SendFrom

Sends tokens from the specified owner to the specified contract, along with a message. Requires unexpired allowance to be set beforehand.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
SendFrom {
5
owner: String,
6
contract: String,
7
amount: Uint128,
8
msg: Binary,
9
}
10
}
Copied!
1
{
2
"send_from": {
3
"owner": "terra1...",
4
"contract": "terra1...",
5
"amount": "100000000",
6
"msg": "eyAiZXhlY3V0ZV9tc2ciOiAiYmluYXJ5IiB9",
7
}
8
}
Copied!
Key
Type
Description
owner
String
Address to send tokens from
contract
String
Address to send tokens to
amount
Uint128
Amount of tokens to send
msg
Binary
Base64-encoded JSON of receive hook msg

BurnFrom

Burns tokens from the specified owner. Requires unexpired allowance to be set beforehand.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20ExecuteMsg {
4
BurnFrom {
5
owner: String,
6
amount: Uint128,
7
}
8
}
Copied!
1
{
2
"burn_from": {
3
"owner": "terra1...",
4
"amount": "100000000"
5
}
6
}
Copied!
Key
Type
Description
owner
String
Address to burn tokens from
amount
Uint128
Amount of tokens to burn

QueryMsg

Balance

Gets the balance for the specified address.
Rust
JSON

Request

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20QueryMsg {
4
Balance {
5
address: String,
6
}
7
}
Copied!
Key
Type
Description
address
String
Address of holder to get balance

Response

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
pub struct BalanceResponse {
3
pub balance: Uint128,
4
}
Copied!
Key
Type
Description
balance
Uint128
Amount of token balance

Request

1
{
2
"balance": {
3
"address": "terra1..."
4
}
5
}
Copied!
Key
Type
Description
address
String
Address of holder to get balance

Response

1
{
2
"balance": "100000000"
3
}
Copied!
Key
Type
Description
balance
Uint128
Amount of token balance

TokenInfo

Gets information for the token.
Rust
JSON

Request

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20QueryMsg {
4
TokenInfo {}
5
}
Copied!
Key
Type
Description

Response

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
pub struct TokenInfoResponse {
3
pub name: String,
4
pub symbol: String,
5
pub decimals: u8,
6
pub total_supply: Uint128,
7
}
Copied!
Key
Type
Description
name
String
Name of token
symbol
String
Symbol of token
decimals
u8
Number of decimals of token
total_supply
Uint128
Total minted supply of token

Request

1
{
2
"token_info": {}
3
}
Copied!
Key
Type
Description

Response

1
{
2
"name": "Bonded ETH",
3
"symbol": "BETH",
4
"decimals": 6,
5
"total_supply": "1000000000"
6
}
Copied!
Key
Type
Description
name
String
Name of token
symbol
String
Symbol of token
decimals
u8
Number of decimals of token
total_supply
Uint128
Total minted supply of token

Minter

Gets information for the token minter.
Rust
JSON

Request

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20QueryMsg {
4
Minter {}
5
}
Copied!
Key
Type
Description

Response

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
pub struct MinterResponse {
3
pub minter: String,
4
pub cap: Option<Uint128>,
5
}
Copied!
Key
Type
Description
minter
String
Address of token minter
cap*
Uint128
Maximum number of mintable tokens

Request

1
{
2
"minter": {}
3
}
Copied!
Key
Type
Description

Response

1
{
2
"minter": "terra1...",
3
"cap": "1000000000"
4
}
Copied!
Key
Type
Description
minter
String
Address of token minter
cap*
Uint128
Maximum number of mintable tokens

Allowance

Gets allowance information for the specified owner and spender.
Rust
JSON

Request

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
2
#[serde(rename_all = "snake_case")]
3
pub enum Cw20QueryMsg {
4
Allowance {
5
owner: String,
6
spender: String,
7
}
8
}
Copied!
Key
Type
Description
owner
String
Address of owner
spender
String
Address of spender

Response

1
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
2
pub struct AllowanceResponse {
3
pub allowance: Uint128,
4
pub expires: Expiration,
5
}
6
7
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, JsonSchema, Debug)]
8
#[serde(rename_all = "snake_case")]
9
pub enum Expiration {
10
AtHeight(u64),
11
AtTime(Timestamp),
12
Never {},
13
}
Copied!
Key
Type
Description
allowance
String
Amount of owner's tokens spender is allowed to spend
expires
Expiration
Information on when this allowance expires
Key
Type
Description
AtHeight
u64
Allowance expires at specified block height
AtTime
Timestamp
Allowance expires at specified block timestamp
Never
nil
Allowance never expires

Request

1
{
2
"allowance": {
3
"owner": "terra1...",
4
"spender": "terra1..."
5
}
6
}
Copied!
Key
Type
Description
owner
String
Address of owner
spender
String
Address of spender

Response

1
{
2
"allowance": "100000000",
3
"expires": {
4
"at_height": 123123,
5
// or
6
"at_time": 123123,
7
// or
8
"never": {}
9
}
10
}
Copied!
Key
Type
Description
allowance
String
Amount of owner's tokens spender is allowed to spend
expires
Expiration
Information on when this allowance expires