Usual Tech Docs
Usual WebsiteGeneral DocsContract DeploymentsAuditsAccess dApp
  • 🚀GM GM
    • Usual Tech Hub
  • 🔭Overview
    • Usual Protocol Primer
    • Features
      • USD0
      • USD0++
      • USD0 Mint & Redeem Engine
      • ETH0
      • USUAL
      • USUAL*
      • USUALx (USUAL staking)
      • USUAL distribution
      • USUAL Airdrop
      • Usual USD0++ Investment Vault
    • Architecture
      • Role Management
      • USUAL Distribution Model
  • ⛓️Smart Contracts
    • Protocol Contracts
      • USD0
        • USD0 DaoCollateral
        • Swapper Engine
      • ETH0
        • ETH0 DaoCollateral
      • USUAL
        • USUAL staking
        • USUAL* Vested Allocation Staking
        • USUAL Distribution
          • Distribution Module
          • Yield Module
        • Airdrop Module
    • Token Contracts
      • USD0
      • USD0++
      • ETH0
      • USUAL
      • USUAL*
      • USUALx
      • Usual USD0++ Investment Vault
        • VaultRouter
    • Utility Contracts
      • USD0
        • USD0 ClassicalOracle
        • USD0 Abstract Oracle
        • Chainlink Oracles
        • Pyth Oracles
      • ETH0
        • ETH0 Classical Oracle
        • ETH0 Abstract Oracle
        • Lido wstETH Oracle
      • USUAL
        • RedStone Oracle
    • RWA Collateral
      • USYC by Hashnote
      • M by M0
        • UsualM
      • USDtb by Ethena
    • ETH0 Collateral
      • wstETH by Lido
    • Contract Deployments
  • 🛡️Security & Audits
    • Security Practices
    • Testing Framework
    • Monitoring Framework
    • Audits
    • Bug Bounty
  • 🧩Integrations
    • Integrate USD0++
      • Reward redistribution by integration partner
      • Claim Address Redirect
  • 📚Resources
    • Community & Support
    • References
  • 📖Support
    • FAQ
    • Glossary
  • ⚖️Legal
    • Terms of Services
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • High-Level Overview
  • Contract Summary
  • Functionality Breakdown
  • Functions Description
  • Constants
  • Key Components
  • Safeguards Implementation

Was this helpful?

  1. Smart Contracts
  2. Protocol Contracts
  3. ETH0

ETH0 DaoCollateral

High-Level Overview

The DaoCollateral contract is a fundamental component of the ETH0 stablecoin ecosystem, designed to manage the collateralization, minting, and redemption of ETH0 tokens. It ensures that the circulating supply of ETH0 is always fully backed by collateral, providing transparency and security for ETH0 holders. The contract facilitates the swapping of collateral tokens for ETH0, redemption of ETH0 for collateral tokens, and implements a Counter Bank Run (CBR) mechanism for emergency situations.

Contract Summary

Inherited Contracts

  • ReentrancyGuardUpgradeable (OZ): Prevents reentrant attacks on sensitive functions.

  • PausableUpgradeable (OZ): Enables pausing of contract functionality by authorized accounts.

  • EIP712Upgradeable (OZ): Implements EIP-712 for structured data hashing and signing.

Functionality Breakdown

Key Functionalities

  1. Minting and redeeming ETH0: The contract manages the collateralization of ETH0 by handling collateral tokens. When a user sends collateral, the DaoCollateral contract mints the equivalent amount of ETH0 stablecoins, and vice versa, allowing users to exchange their ETH0 stablecoins for collateral at the current exchange rate.

  • Swap: Facilitates the conversion of collateral into ETH0. Upon initiating this function, users exchange their collateral tokens for ETH0 stablecoins directly.

  • Redeem: Allows users to redeem their ETH0 stablecoins for collateral against a fee. By invoking this function, users exchange their ETH0 stablecoins for collateral at the current exchange rate.

  1. Counter Bank Run (CBR) Mechanism: The contract implements a Counter Bank Run mechanism that can be activated in emergency situations. When activated:

  • The CBR coefficient is applied to reduce the amount of collateral returned during redemptions

  • Swap functionality is automatically paused

  • The system helps maintain protocol stability during market stress

  1. Role-Based Access Control

The contract implements a role-based access control system for sensitive operations:

  • DEFAULT_ADMIN_ROLE: Has the highest level of access, including the ability to manage CBR parameters and perform critical administrative tasks.

  • DAO_REDEMPTION_ROLE: Required for special DAO redemption operations.

  • PAUSING_CONTRACTS_ROLE: Grants the ability to pause specific contract functionalities in case of emergencies.

  • UNPAUSING_CONTRACTS_ROLE: Grants the ability to unpause contract functionalities.

Functions Description

Public/External Functions

  • initialize: Sets up the contract with initial parameters including registry information and redeem fee.

  • swap: Allows users to swap collateral tokens for ETH0.

  • swapWithPermit: Similar to swap but uses permit for approval.

  • redeem: Enables users to redeem ETH0 for collateral tokens.

  • redeemDao: Special redemption function for DAO operations. Only callable by DAO_REDEMPTION_ROLE.

  • activateCBR: Activates the Counter Bank Run mechanism. Only callable by DEFAULT_ADMIN_ROLE.

  • deactivateCBR: Deactivates the Counter Bank Run mechanism. Only callable by DEFAULT_ADMIN_ROLE.

  • setRedeemFee: Sets the fee for redemption operations. Only callable by DEFAULT_ADMIN_ROLE.

  • pauseRedeem, pause, pauseSwap: Pausing functions for specific operations. Only callable by PAUSING_CONTRACTS_ROLE.

  • unpause, unpauseRedeem, unpauseSwap: Global unpausing functions. Only callable by UNPAUSING_CONTRACTS_ROLE.

Constants

  • CONTRACT_REGISTRY_ACCESS: Address of the registry access contract.

  • CONTRACT_TOKEN_MAPPING: Address of the token mapping contract.

  • CONTRACT_ORACLE: Address of the oracle contract.

  • CONTRACT_TREASURY: Address of the treasury contract.

  • CONTRACT_ETH0: Address of the ETH0 token contract.

  • CONTRACT_YIELD_TREASURY: Address of the yield treasury contract.

  • DEFAULT_ADMIN_ROLE: Role identifier for the default admin.

  • DAO_REDEMPTION_ROLE: Role identifier for DAO redemption operations.

  • PAUSING_CONTRACTS_ROLE: Role identifier for pausing contract operations.

  • UNPAUSING_CONTRACTS_ROLE: Role identifier for unpausing contract operations.

  • MAX_REDEEM_FEE: Maximum allowed redemption fee (25%).

  • BASIS_POINT_BASE: Base value for basis point calculations (10000).

  • SCALAR_ONE: Scalar value representing 1 in the contract's decimal system.

Key Components

  • Oracle Integration: Uses an oracle to fetch real-time price data for collateral tokens.

  • Token Mapping: Manages the mapping of supported collateral tokens.

  • Access Control: Implements role-based access control for administrative functions.

  • Treasury Management: Handles the storage and distribution of collateral tokens.

Safeguards Implementation

  • Pausability: Allows pausing of critical functions in emergencies.

  • Reentrancy Protection: Uses OpenZeppelin's ReentrancyGuard to prevent reentrancy attacks.

  • Access Control: Restricts sensitive operations to authorized roles.

  • CBR Mechanism: Implements a Counter Bank Run mechanism for emergency situations.

  • Fee Management: Implements a configurable redemption fee system with a maximum cap of 25%.

PreviousETH0NextUSUAL

Last updated 6 days ago

Was this helpful?

⛓️