Demether is a cutting-edge multichain protocol designed to maximize yield across different blockchain networks. By leveraging a sophisticated blend of restaking, stablecoins, and other financial derivatives, Demether ensures efficient and secure high-yield opportunities for its users. Demether is designed for users seeking to maximize their ETH yields across multiple blockchain layers while minimizing risk and complexity.
- Multi-Layer Staking: Supports ETH staking on both Layer 1 (Ethereum mainnet) and Layer 2 networks.
- Cross-Chain Functionality:
- Enables seamless transfer of assets and messages between different blockchain networks.
- Utilizes StarGate Bridge v1 for ETH transfers between Layer 1 and Layer 2.
- Yield Optimization:
- Utilizes multiple strategies (e.g., frxETH, EigenLayer) to maximize staking returns.
- Deposits are allocated into sfrxETH and EigenLayer LST deposits.
- EigenLayer Integration:
- Supports a single operator for the EigenLayer staking strategy.
- Liquidity Management: Efficient handling of user deposits and withdrawals across layers.
- Protocol-Owned Liquidity: Accumulates fees to build protocol-owned liquidity, enhancing sustainability.
- Rate Synchronization: Rates are synced between Layer 1 and Layer 2 chains by public call.
- Upgradeable Design: Allows for future improvements and additions to the protocol.
- Flexible Design: Allows for easy integration of new yield strategies and supported networks in the future.
The Demether protocol consists of several key components:
- DOFT (Demether Open Fungible Token): ERC20 token representing staked ETH.
- DepositsManagerL1: Manages user deposits on Layer 1.
- DepositsManagerL2: Manages user deposits on Layer 2.
- Messenger: Facilitates cross-chain message and token transfers.
- LiquidityPool: Manages ETH liquidity and staking strategies.
DOFT is an ERC20 token with cross-chain capabilities and upgradability features for the Demether protocol.
- ERC20 token functionality
- Cross-chain transfer capabilities via LayerZero
- Upgradeable contract design
- Controlled minting and burning
initialize(string _name, string _symbol, address _delegate, address _minterAddress): Initializes the token with name, symbol, delegate, and mintermint(address _to, uint256 _amount): Mints new tokens to a specified addressburn(address _from, uint256 _amount): Burns tokens from a specified addresssend(SendParam memory _sendParam, MessagingFee memory _fee, address payable _refundAddress): Sends tokens across chains
- Minting and burning restricted to a designated minter address
- Ownership and upgrade control managed by the contract owner
OFTUpgradeable: Provides cross-chain token transfer capabilitiesUUPSUpgradeable: Enables contract upgradeability- LayerZero endpoint: Used for cross-chain messaging
- Inherits from
OFTUpgradeablefor cross-chain functionality - Inherits from
UUPSUpgradeablefor upgrade mechanisms
DepositsManagerL1 manages user deposits on Layer 1 within the Demether protocol, handling deposit reception, cross-chain messaging, and token minting.
- Accepts ERC-20 and native currency deposits
- Converts ETH to WETH for compatibility
- Mints DETH tokens representing user shares
- Facilitates cross-chain deposits to Layer 2
- Allocates assets to high-yield L1 strategies
deposit(uint256 _amountIn, uint32 _chainId, uint256 _fee, address _referral): Handles WETH depositsdepositETH(uint32 _chainId, uint256 _fee, address _referral): Handles native ETH depositsgetConversionAmount(uint256 _amountIn): Calculates DETH tokens to mintsyncRate(uint32[] _chainId, uint256[] _chainFee): Synchronizes rates across chainsaddLiquidity(): Adds liquidity to the pool from the contract's balancegetRate(): Retrieves the current conversion rate from the liquidity pool
- User deposits ETH/WETH
- Funds are converted to WETH if necessary
- DETH tokens are minted based on current exchange rates
- For L2 strategies, cross-chain messaging is initiated
- Funds are allocated to yield-generating strategies
IDOFT: Interface for minting DETH tokensILiquidityPool: Manages liquidity and provides exchange ratesIMessenger: Handles cross-chain communicationIWETH9: Wraps and unwraps ETH
DepositsManagerL2 manages user deposits on Layer 2 within the Demether protocol, handling deposit reception, cross-chain messaging, and token minting.
- Accepts ERC-20 and native currency deposits
- Converts ETH to WETH for compatibility
- Mints DOFT tokens representing user shares
- Facilitates cross-chain deposits to Layer 1
- Syncs exchange rates with Layer 1
deposit(uint256 _amountIn, uint32 _chainId, uint256 _fee, address _referral): Handles WETH depositsdepositETH(uint32 _chainId, uint256 _fee, address _referral): Handles native ETH depositsgetConversionAmount(uint256 _amountIn): Calculates DOFT tokens to mintgetRate(): Retrieves the current conversion ratesyncTokens(uint256 _amount): Syncs tokens with Layer 1onMessageReceived(uint32 _chainId, bytes calldata _message): Handles incoming messages from Layer 1
- User deposits ETH/WETH
- Funds are converted to WETH if necessary
- DOFT tokens are minted based on current exchange rates
- For L1 transfers, cross-chain messaging is initiated
- Deposit fee is applied for gas and slippage coverage
IDOFT: Interface for minting DOFT tokensIMessenger: Handles cross-chain communicationIWETH9: Wraps and unwraps ETH
- Exchange rate synced from Layer 1
- Rate updates tracked by block number
Messenger facilitates cross-chain message and token transfers within the Demether protocol, integrating with various bridge protocols.
- Supports multiple bridge protocols (LayerZero, Stargate)
- Handles cross-chain token transfers
- Manages cross-chain messaging
- Configurable settings for different chains and bridges
syncTokens(uint32 _destination, uint256 _amount, address _refund): Initiates cross-chain token transferssyncMessage(uint32 _destination, bytes calldata _data, address _refund): Sends messages across chainslzReceive(Origin calldata _origin, bytes32, bytes calldata _message, address, bytes calldata): Handles incoming LayerZero messagesquoteLayerZero(uint32 _destination): Quotes fees for LayerZero messages
setSettingsMessages(uint32 _destination, Settings calldata _settings): Updates message transfer settingssetSettingsTokens(uint32 _destination, Settings calldata _settings): Updates token transfer settingssetRouters(uint8[] calldata _bridgeIds, address[] calldata _routers, address _owner): Sets router addresses for bridge protocols
ILayerZeroEndpointV2: Interface for LayerZero operationsIStargateRouterETH: Interface for Stargate operationsIWETH9: Interface for WETH operationsIDepositsManager: Interface for deposits management
- LayerZero: For cross-chain messaging
- Stargate: For cross-chain token transfers
LiquidityPool manages ETH liquidity, staking, and yield strategies within the Demether protocol, integrating with frxETH and EigenLayer.
- Manages ETH liquidity and share issuance
- Integrates with frxETH for ETH staking
- Utilizes EigenLayer for additional yield strategies
- Handles protocol fees and rewards distribution
addLiquidity(bool _process): Adds liquidity to the pool and optionally processes ittotalAssets(): Calculates total assets in the poolgetRate(): Returns the current exchange rate of shares to ETHdelegateEigenLayer(address _operator): Delegates to an operator in EigenLayer
_convertToShares(uint256 _deposit): Converts deposit amount to shares_mintSfrxETH(): Mints sfrxETH with available ETH balance_eigenLayerRestake(): Restakes sfrxETH in EigenLayer
setFraxMinter(address _fraxMinter): Sets the frxETH minter addresssetEigenLayer(address _strategyManager, address _strategy, address _delegationManager): Sets EigenLayer contractssetProtocolFee(uint256 _fee): Sets the protocol feesetProtocolTreasury(address payable _treasury): Sets the protocol treasury address
IsfrxETH: Interface for sfrxETH operationsIfrxETHMinter: Interface for frxETH mintingIStrategyManager,IStrategy,IDelegationManager: Interfaces for EigenLayer integration
- frxETH: Primary ETH staking strategy
- EigenLayer: Additional yield through restaking
- Users deposit ETH (or WETH) into DepositsManagerL1 or DepositsManagerL2.
- The protocol mints DETH/DOFT tokens representing the user's share.
- Deposited ETH is sent to the LiquidityPool for yield generation.
- LiquidityPool stakes ETH using frxETH and potentially restakes using EigenLayer.
- Yields are accumulated and reflected in the increasing value of DETH/DOFT tokens.
- Cross-chain operations are facilitated by the Messenger contract using StarGate Bridge.
- Accumulated yields are periodically distributed, increasing the value of user shares.
The liquid token rates originate from the L1 chain and are propagated to the L2 chains. The rate is used to determine the amount of liquid tokens to mint when a user deposits ETH. To avoid staleness of the rate on any L2, if the rate has not been updated after a given time, the contract will not allow further deposits or withdrawals until a new rate is synced.
To update the rate, call syncRate() on DepositsManagerL1.sol, providing the chainId and the appropriate gas fees.
The syncTokens() function on DepositsManagerL2.sol allows users to sync tokens from L2 to L1. This function requires paying gas fees, which can be quoted by calling quoteLayerZero() on Messenger.sol.
Deposits from both L1 and L2 remain in the DepositsManager contract. A public call to addLiquidity() initiates the process of moving the funds to the pool, minting sfrxETH, and staking into EigenLayer.
- Upgradeable contracts with access control
- Integration with established protocols (frxETH, EigenLayer)
- Cross-chain message verification and security measures
- Regular security audits and open-source code for community review
- Timelocks and multisig controls on critical protocol functions