Skip to content

Commit

Permalink
Added withdrawal address check for msg.sender to _claimAndStake
Browse files Browse the repository at this point in the history
  • Loading branch information
jclapis committed Apr 19, 2024
1 parent 04f0488 commit 494cb39
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,20 @@ contract RocketMerkleDistributorMainnet is RocketBase, RocketRewardsRelayInterfa

address rplWithdrawalAddress;
address withdrawalAddress;
address senderWithdrawalAddress;

// Confirm caller is permitted
{
RocketNodeManagerInterface rocketNodeManager = RocketNodeManagerInterface(getContractAddress("rocketNodeManager"));
rplWithdrawalAddress = rocketNodeManager.getNodeRPLWithdrawalAddress(_nodeAddress);
withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress);
senderWithdrawalAddress = rocketStorage.getNodeWithdrawalAddress(msg.sender);
if (rocketNodeManager.getNodeRPLWithdrawalAddressIsSet(_nodeAddress)) {
// If RPL withdrawal address is set, must be called from it
require(msg.sender == rplWithdrawalAddress, "Can only claim from RPL withdrawal address");
} else {
// Otherwise, must be called from node address or withdrawal address
require(msg.sender == _nodeAddress || msg.sender == withdrawalAddress, "Can only claim from node address");
require(msg.sender == _nodeAddress || msg.sender == withdrawalAddress || senderWithdrawalAddress == _nodeAddress, "Can only claim from node address");
}
}

Expand Down

0 comments on commit 494cb39

Please sign in to comment.