1/5
## Function Deposit in RocketDepositPool Contract We will look at the function `deposit` inside the contract `RocketDepositPool`. This function can be called by the user if they want to mint rETH. We will show you when the function `deposit` is called, and how it checks whether a deposit is enabled or not. Currently, there is a deposit fee. So, if you are writing an integration contract with the Rocket Pool, you might want to be aware that currently there is a deposit fee. Check Deposit Settings First, let's see when a user calls the function `deposit`, how does this contract check whether a deposit is enabled or not. The check is done in the first few lines, so let's take a look. First, it gets a contract address from the Rocket Storage. The contract that it's getting is called `RocketDAOProtocolSettingsDeposit` and the way it gets it is by calling an internal function called `getContractAddress`. This function comes from another inherited contract called RocketBase. The `getContractAddress` function will eventually call a function called `getAddress`. You can see here that it calls the function `getAddress` on the `RocketStorage` contract. This is an example of how contracts in the Rocket Pool protocol call into the RocketStorage contract. It gets the contract address of `RocketDAOProtocolSettingsDeposit`. Once it gets this contract, it calls a function called `getDepositEnabled`. This is how this function is checking whether a deposit is enabled or not, at the protocol level. Calculate Deposit Fee Next, let us show you where the deposit fee is calculated. We can see here that there is a variable called `depositFee`. The way it calculates the deposit fee is by first calling the function `getDepositFee` again on the contract `RocketDAOProtocolSettingsDeposit`. It gets this number, multiplies it by `msg.value`, the amount of ETH that was sent by the user, and then divides it by `calcBase`. So what's going on here is it's calculating a percentage of the amount of ETH that was sent. This is `depositFee`. And then from the amount of ETH that was sent, it will subtract this amount, this is `depositNet`. The amount of rETH to mint is based on this `depositNet`. In the future this might change, but if you are writing an integration with the Rocket Pool protocol, currently there is a deposit fee. Depending on the percentage of what the deposit fee is, the actual amount of ETH to calculate the amount of rETH to mint may be less than the amount of ETH that the user sent.
A comprehensive guide to understanding the deposit function inside the RocketPool protocol - The lesson covers how the function checks if deposits are enabled at the protocol level and how deposit fee is calculated and subtracted from the user's deposit amount.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on March 26, 2025
Stay in the loop with the latest Rocket Pool updates and connect with over 5,000 developers in the community.
Solidity Developer
Rocket Pool rETH IntegrationDuration: 4min
Duration: 48min
Duration: 57min
Duration: 30min
Duration: 7min
Duration: 23min
Duration: 6min
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on March 26, 2025