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
{{ message }}
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Changes to voteFactor can lead to unclaimable tokens
Summary
Upon initialization of a user's DistributionRecord, they are minted voting power based on the current voteFactor value. Upon claiming tokens, their voting power is burned based on the current votefactor. Therefore, if the voteFactor were to increase between these actions by calling setVoteFactor(), users would not be able to claim their full amount of tokens.
Vulnerability Detail
Users receive voting power when their DistributionRecord is initialized:
function _initializeDistributionRecord(
addressbeneficiary,
uint256totalAmount
) internalvirtualoverride {
super._initializeDistributionRecord(beneficiary, totalAmount);
// add voting power through ERC20Votes extension_mint(beneficiary, tokensToVotes(totalAmount));
}
This mints voting power as a function of the current voteFactor value:
When the user claims their tokens, their voting power is burned based on the same tokensToVotes calculation. Therefore, any increase in vote factor will lead to unclaimable funds.
function _executeClaim(
addressbeneficiary,
uint256totalAmount
) internalvirtualoverridereturns (uint256_claimed) {
_claimed =super._executeClaim(beneficiary, totalAmount);
// reduce voting power through ERC20Votes extension_burn(beneficiary, tokensToVotes(_claimed));
}
The lengthy and expensive mitigation would involve keeping a record of holders and mint/burn them a proportional amount of voting power in case the voteFactor changes.
Final note
Oppositely, if the voteFactor were to decrease, the token claim would succeed but user's would retain voting power after claiming their entire distribution. All this to say, any change to the voteFactor leads to undesirable circumstances without accounting for the change in the existing voting power balances.
sherlock-admin2
changed the title
Atomic Marmalade Finch - Changes to voteFactor can lead to unclaimable tokens
0xDjango - Changes to voteFactor can lead to unclaimable tokens
Aug 6, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
0xDjango
high
Changes to
voteFactor
can lead to unclaimable tokensSummary
Upon initialization of a user's DistributionRecord, they are minted voting power based on the current
voteFactor
value. Upon claiming tokens, their voting power is burned based on the currentvotefactor
. Therefore, if thevoteFactor
were to increase between these actions by callingsetVoteFactor()
, users would not be able to claim their full amount of tokens.Vulnerability Detail
Users receive voting power when their DistributionRecord is initialized:
This mints voting power as a function of the current
voteFactor
value:When the user claims their tokens, their voting power is burned based on the same
tokensToVotes
calculation. Therefore, any increase in vote factor will lead to unclaimable funds.Impact
Code Snippet
https://github.com/sherlock-audit/2023-06-tokensoft/blob/main/contracts/contracts/claim/abstract/AdvancedDistributor.sol#L73-L95
Tool used
Manual Review
Recommendation
The lengthy and expensive mitigation would involve keeping a record of holders and mint/burn them a proportional amount of voting power in case the
voteFactor
changes.Final note
Oppositely, if the
voteFactor
were to decrease, the token claim would succeed but user's would retain voting power after claiming their entire distribution. All this to say, any change to thevoteFactor
leads to undesirable circumstances without accounting for the change in the existing voting power balances.Duplicate of #55
The text was updated successfully, but these errors were encountered: