Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions contracts/contract/RocketBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ abstract contract RocketBase {
_;
}



/**
* @dev Throws if called by any sender that isn't a registered node or the their respective withdrawal address
*/
modifier onlyRegisteredNodeOrWithdrawalAddress(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.exists", _nodeAddress))) || _nodeAddress == rocketStorage.getNodeWithdrawalAddress(_nodeAddress), "Invalid minipool owner");
_;
}

/*** Methods **********************************************************/

Expand Down
4 changes: 2 additions & 2 deletions contracts/contract/node/RocketNodeStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ contract RocketNodeStaking is RocketBase, RocketNodeStakingInterface {
}

/// @notice Withdraw staked RPL back to the node account
/// Only accepts calls from registered nodes
/// Only accepts calls from registered nodes or their respective withdrawal addresses
/// Withdraws to withdrawal address if set, otherwise defaults to node address
/// @param _amount The amount of RPL to withdraw
function withdrawRPL(uint256 _amount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyRegisteredNode(msg.sender) {
function withdrawRPL(uint256 _amount) override external onlyLatestContract("rocketNodeStaking", address(this)) onlyRegisteredNodeOrWithdrawalAddress(msg.sender) {
// Load contracts
RocketDAOProtocolSettingsRewardsInterface rocketDAOProtocolSettingsRewards = RocketDAOProtocolSettingsRewardsInterface(getContractAddress("rocketDAOProtocolSettingsRewards"));
RocketVaultInterface rocketVault = RocketVaultInterface(getContractAddress("rocketVault"));
Expand Down