Entry Points

The protocol provides the following entry points:

AFSUI Getters

public fun afsui_to_sui_exchange_rate(): Returns AFSUI<->SUI exchange rate for the current epoch.

public fun afsui_to_sui(): Given AFSUI amount returns corresponding SUI amount.

public fun sui_to_afsui_exchange_rate(): Returns SUI<->AFSUI exchange rate for the current epoch.

public fun sui_to_afsui(): Given SUI amount returns corresponding AFSUI amount.

public fun total_sui_amount(): Returns total SUI amount locked in the protocol (all principals + rewards)

Total amounts getters

public fun total_rewards_amount(): Returns total collected rewards amount.

public fun epoch_was_changed(): Initiates epoch change processing. May need to be called several times in a row.

Staking

public fun request_stake(): Delegate SUI coin to the specified validator and return an equivalent amount of AFSUI instantly. Note that the validator has to be active.

entry fun request_stake_and_keep(): Keep version which transfers AFSUI to the transaction sender account directly.

public fun request_stake_vec(): Get a vector of SUI coins, join them, stake to the specified validator and return an equivalent amount of AFSUI instantly. Note that the validator has to be active.

entry fun request_stake_vec_and_keep(): Keep version which transfers AFSUI to the transaction sender account directly.

public fun request_stake_staked_sui(): Re-stake provided StakedSui object, mint corresponding amount of AFSUI and return them.

public fun request_stake_staked_sui_and_keep(): Keep version which transfers AFSUI to the transaction sender account directly.

public fun request_stake_staked_sui_vec(): Get a vector of StakedSui objects, re-stake them, mint corresponding amounts of AFSUI and return them.

public fun request_stake_staked_sui_vec_and_keep(): Keep version which transfers AFSUI to the transaction sender account directly.

Regular Unstaking

public fun request_unstake(): The method gets AFSUI as an input, registers the request to mint the corresponding amount of SUI at the beginning of the next epoch .

public fun request_unstake_vec(): The method gets a vector of AFSUI coins as an input, joins them, registers the request to mint the corresponding amount of SUI at the beginning of the next epoch.

Atomic Unstaking

public fun request_unstake_atomic(): The method gets AFSUI coin as input and returns corresponding amount of SUI instantly.

entry fun request_unstake_atomic_and_keep(): Keep version which transfers SUI to the transaction sender account directly.

public fun request_unstake_vec_atomic(): The method gets a vector of AFSUI coins as input, joins them into one, and returns corresponding amount of SUI instantly.

public fun request_unstake_vec_atomic_and_keep(): Keep version which transfers SUI to the transaction sender account directly.

Validator Fee

public fun rotate_operation_cap(): Create and register new Operation Capability Object.

public fun update_validator_fee(): Change corresponding validator fee.

Last updated