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(), "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
+
require(_canNonOwnerDistribute(), "Minipool doesn't meet conditions to allow non-owner distribution");
312
+
prepareNonOwnerDistributeTime =block.timestamp;
313
+
}
314
+
315
+
// Returns true when conditions allow for non-owner distribution
316
+
// Note that this gets checked by both prepareNonOwnerDistribute and distributeBalacnce
317
+
function _canNonOwnerDistribute() overrideexternalview onlyInitialised returns (bool) {
318
+
if (status == MinipoolStatus.Staking && totalBalance >=16 ether) {
0 commit comments