Redeem Calculations

The redemption process in Vesto allows users to convert their derivative tokens back into the underlying collateral assets. This document explains the mathematical calculations involved in redemption, including how yield is accounted for and how the protocol ensures fair distribution of assets.

Basic Redemption Formula

When redeeming derivative tokens, the required amount of each collateral asset to be returned is calculated using the same nominal units that were used during minting:

RequiredAmounti=DerivativeAmount×NominalUniti1018RequiredAmount_i = \frac{DerivativeAmount \times NominalUnit_i}{10^{18}}

Where:

  • RequiredAmountiRequiredAmount_i = Amount of collateral token i to be returned
  • DerivativeAmountDerivativeAmount = Amount of derivative tokens being redeemed
  • NominalUnitiNominalUnit_i = Nominal unit for asset i
  • 101810^{18} = Precision factor (PRECISION constant in the contract)

Note: This is the same formula used to obtain requiredAmounts during the minting process.

Yield-Adjusted Redemption

A key feature of Vesto is that collateral assets may accrue yield while locked in the protocol. The redemption process accounts for this yield, potentially returning more of each asset than was originally provided.

The VestoStrategy contract tracks user positions using a share-based accounting system:

TokensToReturni=Sharesi×TotalAssetsiTotalSharesiTokensToReturn_i = \frac{Shares_i \times TotalAssets_i}{TotalShares_i}

Where:

  • TokensToReturniTokensToReturn_i = Actual amount of tokens to return for asset i (including yield)
  • SharesiShares_i = User's shares for asset i being redeemed
  • TotalAssetsiTotalAssets_i = Total amount of asset i in the strategy (including yield)
  • TotalSharesiTotalShares_i = Total shares issued for asset i

Share Calculation

When a user provides collateral, they receive shares proportional to their contribution:

Sharesnew=DepositAmount×TotalSharesexistingTotalAssetsexistingShares_{new} = \frac{DepositAmount \times TotalShares_{existing}}{TotalAssets_{existing}}

During redemption, these shares are converted back to the appropriate asset amount including any yield:

UserTokenBalancei=UserSharesi×TotalAssetsiTotalSharesiUserTokenBalance_i = \frac{UserShares_i \times TotalAssets_i}{TotalShares_i}

Fee Calculation

Vesto applies a withdrawal fee when users redeem their derivative tokens. This fee is calculated as:

FeeAmounti=TokensToReturni×WITHDRAWAL_FEEPRECISIONFeeAmount_i = TokensToReturn_i \times \frac{WITHDRAWAL\_FEE}{PRECISION} WithdrawAmountAfterFeei=TokensToReturniFeeAmountiWithdrawAmountAfterFee_i = TokensToReturn_i - FeeAmount_i

Where:

  • FeeAmountiFeeAmount_i = Fee amount for asset i
  • WITHDRAWAL_FEEWITHDRAWAL\_FEE = Fee percentage (5e15 or 0.5% in the contract)
  • PRECISIONPRECISION = 1e18 (precision factor)
  • WithdrawAmountAfterFeeiWithdrawAmountAfterFee_i = Final amount of asset i returned to the user

Note: This fee is currently 0.5% but may vary depending on the derivative token in question.

Practical Examples

Example 1: Basic Redemption

Consider a derivative pool with two assets: WETH and USDC.

  • Nominal units for WETH: 0.0002 × 10¹⁸
  • Nominal units for USDC: 0.4 × 10⁶
  • User wants to redeem 100 derivative tokens

Required WETH to return:

RequiredAmountWETH=100×0.0002×10181018=0.02 WETHRequiredAmount_{WETH} = \frac{100 \times 0.0002 \times 10^{18}}{10^{18}} = 0.02 \text{ WETH}

Required USDC to return:

RequiredAmountUSDC=100×0.4×1061018=40 USDCRequiredAmount_{USDC} = \frac{100 \times 0.4 \times 10^{6}}{10^{18}} = 40 \text{ USDC}

Example 2: Yield-Adjusted Redemption

Continuing from Example 1, assume:

  • User has 100 shares for both WETH and USDC
  • Total shares for WETH: 200
  • Total shares for USDC: 200
  • Total WETH in strategy (including yield): 0.042 WETH
  • Total USDC in strategy (including yield): 84 USDC

WETH to return with yield:

TokensToReturnWETH=100×0.042200=0.021 WETHTokensToReturn_{WETH} = \frac{100 \times 0.042}{200} = 0.021 \text{ WETH}

USDC to return with yield:

TokensToReturnUSDC=100×84200=42 USDCTokensToReturn_{USDC} = \frac{100 \times 84}{200} = 42 \text{ USDC}

Example 3: Fee Calculation

From Example 2, calculate the final amount after fees:

WETH fee:

FeeAmountWETH=0.021×5×10151018=0.000105 WETHFeeAmount_{WETH} = 0.021 \times \frac{5 \times 10^{15}}{10^{18}} = 0.000105 \text{ WETH}

WETH after fee:

WithdrawAmountAfterFeeWETH=0.0210.000105=0.020895 WETHWithdrawAmountAfterFee_{WETH} = 0.021 - 0.000105 = 0.020895 \text{ WETH}

USDC fee:

FeeAmountUSDC=42×5×10151018=0.21 USDCFeeAmount_{USDC} = 42 \times \frac{5 \times 10^{15}}{10^{18}} = 0.21 \text{ USDC}

USDC after fee:

WithdrawAmountAfterFeeUSDC=420.21=41.79 USDCWithdrawAmountAfterFee_{USDC} = 42 - 0.21 = 41.79 \text{ USDC}

Protocol Implementation Flow

The redemption process flows through multiple contracts:

  1. User calls redeem on the VestoPool contract
  2. VestoPool burns the derivative tokens
  3. For each collateral asset:
    • VestoPool calculates the required amount
    • VestoPool calls redeem on the VestoStrategy contract
    • VestoStrategy calculates shares and yield-adjusted amounts
    • VestoStrategy applies the withdrawal fee
    • VestoStrategy returns the assets to the user

This structure ensures that users receive their fair share of the collateral assets plus any yield generated while their assets were in the protocol, minus the applicable withdrawal fee. The burn-first approach ensures that derivative tokens are properly removed from circulation before assets are released, maintaining the protocol's collateralization ratio.

On this page