From 9a7901477b85cac8fcfc0ed6891bcceb8c1bd62f Mon Sep 17 00:00:00 2001 From: Julie Date: Sun, 5 Feb 2023 13:24:46 +0200 Subject: [PATCH] C4-519: Fix cancelMinipool to be on minipool creation not rewards start time (#215) * added creation time for cancel fix * added this back because recreateMinipool uses it * review comments * missed this --- contracts/contract/MinipoolManager.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/contract/MinipoolManager.sol b/contracts/contract/MinipoolManager.sol index 5f0514e..cb6f641 100644 --- a/contracts/contract/MinipoolManager.sol +++ b/contracts/contract/MinipoolManager.sol @@ -510,6 +510,12 @@ contract MinipoolManager is Base, ReentrancyGuard, IWithdrawer { staking.setRewardsStartTime(mp.owner, mp.initialStartTime); } + if (staking.getRewardsStartTime(mp.owner) == 0) { + // Edge case where calculateAndDistributeRewards has reset their rewards time even though they are still cycling + // So we re-set it here to their initial start time for this minipool + staking.setRewardsStartTime(mp.owner, mp.initialStartTime); + } + ProtocolDAO dao = ProtocolDAO(getContractAddress("ProtocolDAO")); uint256 ratio = staking.getCollateralizationRatio(mp.owner); if (ratio < dao.getMinCollateralizationRatio()) {