-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fee-on-transfer ERC20 reward tokens will cause accounting error and cause some users to not get paid #358
Comments
kirk-baird changed the severity to QA (Quality Assurance) |
We have a token reward allowlist and we probably won't want to include tokens that have a transfer fee |
jonathandiep marked the issue as sponsor acknowledged |
This previously downgraded issue has been upgraded by kirk-baird |
kirk-baird marked the issue as duplicate of #630 |
kirk-baird marked the issue as satisfactory |
kirk-baird changed the severity to QA (Quality Assurance) |
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L45-L54
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc20Quest.sol#L81-L87
Vulnerability details
Impact
Fee-on-transfer token will affect accounting. Some users may not trade their receipt for rewards due to underflow
Proof of Concept
When the quest creator deploys the contract, he has to fund the contract with maxTotalRewards() and maxProtocolRewards().
For example, the quest deployer deposits 10_000 USDC worth of FOT tokens, with the transfer tax being 5%. The quest fee is 20%, so 8_000 USDC worth of FOT tokens should be distributed to successful participants and 2_000 USDC worth of FOT tokens should be paid to the deployer. Lets say there are 100 participants and each participant gets 80 USDC worth of FOT tokens for completing the quest.
When quest deployer deposits 10_000 USDC worth of FOT tokens, the contract now has 9_500 USDC worth of FOT tokens because of transfer fee. Of the 9_500 USDC worth, 7_600 USDC is for the users and 1_900 USDC is for the protocol fee. If every participant manages to finish the quest and get a receipt, the payout should be 8_000 USDC worth but there is only 7_600 USDC to be distributed. Some users will not get paid. Either that or the protocol will get less fees than expected.
Tools Used
Manual Review
Recommended Mitigation Steps
Either ban all known fee-on-transfer tokens or make sure to check token value before and after transfer.
The text was updated successfully, but these errors were encountered: