You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Non-owners must now do a 2-step process to distribute
- The balance and status must meet requirements for non-owner distribution during each of the steps
- There is an enforced minimum 14 days between the two steps, so the owner has plenty of time to arb if desired
if (msg.sender!= nodeAddress &&msg.sender!= nodeWithdrawalAddress) {
296
-
// And the pool is in staking status
297
-
if (status == MinipoolStatus.Staking) {
298
-
// Then balance must be greater than 16 ETH
299
-
require(totalBalance >=16 ether, "Balance must be greater than 16 ETH");
300
-
} else {
301
-
// Then enough time must have elapsed
302
-
require(block.timestamp> statusTime.add(14 days), "Non-owner must wait 14 days after withdrawal to distribute balance");
303
-
// And balance must be greater than 4 ETH
304
-
require(address(this).balance >=4 ether, "Balance must be greater than 4 ETH");
305
-
}
299
+
require(_canNonOwnerDistribute(totalBalance), "Minipool doesn't meet conditions to allow non-owner distribution");
300
+
require(prepareNonOwnerDistributeTime !=0, "prepareNonOwnerDistribute must be called before distributeBalance");
301
+
require(block.timestamp> prepareNonOwnerDistributeTime.add(14 days), "prepareNonOwnerDistribute must be called at least 14 days before distributeBalance");
306
302
}
307
303
// Process withdrawal
308
304
_distributeBalance(totalBalance);
309
305
}
310
306
307
+
// Non-owner distribution has two steps
308
+
// First, this function is called
309
+
// Then, after at least 14 days, distributeBalance() can be called
310
+
function prepareNonOwnerDistribute() overrideexternal onlyInitialised {
311
+
// Get withdrawal amount, we must also account for a possible node refund balance on the contract from users staking 32 ETH that have received a 16 ETH refund after the protocol bought out 16 ETH
0 commit comments