From 1c6c8c0f3716558e8ef3e2ff6ef372f758dbb8e8 Mon Sep 17 00:00:00 2001 From: Ron Turetzky Date: Sat, 28 Sep 2024 11:58:51 +0300 Subject: [PATCH] fix: amending functionality to handle no multiplier for voter properly --- src/VotingMultipliers.sol | 2 +- src/YieldDistributor.sol | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VotingMultipliers.sol b/src/VotingMultipliers.sol index f53e3b7..bba1af1 100644 --- a/src/VotingMultipliers.sol +++ b/src/VotingMultipliers.sol @@ -15,7 +15,7 @@ contract VotingMultipliers is OwnableUpgradeable, IVotingMultipliers { /// @param user The address of the user /// @return The total multiplier value for the user function getTotalMultipliers(address user) external view returns (uint256) { - uint256 totalMultiplier = 1e18; // Start with 100% (no multiplier) + uint256 totalMultiplier = 0; for (uint256 i = 0; i < whitelistedMultipliers.length; i++) { IMultiplier multiplier = whitelistedMultipliers[i]; if (block.number <= multiplier.validUntil(user)) { diff --git a/src/YieldDistributor.sol b/src/YieldDistributor.sol index 88eb6ff..49120e5 100644 --- a/src/YieldDistributor.sol +++ b/src/YieldDistributor.sol @@ -111,6 +111,7 @@ contract YieldDistributor is IYieldDistributor, OwnableUpgradeable, VotingMultip function getCurrentVotingPower(address _account) public view returns (uint256) { uint256 lastCycleStart = lastClaimedBlockNumber - cycleLength; uint256 multiplier = this.getTotalMultipliers(_account); + multiplier = multiplier == 0 ? 1e18 : multiplier; uint256 breadVotingPower = this.getVotingPowerForPeriod(BREAD, lastCycleStart, lastClaimedBlockNumber, _account); uint256 butteredBreadVotingPower = this.getVotingPowerForPeriod(BUTTERED_BREAD, lastCycleStart, lastClaimedBlockNumber, _account);