Rocket Pool Protocol Adapter

The Rocket Pool adapter enables the Yieldinator Facet to integrate with Rocket Pool's decentralized ETH staking protocol, allowing users to earn staking rewards through rETH (Rocket Pool ETH) tokens.

Overview

Rocket Pool is a decentralized Ethereum staking protocol that allows users to stake ETH and earn staking rewards without running validator nodes themselves. The protocol issues rETH tokens that represent staked ETH plus accrued rewards, with the token value increasing over time relative to ETH.

Unlike other liquid staking protocols, Rocket Pool is designed to be highly decentralized, with node operators required to provide RPL (Rocket Pool token) collateral to run validators. This creates a more distributed validator set compared to other staking solutions.

The Rocket Pool adapter facilitates deposits into the protocol, manages rETH token balances, and handles staking rewards through a standardized interface.

Implementation Details

Contract: RocketPoolAdapter.sol

The adapter implements the standard YieldinatorAdapter interface with Rocket Pool-specific functionality:

contract RocketPoolAdapter is YieldinatorAdapter {
    using SafeERC20 for IERC20;
    
    // Rocket Pool contracts
    address public rocketStorageAddress;
    address public rocketDepositPoolAddress;
    address public rocketTokenRETHAddress;
    
    // Deposited amounts per token
    mapping(address => uint256) public depositedAmount;
    
    // Constructor
    constructor(
        address _rocketStorageAddress,
        address _admin
    ) YieldinatorAdapter("Rocket Pool", _admin) {
        require(_rocketStorageAddress != address(0), "RocketPoolAdapter: rocket storage cannot be zero address");
        rocketStorageAddress = _rocketStorageAddress;
        
        // Get contract addresses from RocketStorage
        rocketDepositPoolAddress = getRocketPoolAddress("rocketDepositPool");
        rocketTokenRETHAddress = getRocketPoolAddress("rocketTokenRETH");
    }
}

Key Functions

Contract Address Resolution

Rocket Pool uses a storage contract pattern to manage contract addresses. The adapter includes a helper function to retrieve these addresses:

Deposit

The deposit function handles adding ETH to Rocket Pool and receiving rETH tokens:

Withdraw

The withdraw function handles redeeming rETH for ETH:

Harvest Yield

The harvestYield function collects staking rewards from rETH appreciation:

Emergency Withdraw

The emergencyWithdraw function provides a way to recover funds in case of emergencies:

Usage Examples

Depositing ETH to Rocket Pool

Depositing rETH Directly

Withdrawing as ETH

Withdrawing as rETH

Harvesting Staking Rewards

Security Considerations

Exchange Rate Manipulation

Rocket Pool's rETH exchange rate is determined by the total ETH in the protocol divided by the total rETH supply. While this mechanism is secure, the adapter implements additional checks to ensure exchange rates are reasonable:

  1. Slippage Protection: When withdrawing ETH, the adapter verifies that the amount received is within acceptable bounds.

  2. Oracle Validation: The adapter can be extended to cross-check exchange rates with external oracles for additional security.

Liquidity Risks

The ability to redeem rETH for ETH depends on available liquidity in the protocol:

  1. Deposit Pool Capacity: The adapter monitors deposit pool capacity and can pause deposits when the pool is full.

  2. Withdrawal Queue: Large withdrawals may need to wait for validators to exit, which could take time. The adapter provides clear information about potential delays.

Smart Contract Risks

Rocket Pool's smart contracts have been audited, but integration risks remain:

  1. Contract Upgrades: Rocket Pool uses a storage contract pattern that allows for contract upgrades. The adapter includes functionality to update contract addresses when upgrades occur.

  2. Validator Slashing: If Rocket Pool validators are slashed, it could affect the rETH exchange rate. The adapter includes monitoring for significant exchange rate changes.

Conclusion

The Rocket Pool adapter provides a secure and efficient way to integrate with Ethereum's most decentralized liquid staking protocol. By supporting both ETH and rETH deposits and withdrawals, the adapter offers flexibility while maintaining the security guarantees of the underlying protocol.