💸xASTRO Token

1. Overview

xASTRO is a CW20 fork that keeps track of historical balances and of the historical total supply. For more details on how xASTRO works, check out the staking page.

This page will only go over the functions and variables that were added to the vanilla CW20 implementation. The code for xASTRO can be found here.

2. Variables and Functions

Constants

Name
Description

BALANCES

This mapping keeps track of xASTRO historical balances for each holder. It is useful when trying to determine the voting power a user has in the Astroport Assembly

TOTAL_SUPPLY_HISTORY

This mapping keeps track of the historical total xASTRO supply

Functions

Name
Params
Description

capture_total_supply_history

(storage: &mut dyn Storage, env: &Env, total_supply: Uint128) -> StdResult<()>

Internal function that snapshots the current total xASTRO supply

get_total_supply_at

(storage: &dyn Storage, block: u64) -> StdResult<Uint128>

Returns the total xASTRO supply at a specific block

query_balance_at

(deps: Deps, address: String, block: u64) -> StdResult<BalanceResponse>

Return a user's xASTRO balance at a specific block

3. Walkthrough

The following are examples and descriptions of core functions that can be called by anyone to interact with the xASTRO Token contract. This walkthrough will only go over the functions and variables that were added to the vanilla CW20 implementation.

balance_at

An address can query the BalanceAt operation to return the balance of a given address at a specific block. The query takes in an address for which to return the balance and a block at which to query the address' balance.

{
  "balance_at": {
    "address": "terra...",
    "block": "123"
  }
}

total_supply_at

An address can query the TotalSupplyAt operation to return the total xASTRO supply at a specific block. The query takes in a block at which to query the total supply.

{
  "total_supply_at": {
    "block": "123"
  }
}

Last updated

Was this helpful?