Skip to main content

Contract Flow

This page covers how the Dera Protocol calculates token value, manages capital flows, and allocates yield through its on-chain smart contract system.

The system consists of DeraEngine, DERA, and a modular set of DeFi protocol connectors. These components work together to handle conversions, allocate capital, mint yield-bearing tokens, and process redemptions while tracking TVL and exchange rate on-chain.

Exchange Rate

The exchange rate of DERA is derived from the aggregate value of all assets deployed across active connectors, divided by total token supply:


Exchange Rate = TVL / Total DERA Supply


Where:

  • TVL = sum of all connector asset values, queried via Chainlink price feeds
  • Total DERA Supply = ERC-20 total supply as tracked on-chain


The exchange rate is computed on-chain at the time of each mint or redemption call. No spread mechanism is implemented. A configurable withdrawal fee, initially set at 0% and capped at 0.1%, may be applied at redemption. All fee parameters are governed via DeraAdmin and are publicly verifiable on-chain.

Yield Accrual

The Dera Engine supports two LP token yield mechanisms depending on the integrated protocol:


Value-appreciating LP tokens (e.g. Fluid fTokens): the LP token itself increases in price over time.

Value_i(t) = LP_balance_i(t) x LP_price_i(t)

Rebasing LP tokens (e.g. Aave aTokens): the quantity of LP tokens held increases while price remains constant.

Value_i(t) = LP_balance_i(t) x 1

In both cases, yield accrual is reflected passively without any action from participants. As TVL increases while supply remains constant, the exchange rate adjusts upward for all holders simultaneously.

Capital Flow

User Wallet
|
| Convert whitelisted stablecoin (USDC)
v
DeraEngine Contract
|
| Validate input, calculate allocation weights
| Route capital to connectors proportionally
v
Protocol Connectors (Aave, Fluid, Compound)
|
| Deploy capital into external DeFi protocol
| Accrue yield via LP token appreciation or rebase
v
TVL increases => Exchange Rate adjusts upward
|
| On redemption: burn DERA, withdraw proportional USDC
| (Safety Escrow as fallback if connector unavailable)
v
User Wallet

Minting

When a user calls depositTokenAndMintDera:

  1. Engine validates that USDC is whitelisted and the amount exceeds the minimum threshold
  2. Engine computes the current exchange rate
  3. DERA minted = deposit amount / exchange rate
  4. Capital allocated across connectors proportionally to current weights
  5. mint() called on DERA; DERAMint event emitted

Post-mint, the exchange rate is unchanged: TVL and supply increase proportionally.

Redemption

When a user calls burnDeraAndWithdrawFunds:


  1. Engine computes the current exchange rate
  2. Gross USDC = DERA amount x exchange rate
  3. Net USDC = Gross USDC x (1 - fee)
  4. Funds withdrawn from connectors proportionally
  5. burn() called on DERA; DERA supply decreases
  6. Net USDC transferred to user; DERABurn event emitted


If a connector cannot fulfil its withdrawal obligation, the Engine reroutes through DeraSafetyEscrow. The user receives their full entitlement.

TVL Tracking

The Dera Protocol does not take custody of user assets. TVL represents capital routed into third-party protocols via connectors, not assets held by Dera. TVL is computed by querying each active connector and summing asset values via Chainlink price feeds.

Allocation Management

Pool allocation weights are set by the protocol administrator via DeraAdmin. All weights must sum to 100%. The Engine exposes the following allocation functions:


  • addProtocolPool: Adds a new connector pool with zero initial allocation
  • removePool: Withdraws capital and removes the pool
  • setProtocolPoolAllocation: Assigns percentage weights across active pools
  • Reallocation is achieved by updating weights and triggering proportional withdraw/deposit cycles


All allocation operations emit on-chain events and are restricted to ADMIN_ROLE.