Volo Liquid Staking API Reference

Volo Staking API Reference

Source Code: https://github.com/Sui-Volo/volo-smart-contracts/tree/main/liquid_stakingarrow-up-right

Contract Address: 0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20

Note: In this documentation, CERT refers to vSUI (Volo Staked SUI). They are the same token - CERT is the internal module name used in the smart contract.


Table of Contents

  1. Data Structures

  2. User Functions

  3. View Functions

  4. Admin Functions

  5. Operator Functions

  6. Events

  7. Constants & Error Codes


1. Data Structures

StakePool

Field
Type
Description

fee_config

FeeConfig

Fee configuration

fees

Balance<SUI>

Accumulated protocol fees (stake + unstake fees)

boosted_balance

Balance<SUI>

Deposited boosted reward balance

boosted_reward_amount

u64

Amount to distribute per epoch

accrued_reward_fees

u64

Accumulated reward fees (not yet collected)

validator_pool

ValidatorPool

Validator management

manage

Manage

Version and pause state


ValidatorPool

Field
Type
Description

sui_pool

Balance<SUI>

Buffer for stake/unstake operations

validator_infos

vector<ValidatorInfo>

All validator information

total_sui_supply

u64

Total SUI managed (sui_pool + all stakes)

last_refresh_epoch

u64

Last epoch when pool was refreshed

total_weight

u64

Sum of all validator weights


ValidatorInfo

Field
Type
Description

staking_pool_id

ID

Validator's staking pool ID

validator_address

address

Validator address

active_stake

Option<FungibleStakedSui>

Active stake (earning rewards)

inactive_stake

Option<StakedSui>

Inactive stake (first epoch)

exchange_rate

PoolTokenExchangeRate

Current exchange rate

total_sui_amount

u64

Total SUI staked to this validator

assigned_weight

u64

Weight for allocation


FeeConfig

Field
Type
Max Value
Description

stake_fee_bps

u64

500 (5%)

Fee on staking

unstake_fee_bps

u64

500 (5%)

Fee on unstaking

reward_fee_bps

u64

10000 (100%)

Performance fee on rewards

unstake_fee_redistribution_bps

u64

10000 (100%)

Portion of unstake fee returned to pool


Metadata<CERT>

Shared object storing the vSUI minting authority.


Capability Structs


2. User Functions

stake_entry

Stake SUI and receive vSUI.

Parameters:

Name
Type
Description

self

&mut StakePool

The stake pool object

metadata

&mut Metadata<CERT>

vSUI metadata (shared object)

system_state

&mut SuiSystemState

Sui system state (0x5)

sui

Coin<SUI>

SUI coin to stake

Requirements:

  • Pool must not be paused

  • SUI amount >= 0.1 SUI (100,000,000 MIST)

Emits: StakeEventExt

TypeScript Example:


stake

Non-entry version that returns the minted vSUI.

Returns: Coin<CERT> - The minted vSUI coin


unstake_entry

Redeem vSUI for SUI.

Parameters:

Name
Type
Description

cert

Coin<CERT>

vSUI coin to redeem

Requirements:

  • Pool must not be paused

  • vSUI amount >= 0.1 SUI equivalent

Emits: UnstakeEventExt

TypeScript Example:


unstake

Non-entry version that returns the redeemed SUI.

Returns: Coin<SUI> - The redeemed SUI coin


delegate_stake_entry

Stake SUI with a preferred validator.

Parameters:

Name
Type
Description

v_address

address

Preferred validator address

Emits: DelegateStakeEvent

Note: This function behaves identically to stake_entry but additionally emits a DelegateStakeEvent with the validator address. The backend uses this event to adjust validator weights.


rebalance

Rebalance stakes across validators according to weights. This is a permissionless function.

Emits: RebalanceEvent

TypeScript Example:


refresh

Update pool state if epoch has changed. Called automatically by stake/unstake.

Returns: bool - true if epoch rolled over and state was updated

Emits: EpochChangedEvent (if epoch changed)


3. View Functions

get_ratio

Returns how many vSUI you get per 1 SUI (in 1e9 precision).

Returns: Ratio in 1e9 precision

Example: If returns 950_000_000, then 1 SUI = 0.95 vSUI


get_ratio_reverse

Returns how many SUI you get per 1 vSUI (in 1e9 precision).

Returns: Ratio in 1e9 precision

Example: If returns 1_052_631_579, then 1 vSUI ≈ 1.053 SUI


publish_ratio

Emit ratio in V1 format (1e18 precision) for compatibility.


get_amount_out

Calculate output amount after fees.

Parameters:

Name
Type
Description

amount_in

u64

Input amount in MIST

sui2lst

bool

true for SUI→vSUI, false for vSUI→SUI

Returns: Output amount after fees


sui_amount_to_lst_amount

Convert SUI amount to vSUI amount (no fees).


lst_amount_to_sui_amount

Convert vSUI amount to SUI amount (no fees).


total_sui_supply

Returns total SUI managed by the pool.


total_lst_supply

Returns total vSUI supply.


validator_pool

Get reference to validator pool.


fee_config

Get reference to fee configuration.


total_fees

Returns total accumulated fees (stake fees + unstake fees + reward fees).


accrued_reward_fees

Returns accumulated reward fees not yet collected.


boosted_balance

Returns remaining boosted reward balance.


ValidatorPool View Functions


FeeConfig View Functions


4. Admin Functions

All admin functions require AdminCap.

set_paused

Pause or unpause the pool.

Emits: SetPausedEvent


migrate_version

Migrate pool to current version.


update_stake_fee

Update stake fee.

Parameters:

  • fee: Fee in BPS (max 500)

Emits: FeeUpdateEvent


update_unstake_fee

Update unstake fee.

Parameters:

  • fee: Fee in BPS (max 500)

Emits: FeeUpdateEvent


update_reward_fee

Update reward fee (performance fee).

Parameters:

  • fee: Fee in BPS (max 10000)

Emits: FeeUpdateEvent


update_unstake_fee_redistribution

Update unstake fee redistribution percentage.

Parameters:

  • fee: Percentage in BPS (max 10000)

Emits: FeeUpdateEvent


update_boosted_reward_amount

Set the amount of boosted rewards to distribute per epoch.

Emits: BoostedRewardAmountUpdateEvent


collect_fees

Collect accumulated protocol fees.

Returns: Coin<SUI> - All accumulated fees

Emits: CollectFeesEvent


mint_operator_cap

Mint a new OperatorCap.

Emits: MintOperatorCapEvent


5. Operator Functions

All operator functions require OperatorCap.

set_validator_weights

Set validator weight allocation.

Parameters:

Name
Type
Description

validator_weights

VecMap<address, u64>

Map of validator address to weight

Constraints:

  • Maximum 50 validators

  • Total weight <= 10,000

Emits: ValidatorWeightsUpdateEvent

TypeScript Example:


deposit_boosted_balance

Deposit SUI as boosted rewards.

Parameters:

Name
Type
Description

coin

&mut Coin<SUI>

SUI coin to deposit from

amount

u64

Amount to deposit

Emits: DepositBoostedBalanceEvent


6. Events

StakeEventExt

UnstakeEventExt

EpochChangedEvent

DelegateStakeEvent

ValidatorWeightsUpdateEvent

RebalanceEvent

FeeUpdateEvent

CollectFeesEvent

SetPausedEvent

MintOperatorCapEvent

DepositBoostedBalanceEvent

BoostedRewardAmountUpdateEvent


7. Constants & Error Codes

Constants

Constant
Value
Description

SUI_MIST

1,000,000,000

1 SUI in MIST

MIN_STAKE_AMOUNT

100,000,000

Minimum stake/unstake (0.1 SUI)

MIN_STAKE_THRESHOLD

1,000,000,000

Minimum stake per validator (1 SUI)

MAX_VALIDATORS

50

Maximum validators

MAX_TOTAL_WEIGHT

10,000

Maximum sum of weights

DEFAULT_WEIGHT

100

Default weight for new validators

MAX_STAKE_FEE_BPS

500

Maximum stake fee (5%)

MAX_UNSTAKE_FEE_BPS

500

Maximum unstake fee (5%)

MAX_BPS

10,000

Maximum reward fee (100%)

BPS_MULTIPLIER

10,000

Basis points multiplier

VERSION

2

Current contract version

ACCEPTABLE_MIST_ERROR

10

Allowed rounding error

Error Codes

Module
Code
Name
Description

fee_config

20001

EInvalidFee

Fee exceeds maximum

stake_pool

30000

EZeroMintAmount

Cannot mint zero vSUI

stake_pool

30001

ERatio

Ratio invariant violated

stake_pool

30002

EZeroSupply

Zero supply error

stake_pool

30003

EUnderMinAmount

Below minimum amount

validator_pool

40000

ENotEnoughSuiInSuiPool

Insufficient SUI

validator_pool

40001

ENotActiveValidator

Validator not active

validator_pool

40002

ETooManyValidators

Exceeds max validators

validator_pool

40003

EValidatorAlreadyExists

Validator exists

validator_pool

40004

EValidatorNotFound

Validator not found

validator_pool

40005

EInvalidValidatorWeight

Invalid weight

validator_pool

40006

EInvalidValidatorWeightSum

Weight sum mismatch

validator_pool

40007

EInvalidValidatorSize

Invalid validator size

validator_pool

40008

EMaxTotalWeight

Total weight exceeds max

validator_pool

40009

ETotalSuiSupplyChanged

Supply changed unexpectedly

manage

50001

EIncompatibleVersion

Version mismatch

manage

50002

EIncompatiblePaused

Pool is paused

cert

1

E_INCOMPATIBLE_VERSION

Metadata version mismatch

Last updated