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:
- Engine validates that USDC is whitelisted and the amount exceeds the minimum threshold
- Engine computes the current exchange rate
- DERA minted = deposit amount / exchange rate
- Capital allocated across connectors proportionally to current weights
mint()called on DERA;DERAMintevent emitted
Post-mint, the exchange rate is unchanged: TVL and supply increase proportionally.
Redemption
When a user calls burnDeraAndWithdrawFunds:
- Engine computes the current exchange rate
- Gross USDC = DERA amount x exchange rate
- Net USDC = Gross USDC x (1 - fee)
- Funds withdrawn from connectors proportionally
burn()called on DERA; DERA supply decreases- Net USDC transferred to user;
DERABurnevent 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 allocationremovePool: Withdraws capital and removes the poolsetProtocolPoolAllocation: 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.