Skip to content

Commit 96c276b

Browse files
committed
prevent setting backup withdrawal address to any deposit/backup address currently in use by minipool
1 parent 5084a25 commit 96c276b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

contracts/RocketUser.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,13 @@ contract RocketUser is RocketBase {
272272
function userSetWithdrawalDepositAddress(address _newUserAddressUsedForDeposit, address _miniPoolAddress) public returns(bool) {
273273
// Check backup withdrawal address is valid
274274
require(_newUserAddressUsedForDeposit != 0);
275-
require(_newUserAddressUsedForDeposit != msg.sender);
276275
// Get an instance of that pool contract
277276
rocketPoolMini = RocketPoolMini(_miniPoolAddress);
277+
// Check user exists in minipool
278+
require(rocketPoolMini.getUserExists(msg.sender));
279+
// Check backup withdrawal address is not already in use
280+
require(!rocketPoolMini.getUserExists(_newUserAddressUsedForDeposit));
281+
require(!rocketPoolMini.getUserBackupAddressExists(_newUserAddressUsedForDeposit));
278282
// User can only set this backup address before deployment to casper, also partners cannot set this address to their own to prevent them accessing the users funds after the set withdrawal backup period expires
279283
if ((rocketPoolMini.getStatus() == 0 || rocketPoolMini.getStatus() == 1) && rocketPoolMini.getUserPartner(msg.sender) != _newUserAddressUsedForDeposit) {
280284
if (rocketPoolMini.setUserAddressBackupWithdrawal(msg.sender, _newUserAddressUsedForDeposit)) {

0 commit comments

Comments
 (0)