Governance Staking

Each governance staking position is represented by a Lock. You can either add more tokens to the lock (stake more) or extend the lock time of the position. Each wallet can only have one lock, so if you want to have a shorter lock time for your ASH tokens, you have to use another wallet.

There are two contracts:

  1. Vote-escrowed: Handle staking

  2. Fee Distributor: Distribute rewards

Vote-escrowed

1. Write Functions

1.1. create_lock

Create a lock for the sender.

#[payable("*")]
#[endpoint]
fn create_lock(&self, unlock_time: u64)

Params:

  • unlock_time: u64 - the timestamp of the unlock time. If the timestamp does not match the points of time (the interval between is 7 days on Mainnet), it will be rounded down to the closest point.

Attached tokens:

  • ASH

1.2. increase_amount

There is no param needed as each wallet has only one lock. It will be retrieved from the sender's address.

Attached tokens:

  • ASH

1.3. increase_unlock_time

Extend the lock time for a lock.

Params:

  • unlock_time: u64 - new timestamp for the unlock time, similar to that of create_lock

1.4. withdraw

Withdraw locked ASH tokens.

2. Read Functions

2.1. getUserBalanceAtTs

Get the veASH balance of a user at one point in time.

Params:

  • addr: &ManagedAddress - wallet address

  • t: u64 - timestamp

Return:

  • BigInt - veASH balance

2.2. getTotalSupplyAtBlock

Get the total supply of veASH at a certain block.

Params:

  • block: u64

Return:

  • BigInt: total veASH supply

2.3. getTotalSupplyAtTs

Get the total supply of veASH at a certain block.

Params:

  • ts: u64: timestamp in second

Return:

  • BigInt: total veASH supply

2.4. getTotalLocked

Get the total number of ASH tokens locked.

Return:

  • BigUint

2.5. getUserLocked

Get the total number of ASH tokens locked and the unlock time of a specific wallet.

Params:

  • addr: &ManagedAddress

Return:

  • LockedBalance

Fee Distributor

1. Write functions

1.1. claim

Claim reward tokens to an address.

Params:

  • addr: &ManagedAddress - the address to send the reward tokens to.

2. Read Functions

2.1. getClaimableAmount

Get the claimable reward amount.

Params:

  • addr: &ManagedAddress

Return: BigUint

2.2. token

Get the reward token.

Return: TokenIdentifier

Last updated

Was this helpful?