Skip to content

Commit

Permalink
Do not bother with rETHBefore
Browse files Browse the repository at this point in the history
Sending rETH to this contract means sending it to whatever lucky NO
calls depositAndMint next.
  • Loading branch information
xrchz committed Nov 14, 2022
1 parent c5b03be commit a744b1c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions contracts/contract/node/RocketNodeDeposit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ contract RocketNodeDeposit is RocketBase, RocketNodeDepositInterface {
}

function _mint(uint256 _mintEthAmount) private {
// Save current rETH balance (for calculating how much rETH is minted)
RocketTokenRETHInterface rocketTokenRETH = RocketTokenRETHInterface(getContractAddress("rocketTokenRETH"));
uint256 rETHBefore = rocketTokenRETH.balanceOf(address(this));
// Deposit ETH to mint rETH
RocketDepositPoolInterface rocketDepositPool = RocketDepositPoolInterface(getContractAddress("rocketDepositPool"));
rocketDepositPool.deposit{value: _mintEthAmount}();
RocketDepositPoolInterface(getContractAddress("rocketDepositPool")).deposit{value: _mintEthAmount}();
// Transfer minted rETH back to the caller
rocketTokenRETH.transfer(msg.sender, rocketTokenRETH.balanceOf(address(this)) - rETHBefore);
RocketTokenRETHInterface rocketTokenRETH = RocketTokenRETHInterface(getContractAddress("rocketTokenRETH"));
rocketTokenRETH.transfer(msg.sender, rocketTokenRETH.balanceOf(address(this)));
}

/// @notice Returns true if the given amount is a valid deposit amount
Expand Down

0 comments on commit a744b1c

Please sign in to comment.