@@ -12,6 +12,7 @@ import "../../interface/minipool/RocketMinipoolInterface.sol";
1212import "../../interface/minipool/RocketMinipoolQueueInterface.sol " ;
1313import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol " ;
1414import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol " ;
15+ import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNetworkInterface.sol " ;
1516import "../../interface/token/RocketTokenRETHInterface.sol " ;
1617import "../../types/MinipoolDeposit.sol " ;
1718
@@ -45,7 +46,7 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
4546
4647 // Construct
4748 constructor (RocketStorageInterface _rocketStorageAddress ) RocketBase (_rocketStorageAddress) {
48- version = 1 ;
49+ version = 2 ;
4950 }
5051
5152 // Current deposit pool balance
@@ -77,11 +78,12 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
7778 require (msg .value >= rocketDAOProtocolSettingsDeposit.getMinimumDeposit (), "The deposited amount is less than the minimum deposit size " );
7879 RocketVaultInterface rocketVault = RocketVaultInterface (getContractAddress ("rocketVault " ));
7980 require (rocketVault.balanceOf ("rocketDepositPool " ).add (msg .value ) <= rocketDAOProtocolSettingsDeposit.getMaximumDepositPoolSize (), "The deposit pool size after depositing exceeds the maximum size " );
80- // Record last deposit to time delay ability to withdraw
81- setUint (keccak256 (abi.encodePacked ("user.deposit.block " , msg .sender )), block .number );
81+ // Calculate deposit fee
82+ uint256 depositFee = msg .value .mul (rocketDAOProtocolSettingsDeposit.getDepositFee ()).div (calcBase);
83+ uint256 depositNet = msg .value .sub (depositFee);
8284 // Mint rETH to user account
8385 RocketTokenRETHInterface rocketTokenRETH = RocketTokenRETHInterface (getContractAddress ("rocketTokenRETH " ));
84- rocketTokenRETH.mint (msg . value , msg .sender );
86+ rocketTokenRETH.mint (depositNet , msg .sender );
8587 // Emit deposit received event
8688 emit DepositReceived (msg .sender , msg .value , block .timestamp );
8789 // Process deposit
@@ -121,11 +123,11 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
121123 }
122124
123125 // Process a deposit
124- function processDeposit (RocketVaultInterface rocketVault , RocketDAOProtocolSettingsDepositInterface rocketDAOProtocolSettingsDeposit ) private {
126+ function processDeposit (RocketVaultInterface _rocketVault , RocketDAOProtocolSettingsDepositInterface _rocketDAOProtocolSettingsDeposit ) private {
125127 // Transfer ETH to vault
126- rocketVault .depositEther {value: msg .value }();
128+ _rocketVault .depositEther {value: msg .value }();
127129 // Assign deposits if enabled
128- _assignDeposits (rocketVault, rocketDAOProtocolSettingsDeposit );
130+ _assignDeposits (_rocketVault, _rocketDAOProtocolSettingsDeposit );
129131 }
130132
131133 // Assign deposits to available minipools
@@ -138,19 +140,19 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
138140 }
139141
140142 // Assigns deposits to available minipools, returns false if assignment is currently disabled
141- function _assignDeposits (RocketVaultInterface rocketVault , RocketDAOProtocolSettingsDepositInterface rocketDAOProtocolSettingsDeposit ) private returns (bool ) {
143+ function _assignDeposits (RocketVaultInterface _rocketVault , RocketDAOProtocolSettingsDepositInterface _rocketDAOProtocolSettingsDeposit ) private returns (bool ) {
142144 // Check if assigning deposits is enabled
143- if (! rocketDAOProtocolSettingsDeposit .getAssignDepositsEnabled ()) {
145+ if (! _rocketDAOProtocolSettingsDeposit .getAssignDepositsEnabled ()) {
144146 return false ;
145147 }
146148 // Load contracts
147149 RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface (getContractAddress ("rocketDAOProtocolSettingsMinipool " ));
148150 RocketMinipoolQueueInterface rocketMinipoolQueue = RocketMinipoolQueueInterface (getContractAddress ("rocketMinipoolQueue " ));
149151 // Setup initial variable values
150- uint256 balance = rocketVault .balanceOf ("rocketDepositPool " );
152+ uint256 balance = _rocketVault .balanceOf ("rocketDepositPool " );
151153 uint256 totalEther = 0 ;
152154 // Calculate minipool assignments
153- uint256 maxAssignments = rocketDAOProtocolSettingsDeposit .getMaximumDepositAssignments ();
155+ uint256 maxAssignments = _rocketDAOProtocolSettingsDeposit .getMaximumDepositAssignments ();
154156 MinipoolAssignment[] memory assignments = new MinipoolAssignment [](maxAssignments);
155157 MinipoolDeposit depositType = MinipoolDeposit.None;
156158 uint256 count = 0 ;
@@ -174,7 +176,7 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
174176 }
175177 if (totalEther > 0 ) {
176178 // Withdraw ETH from vault
177- rocketVault .withdrawEther (totalEther);
179+ _rocketVault .withdrawEther (totalEther);
178180 // Perform assignments
179181 for (uint256 i = 0 ; i < maxAssignments; ++ i) {
180182 if (assignments[i].etherAssigned == 0 ) { break ; }
@@ -202,9 +204,4 @@ contract RocketDepositPool is RocketBase, RocketDepositPoolInterface, RocketVaul
202204 // Emit excess withdrawn event
203205 emit ExcessWithdrawn (msg .sender , _amount, block .timestamp );
204206 }
205-
206- // Returns the block that _address last deposited ether on
207- function getUserLastDepositBlock (address _address ) override external view returns (uint256 ) {
208- return getUint (keccak256 (abi.encodePacked ("user.deposit.block " , _address)));
209- }
210207}
0 commit comments