RabbitHole Quest Protocol contest - timongty's results

A protocol to distribute token rewards for completing on-chain tasks.

General Information

Platform: Code4rena

Start Date: 25/01/2023

Pot Size: $36,500 USDC

Total HM: 11

Participants: 173

Period: 5 days

Judge: kirk-baird

Total Solo HM: 1

Id: 208

League: ETH

RabbitHole

Findings Distribution

Researcher Performance

Rank: 144/173

Findings: 2

Award: $7.80

🌟 Selected for report: 0

🚀 Solo Findings: 0

Judge has assessed an item in Issue #664 as 3 risk. The relevant finding follows:

[L-1] ERC20 Quest: withdrawFee() function should only be able to be called once instead of multiple times

Issue: The withdrawFee() function can be called multiple times by admin after a quest ends, resulting in more than the protocolFee being paid. This will help to prevent potential abuse or accidental calling the function more than once.

Suggested Fix: include a boolean check e.g. feeWithdrawn = True so that the withdrawFee() function can only be called once

/// In Quest.sol /// @notice add bool bool public feeWithdrawn;

/// @notice Starts the Quest /// @dev Only the owner of the Quest can call this function function start() public virtual onlyOwner { isPaused = false; hasStarted = true; feeWithdrawn = false; }

/// In Erc20Quest.sol /// @notice Sends the protocol fee to the protocolFeeRecipient /// @dev Only callable when the quest is ended function withdrawFee() public onlyAdminWithdrawAfterEnd {
if (feeWithdrawn) revert FeeAlreadyWithdrawn(); IERC20(rewardToken).safeTransfer(protocolFeeRecipient, protocolFee()); feeWithdrawn = true; }

#0 - c4-judge

2023-02-06T23:28:20Z

kirk-baird marked the issue as duplicate of #23

#1 - c4-judge

2023-02-14T08:54:05Z

kirk-baird marked the issue as satisfactory

Awards

7.046 USDC - $7.05

Labels

2 (Med Risk)
downgraded by judge
satisfactory
withdrawn by judge
duplicate-528

External Links

Judge has assessed an item in Issue #664 as 3 risk. The relevant finding follows:

[L-2] ERC1155 Quest: withdrawRemainingTokens should factor in total number of receipts minted before withdrawal

Issue: There may be users with unredeemed receipts who will not be able to claim if all the remaining tokens are withdrawn to the owner after a quest has ended. Ideally, the process should be the same as ERC20 where this is taken into account.

Suggested Fix: Include the Quest Factory contract in the ERC1155 contract as well (e.g. through the constructor similar to receiptContractAddress_)

In withdrawRemainingTokens() function:

uint unclaimedTokens = (receiptRedeemers() - redeemedTokens); uint256 nonClaimableTokens = IERC1155(rewardToken).balanceOf(address(this)) - unclaimedTokens; IERC1155(rewardToken).safeTransferFrom(address(this), to_, nonClaimableTokens, nonClaimableTokens, '0x00'); /// @notice Call the QuestFactory contract to get the amount of receipts that have been minted /// @return The amount of receipts that have been minted for the given quest function receiptRedeemers() public view returns (uint256) { return questFactoryContract.getNumberMinted(questId); }

Link to Github Reference: https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Erc1155Quest.sol#L52-L63

#0 - c4-judge

2023-02-06T23:29:02Z

kirk-baird marked the issue as duplicate of #42

#1 - c4-judge

2023-02-10T05:03:11Z

This auto-generated issue was withdrawn by kirk-baird

#2 - c4-judge

2023-02-10T05:12:14Z

This previously downgraded issue has been upgraded by kirk-baird

#3 - c4-judge

2023-02-14T09:24:22Z

kirk-baird marked the issue as satisfactory

#4 - c4-judge

2023-02-23T23:49:21Z

kirk-baird changed the severity to 2 (Med Risk)

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter