From b5fca1ff7ffd765349f063f0f9f991d0422fa481 Mon Sep 17 00:00:00 2001 From: Noisekit Date: Fri, 14 Jun 2024 19:48:27 +1000 Subject: [PATCH] Avoid division by zero when totalShares is zero --- .../synthetix/contracts/modules/core/RewardsManagerModule.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol b/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol index 97a90f260e..3d5c88e9d1 100644 --- a/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol +++ b/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol @@ -357,6 +357,7 @@ contract RewardsManagerModule is IRewardsManagerModule { // No rewards are currently being distributed if the distributor doesn't exist, they are scheduled to be distributed in the future, or the distribution as already completed if ( address(vault.rewards[rewardId].distributor) == address(0) || + totalShares == 0 || vault.rewards[rewardId].start > curTime.toUint() || vault.rewards[rewardId].start + vault.rewards[rewardId].duration <= curTime.toUint() ) {