Derivative Token Mechanics

Herafi Protocol: Derivative Token Mechanics

Herafi's derivative tokens represent the core value proposition of the protocol, enabling users to gain exposure to custom-defined baskets of assets through a single token. This document explains the mechanics behind these derivative tokens, including their structure, creation, valuation, issuance, and redemption processes.

Multi-Collateral Structure

Each derivative token in Herafi is backed by a basket of collateral assets with specific properties:

Weight Distribution

Each collateral asset is assigned a specific weight representing its proportion of the derivative's value:

  • Weights are expressed as percentages (e.g., 60% ETH, 30% BTC, 10% USDC)
  • Weights must always sum to 100% (or 1.0 in decimal representation)
  • Weights define the exposure profile of the derivative token

For example, a derivative token called "hDefi" might represent:

  • 30% AAVE (weight: 0.3)
  • 25% UNI (weight: 0.25)
  • 20% COMP (weight: 0.2)
  • 15% MKR (weight: 0.15)
  • 10% SNX (weight: 0.1)

This structure provides exposure to a basket of DeFi governance tokens through a single derivative token.

Base Value

Each derivative token has a reference value that governs its overall pricing:

  • Typically pegged to a stable reference like USD
  • Represented in high precision (e.g., 1 USD = 10^18 in internal calculations)
  • Used as the foundation for nominal unit calculations

The base value serves as the target value for a single unit of the derivative token, ensuring consistent valuation across different market conditions.

Nominal Units

The protocol calculates the nominal units for each asset based on the formula:

CNi=wi×BaseValuePi×10DiCN_i = \frac{w_i \times BaseValue}{P_i} \times 10^{D_i}

Where:

  • CNiCN_i is the nominal unit for asset ii
  • wiw_i is the weight assigned to asset ii
  • BaseValueBaseValue is the target value of the derivative token
  • PiP_i is the price of asset ii
  • DiD_i is the decimals of asset ii

This calculation ensures that the portfolio maintains the desired weight distribution while accounting for the different decimal precision of various assets.

Example Calculation

For a derivative with a base value of $100 and the following assets:

  1. ETH (18 decimals) at $2,000 with weight 0.6 (60%)

    • CNETH=0.6×1002,000×1018=0.03×1018CN_{ETH} = \frac{0.6 \times 100}{2,000} \times 10^{18} = 0.03 \times 10^{18}
  2. WBTC (8 decimals) at $30,000 with weight 0.3 (30%)

    • CNWBTC=0.3×10030,000×108=0.001×108CN_{WBTC} = \frac{0.3 \times 100}{30,000} \times 10^{8} = 0.001 \times 10^{8}
  3. USDC (6 decimals) at $1 with weight 0.1 (10%)

    • CNUSDC=0.1×1001×106=10×106CN_{USDC} = \frac{0.1 \times 100}{1} \times 10^{6} = 10 \times 10^{6}

These nominal units represent the exact quantity of each asset that backs a single derivative token.

Derivative Token Creation

The creation of new derivative tokens in Herafi follows a controlled process:

Creation Authorization

In the initial version of the protocol, derivative token creation is restricted to the protocol developers and governance:

  • Only authorized addresses can create new derivative tokens
  • This ensures quality, security, and market fit of derivative offerings
  • Future versions will enable community governance to propose and approve new derivatives

Creation Parameters

To create a new derivative token, the following parameters must be specified:

  1. Name and Symbol: Standard ERC-20 identifiers (e.g., "Herafi DeFi Index", "hDEFI")
  2. Collateral Assets: Array of supported token addresses to be used as collateral
  3. Weights: The percentage allocation for each collateral asset (must sum to 100%)
  4. Base Value: The reference value for the derivative (typically 1 USD)
  5. Oracle References: Price feed information for each collateral asset

Creation Process

  1. The authorized controller calls the derivative factory with the creation parameters
  2. The system validates all parameters (weights sum to 100%, all assets supported, etc.)
  3. A new HeraPool instance is deployed with the specified parameters
  4. Initial nominal units are calculated based on current market prices
  5. The new derivative token is registered in the protocol registry
  6. The derivative token becomes available for issuance and trading

Derivative Valuation

Derivative tokens are valued based on the underlying collateral assets:

Valuation Formula

The value of the derivative token is calculated as:

Vderivative=i=1n(CNi×Pi)V_{derivative} = \sum_{i=1}^{n} (CN_i \times P_i)

Where:

  • CNiCN_i is the nominal unit for collateral asset ii
  • PiP_i is the market price of collateral asset ii
  • nn is the number of collateral assets

This ensures that each derivative token maintains a transparent and verifiable value proposition.

Price Exposure

Derivative tokens automatically reflect price changes in the underlying assets:

  • If the value of a collateral asset increases, the derivative token value increases proportionally to that asset's weight
  • If the value of a collateral asset decreases, the derivative token value decreases proportionally to that asset's weight
  • This provides passive exposure to the price movements of the entire basket

Yield Accrual

For derivatives using yield-generating strategies:

  • Yields generated by collateral assets accrue to derivative token holders
  • This happens through an increase in the value of the underlying collateral
  • No rebalancing or claim process is required by users

Issuance Methods

Users can obtain derivative tokens through two primary methods:

Multi-Asset Issuance

The standard issuance process requires users to deposit the exact ratio of collateral assets defined by the derivative token:

  1. User approves the HeraPool contract to transfer the required collateral tokens
  2. User calls the issue function with the desired amount of derivative tokens
  3. HeraPool calculates the required amount of each collateral asset based on nominal units
  4. HeraPool transfers the collateral assets from the user to the appropriate HeraStrategy instances
  5. The corresponding amount of derivative tokens is minted and sent to the user

This process ensures direct collateralization of the derivative token.

Single-Asset Issuance

Herafi's most innovative feature is the ability to issue derivative tokens using a single collateral type:

  1. User approves the HeraPool contract to transfer the input token
  2. User calls the issueWithSingleToken function specifying the input token and amount
  3. HeraPool transfers the input token to the UnifiedLiquidityPool
  4. The UnifiedLiquidityPool automatically converts the single token into the required collateral ratio through internal swaps
  5. HeraPool receives the collateral assets in the correct proportions and transfers them to the appropriate HeraStrategy instances
  6. Derivative tokens are minted and provided to the user

The formula for calculating the derivative amount from a single input token is:

DerivativeAmount=InputAmount×InputTokenPriceBaseValue×10InputTokenDecimalsDerivativeAmount = \frac{InputAmount \times InputTokenPrice}{BaseValue \times 10^{InputTokenDecimals}}

This mechanism dramatically simplifies user experience while maintaining the economic properties of the derivative token.

Redemption Methods

When users want to exit their derivative position, they have multiple options:

Multi-Asset Redemption

The standard redemption process returns the underlying collateral assets to the user:

  1. User calls the redeem function with the amount of derivative tokens to burn
  2. HeraPool burns the specified amount of derivative tokens
  3. HeraPool calculates the amount of each collateral asset to return based on nominal units
  4. HeraPool withdraws the collateral assets from the appropriate HeraStrategy instances
  5. HeraPool transfers the collateral assets to the user

This mechanism ensures the derivative token maintains its defined value proposition through direct collateralization.

Single-Asset Redemption

For convenience, users can redeem derivative tokens for a single asset:

  1. User calls the redeemToSingleToken function specifying the output token and derivative amount
  2. HeraPool burns the specified amount of derivative tokens
  3. HeraPool calculates the amount of each collateral asset to withdraw
  4. HeraPool withdraws the collateral assets from the appropriate HeraStrategy instances
  5. HeraPool transfers the collateral assets to the UnifiedLiquidityPool
  6. The UnifiedLiquidityPool performs the necessary swaps to convert all assets to the requested output token
  7. The output token is transferred to the user

This single-asset redemption typically incurs higher fees than multi-asset redemption, especially for scarce tokens, but offers significantly improved user experience.

Example User Flow

The following example illustrates the typical user journey within the Herafi Protocol, demonstrating derivative token mechanics in action:

Scenario: Multi-Asset Exposure

Consider an investor named Alice who seeks exposure to multiple digital assets without the complexity of managing each position individually. Alice decides to purchase hDefi, a derivative token representing a basket of DeFi protocol tokens.

Step 1: Derivative Token Acquisition via Single Token

Alice initiates a transaction to acquire hDefi tokens using 1,000 USDC as the input token. The process occurs as follows:

  1. Alice approves the HeraPool contract to spend 1,000 USDC
  2. Alice calls issueWithSingleToken specifying USDC and 1,000 units
  3. HeraPool transfers the 1,000 USDC to the UnifiedLiquidityPool
  4. The UnifiedLiquidityPool converts the USDC into the appropriate proportions of collateral tokens according to the hDefi specification (e.g., AAVE, UNI, COMP, MKR, SNX)
  5. HeraPool receives the collateral assets and transfers them to the respective HeraStrategy instances
  6. HeraPool calculates and mints the appropriate amount of hDefi tokens to Alice's wallet

Step 2: Collateral Management

Behind the scenes, the HeraStrategy contracts manage the collateral tokens representing Alice's position:

  1. Selected tokens are lent through Aave integration, generating yield
  2. Remaining assets are held in the contract to maintain appropriate liquidity
  3. Alice's ownership rights are tracked through a share-based accounting system

Step 3: Market Exposure Benefits

After several days, market conditions shift, and the underlying assets in the hDefi basket experience price variations:

  • AAVE increases by 5%
  • UNI decreases by 2%
  • COMP increases by 3%
  • MKR increases by 1%
  • SNX decreases by 4%

Due to the weighted exposure, the hDefi tokens, originally valued at 1,000,arenowworthapproximately1,000, are now worth approximately 1,006.5, calculated as: (1,000×0.3×1.05)+(1,000 × 0.3 × 1.05) + (1,000 × 0.25 × 0.98) + (1,000×0.2×1.03)+(1,000 × 0.2 × 1.03) + (1,000 × 0.15 × 1.01) + ($1,000 × 0.1 × 0.96)

This demonstrates a key benefit of the protocol: Alice has effectively gained exposure to price movements across multiple tokens through a single derivative position, without having to monitor or manage individual holdings.

Step 4: Exit Options

When Alice decides to exit her position, she has multiple options:

  1. Multi-Asset Redemption: Redeem the hDefi tokens for the underlying collateral assets in their exact proportions

    • Lowest fees (typically 0.1-0.2%)
    • Receives a basket of all underlying tokens
  2. Single-Asset Redemption (to USDC): Redeem for a single asset of her choice

    • Higher fees (1% base fee plus any scarcity adjustments)
    • Receives only USDC
    • Most convenient option
  3. Trading: Sell the hDefi tokens directly to another user through the UnifiedLiquidityPool

    • Standard swap fees apply (typically 0.3% plus any scarcity adjustments)
    • Receives any supported token

This flexibility allows users to optimize their entry and exit based on their specific needs and market conditions.