-
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
Users may not claim Erc1155 rewards when the Quest has ended #528
Comments
kirk-baird marked the issue as duplicate of #42 |
kirk-baird changed the severity to QA (Quality Assurance) |
This previously downgraded issue has been upgraded by kirk-baird |
kirk-baird marked the issue as selected for report |
waynehoover marked the issue as disagree with severity |
While I agree that this is an issue, but not a high risk issue. I expect a high risk issues to be issues that can be called by anyone, not owners. As owners there are plenty of ways we can sabotage our contracts (for example via the set* functions) it is an issue for an owner. The owner understands how this function works, so they can be sure not to call it before all users have called claim. |
Similarly to #122 this is an |
kirk-baird changed the severity to 2 (Med Risk) |
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L60
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L114
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L41-L43
Vulnerability details
Impact
Unlike Erc20Quest.sol, owner of Erc1155Quest.sol is going to withdraw the remaining tokens from the contract when
block.timestamp == endTime
without deducting theunclaimedTokens
. As a result, users will be denied of service when attempting to call the inheritedclaim()
from Quest.sol.Proof of Concept
As can be seen from the code block below, when the Quest time has ended,
withdrawRemainingTokens()
is going to withdraw the remaining tokens from the contract on line 60:File: Erc1155Quest.sol#L52-L63
When a user tries to call
claim()
below, line 114 is going to internally invoke_transferRewards()
:File: Quest.sol#L94-L118
safeTransferFrom()
is going to revert on line 42 because the token balance of the contract is now zero. i.e. less thanamount_
:File: Erc1155Quest.sol#L39-L43
Tools Used
Manual inspection
Recommended Mitigation Steps
Consider refactoring
withdrawRemainingTokens()
as follows:(Note: The contract will have to separately import {QuestFactory} from './QuestFactory.sol' and initialize
questFactoryContract
.The text was updated successfully, but these errors were encountered: