Skip to main content

Contract Logic --- Value Calculation, Liquidity Flow, and Interest Allocation

This section covers how Dera calculates token value, manages liquidity, and allocates interest through its on-chain infrastructure. The logic is designed to offer transparent, predictable, and auditable financial behavior, fully aligned with MiCA's expectations on verifiability and investor protection.

The system consists of the DeraEngine, DERA1, and a modular set of DeFi protocol connectors. These components work in tandem to handle deposits, allocate capital, mint yield-generating tokens, and process withdrawals while tracking TVL and token price on-chain.

Money Flow Diagram: Protocol-Level Asset Movement

    The diagram below outlines the full capital flow in the Dera protocol --- froim user stablecoin deposits to yield accrual in external DeFi protocols and final user withdrawals.

📊 Diagram Description (for visual rendering)


[User Wallet]

     |

     |---> 1. Deposit Whitelisted Stablecoin (USDC) ---> [DeraEngine Contract]

                                                   |

                                                   |---> 2. Validate Input & Allocate Funds

                                                   |

                                                   |---> 3. Route Funds to DeFi Pools via Connectors

                                                              |

                                                              |---> External DeFi Protocols (Aave, Fluid, etc.)

                                                                        |

                                                                        |---> Accrue Interest (via LP tokens or rebasing)

                                                   |

     |<--- 4. Mint DERA Tokens to User [DERA1 Contract] (1:1 TVL Peg)

     |

     ... [Time Passes, Yield Accrues] ...

     |

     |---> 5. User Calls `burnDeraWithdrawFunds()` to Redeem

                                                   |

                                                   |---> 6. Withdraw Funds from Connectors (LP to USDC)

                                                   |

     |<--- 7. Return USDC + Interest to User Wallet

Key Points:

  • Funds are never held by the protocol; they are routed directly into external yield-bearing pools.

  • Token minting/burning is tightly linked to real asset flows, ensuring full on-chain traceability.

  • The system supports MiCA-aligned investor protections, with logged interactions and auditable smart contract events (DERAMint, DERABurn, FundsAllocated, FeeWithdrawn, etc.).

  • Escrow fallback paths and pausable connectors preserve operational continuity in case of failure.


How the price is calculated

The price of 1 DERA token is derived from the aggregate value of all assets deployed into yield-generating pools, divided by the total token supply. This price reflects accrued interest and ensures that the token value increases predictably over time.

Price Formula:

mathematica


DERA Price = Total Value of Assets / Total Supply of DERA

Where:

  • Total Value of Assets = ∑ (pool LP token balances × current price per LP token)

  • Total Supply of DERA = ERC-20 total supply as tracked on-chain

This ensures that every token redeemed corresponds proportionally to a user's share of the protocol's TVL.

Note: The protocol does not implement a spread mechanism. Instead, it supports a configurable withdrawal/service fee, which is applied at the time of redemption and can be set (or updated) by the protocol admin.

  • This fee is initially set to 0%.

  • All fee configurations are bounded by a 1% cap and governed via DeraAdmin.

This model ensures pricing transparency, preserves the peg between token supply and underlying asset value, and aligns with MiCA's guidelines on investor fairness and fee disclosure.

Price increase (LP token value increase)

The underlying DeFi  protocol connectors' (e.g., Fluid) yield returns the increase in the value of the deposited LP tokens over time. Since the DERA token price is directly tied to these pool values, token holders enjoy passive appreciation of their token's value.

No new tokens are minted during yield accrual---value increase is entirely from rising pool value, not inflationary mechanisms.

How is the price increase of the tokens calculated? It depends on the connector contract and the connected liquidity pool (which token mechanism the underlying defi protocol uses for their liquidity pool). The most common are rebase tokens or value-increasing tokens. For example, one LP token (that we hold as collateral) might accrue interest by growing in value. E.g.: Fluid fTokens. Today one fToken token of the Fluid USDC pool might be worth $1,00000, tomorrow it could be $1,00001--this is a LP token that increases in value. Another approach is a rebase mechanism, which would increase the amount of LP tokens in the wallet/smart contract. E.g.: Aave aTokens.Today we hold 1000 aTokens, worth $1,00 each. Tomorrow we hold 1001 aTokens $1,00 each.

Which mechanism is being used in each connector contract, and how we handle the price increase calculation for each is subject to change and can be answered in detail by the developer team. *

TVL

Unlike custodial protocols, Dera does not take custody of user assets. Instead, it acts as a non-custodial router that programmatically allocates capital into external protocols. TVL represents capital routed into third-party protocols, not assets held by Dera.

This model ensures:

  • Transparent capital deployment

  • Reduced legal liability under MiCA

  • Decentralized risk

TVL is tracked by querying each pool via their connector contracts and summing asset values, which are also used in price and fee calculations.

Smart contract "process"

This section explains the key operational flows: minting, burning, interest distribution, and fund reallocation.

Mint / Buy

Users deposit a whitelisted stablecoin (USDC, USDT, etc.) through depositTokenAndMintDera. The protocol:

1. Calculates the current buy price.

2. Allocates funds across configured pools by depositing via the protocol connectors and receiving LP tokens specific to each protocol.

3. Mints the user DERA tokens equivalent to their asset total deposit value.

4. Emits a DERAMint event.

This transaction is secured with reentrancy guards and validates token whitelisting and amount thresholds.

Burn/Sell

Users initiate withdrawals via burnDeraAndWithdrawFunds:

  • DERA tokens are burned. This action reduces the circulating supply and initiates the redemption process.

  • The protocol withdraws LP tokens from DeFi connectors based on the user's proportional pool allocations.

 These LP tokens represent the user's share of the yield-generating assets.

  • Chainlink price feeds are consulted to determine the fair market value of the assets.

 This ensures accurate, tamper-resistant valuation aligned with real-time market conditions.

  • Deposited USDC + accrued interest is returned to the user. The payout reflects the user's share of the TVL and the interest earned over time.

  • A DERABurn event is emitted. This provides on-chain traceability and ensures transparency for off-chain integrations and audits.

Withdrawal preserves liquidity and aims to be MiCA-compliant with full on-chain traceability.

User flow:

Brief description of user flow + user flow diagram (max 250 words)

The Dera protocol's user flow is architected to provide a seamless, permissionless experience for interacting with yield-generating  assets---while preserving self-custody, yield accrual, and full liquidity.

The process begins when a user chooses to deposit a supported stablecoin---such as USDC---via the depositTokenAndMintDera function exposed in the DeraEngine contract. This triggers a series of on-chain operations:

1. Token Validation and Engine Approval: The contract verifies if the submitted token is whitelisted and checks that the user has approved the engine to deposit their tokens

2. Dynamic Allocation Calculation: Based on pool percentages set by the admin, the deposited funds are divided proportionally across pools.

3. Connector-Level Execution: Funds are routed to respective connector contracts to deposit into third-party protocols

4. Minting DERA Tokens: Once funds are deployed, the equivalent value in DERA tokens is minted and transferred to the user. These tokens represent a claim on their proportional share of the underlying pooled assets.

5. Passive Yield Accrual: Yield is continuously accrued in the form of increasing LP token value or a token rebase mechanism, depending on the third-party protocol's yield distribution methods. The DERA token price reflects this appreciation over time.

6. Redemption: When a user calls burnDeraWithdrawFunds, the DERA tokens are burned and the equivalent value in USDC is returned by withdrawing funds from the same connector paths---executed in reverse.

All interactions are secured by reentrancy guards and emit detailed events to facilitate compliance tracking, user transparency, and off-chain integrations.