Minting Calculations
Vesto's derivative minting process relies on precise mathematical calculations to ensure each derivative token is properly backed by the appropriate collateral assets. This document outlines the key formulas used in the minting process and provides concrete examples to illustrate how these calculations work in practice.
Key Formulas
Nominal Units Calculation
When a derivative pool is initialized, nominal units are calculated for each collateral asset. These represent the base quantity of each token required to mint one unit of the derivative token.
For each asset i:
Where:
- = Nominal units for asset i
- = Normalized weight for asset i (in 1e18 precision)
- = Base value of the derivative (typically 1e18 for $1)
- = Current price of asset i in USD (in 1e18 precision)
- = Decimal places for asset i
Required Amounts for Multi-Asset Entry
When minting derivative tokens with multiple assets, the required amount of each collateral token is calculated as:
Where:
- = Required amount of collateral token i
- = Amount of derivative tokens to mint
- = Nominal unit for asset i
vBasket Value Calculation
The vBasket represents the total value of the derivative basket and is calculated as:
Where:
- = Total value of the derivative basket in USD (in 1e18 precision)
- = Number of collateral assets in the basket
Single-Asset Entry Calculation
For single-asset entry, the derivative amount that can be minted is:
Where:
- = Value of input token in USD (in 1e18 precision)
Practical Examples
Example 1: Nominal Units Calculation
Consider a derivative pool with two assets: WETH and USDC.
- WETH weight: 0.6 × 10¹⁸ (60%)
- USDC weight: 0.4 × 10¹⁸ (40%)
- Base value: 1 × 10¹⁸ ($1)
- WETH price: 3,000 × 10¹⁸ ($3,000)
- USDC price: 1 × 10¹⁸ ($1)
- WETH decimals: 18
- USDC decimals: 6
Nominal units for WETH:
Nominal units for USDC:
Example 2: Required Amounts for Multi-Asset Entry
Building on Example 1, if a user wants to mint 100 derivative tokens:
Required WETH:
Required USDC:
Example 3: vBasket Value Calculation
With the same parameters as Example 1:
WETH contribution:
USDC contribution:
vBasket value:
Example 4: Single-Asset Entry Calculation
If a user wants to enter the same pool using only WETH:
- Input amount: 0.05 WETH
- WETH price: 3,000 × 10¹⁸ ($3,000)
- vBasket value: 1 × 10¹⁸ ($1)
Input value in USD:
Derivative amount:
This means providing 0.05 WETH would allow the user to mint 150 derivative tokens. Behind the scenes, the protocol would convert part of the WETH to obtain the necessary USDC to maintain the proper collateral ratio.
Implementation in Smart Contracts
In the Vesto contracts, these calculations are implemented in several key functions:
- The
_initialize
function in the VestoPool contract calculates the nominal units during pool creation - The
issue
function calculates required amounts for multi-asset entry - The
calculateDerivativeAmountViaInputToken
function handles the single-asset entry calculations - The
calculateVestoPoolValue
function computes the current vBasket value
These calculations ensure that derivative tokens maintain their proper backing regardless of market price fluctuations, providing users with a reliable and transparent mechanism for creating and redeeming synthetic assets on the Vesto protocol.