# 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.
