Submitted by RaymondFam, also found by timongty, CodingNameKiki, MiniGlome, holme, Aymen0909, AlexCzm, CodingNameKiki, adriro, StErMi, Josiah, minhquanym, ubermensch, peanuts, BClabs, wait, cccz, cccz, rbserver, bin2chen, KIntern_NA, gzeon, peakbolt, 0xMirce, chaduke, ElKu, libratus, omis, zaskoh, AkshaySrivastav, hihen, usmannk, HollaDieWaldfee, csanuragjain, and rvierdiiev
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
Unlike Erc20Quest.sol, owner of Erc1155Quest.sol is going to withdraw the remaining tokens from the contract when block.timestamp == endTime without deducting the unclaimedTokens. As a result, users will be denied of service when attempting to call the inherited claim() from Quest.sol.
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 than amount_:
File: Erc1155Quest.sol#L39-L43
Consider refactoring withdrawRemainingTokens() as follows:
(Note: The contract will have to separately import {QuestFactory} from ./QuestFactory.sol and initialize questFactoryContract.
kirk-baird (judge) increased severity to High
waynehoover (RabbitHole) disagreed with severity and commented:
kirk-baird (judge) decreased severity to Medium and commented:
