Skip to content

Commit

Permalink
fix: amending functionality to handle no multiplier for voter properly
Browse files Browse the repository at this point in the history
  • Loading branch information
RonTuretzky committed Sep 28, 2024
1 parent 6f95cc5 commit 1c6c8c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/VotingMultipliers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions src/YieldDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1c6c8c0

Please sign in to comment.