A protocol to distribute token rewards for completing on-chain tasks.
Platform: Code4rena
Start Date: 25/01/2023
End Date: 30/01/2023
Period: 5 days
Status: Completed
Pot Size: $36,500 USDC
Participants: 173
Reporter: liveactionllama
Judge: kirk-baird
Id: 208
League: ETH
V_B | 1/173 | $8,821.89 | 2 | 0 | 0 | 2 | 1 | 0 | 0 | 0 |
adriro | 2/173 | $1,767.69 | 10 | 2 | 0 | 6 | 0 | Grade B | Grade B | 0 |
glcanvas | 3/173 | $1,692.67 | 7 | 1 | 0 | 4 | 0 | Grade B | Grade B | 0 |
hansfriese | 4/173 | $1,360.43 | 4 | 2 | 0 | 2 | 0 | 0 | 0 | 0 |
libratus | 5/173 | $1,295.79 | 5 | 0 | 0 | 4 | 0 | Grade B | 0 | 0 |
0x4non | 6/173 | $1,241.00 | 4 | 0 | 0 | 2 | 0 | Grade B | Grade B | 0 |
simon135 | 7/173 | $1,173.86 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 0 |
zaskoh | 8/173 | $1,034.68 | 5 | 1 | 0 | 3 | 0 | Grade A | 0 | 0 |
ArmedGoose | 9/173 | $915.88 | 4 | 1 | 0 | 2 | 0 | Grade B | 0 | 0 |
ForkEth | 10/173 | $905.78 | 2 | 0 | 0 | 1 | 0 | - | 0 | 0 |
Auditor per page
The C4audit output for the contest can be found here within an hour of contest opening.
Note for C4 wardens: Anything included in the C4udit output is considered a publicly known issue and is ineligible for awards.
Please note that the contest's code is hosted on an external repo. To fetch it, use one of the following methods:
git clone --recurse-submodules git@github.com:code-423n4/2023-01-rabbithole.git
git clone --recurse-submodules https://github.com/code-423n4/2023-01-rabbithole.git
--recurse-submodules
:git submodule update --init --recursive
Quests Protocol is a protocol to distribute token rewards for completing on-chain tasks.
We're releasing five new contracts that are in scope for the audit (more inherited contracts included below):
See higher resolution flow diagrams here
See our full suite of documentation here.
Contract Name | SLOC | Purpose |
---|---|---|
QuestFactory | 162 | This is the main factory where Quests get deployed from. |
RabbitHoleReceipt | 137 | This is the receipt contract. An ERC-721 contract that a user has the ability to mint once they have completed an on-chain action. To claim a reward you must own a Receipt that has not claimed a reward yet. |
Quest | 100 | This is the parent class for Quests. This encapsulates a lot of the shared logic in the Erc20Quest & Erc1155Quest |
RabbitHoleTickets | 82 | This is an 1155 reward contract used by the RabbitHole team. |
Erc20Quest | 67 | This is a Quest where the reward to be claimed is an ERC-20 token. |
Erc1155Quest | 45 | This is a Quest where the reward to be claimed is an ERC-1155 token. |
ReceiptRenderer | 90 | This is an on-chain renderer for our ERC-721 Receipt contract |
TicketRenderer | 34 | This is an on-chain renderer for our ERC-1155 reward (RabbitHoleTickets) contract |
IQuest | 19 | This is a Quest interface |
IQuestFactory | 16 | This is a Quest Factory interface |
We would like to call out extra attention to QuestFactory.mintReceipt
(users should only be able to claim one receipt), Quest.claim
- users should only be able to claim the amount of rewards for number of receipts they have. Note - users could claim a receipt, sell it on secondary (not claim reward) and a user could end up with multiple receipts that can claim multiple rewards. Also following funds flow lifecycle throughout the contracts.
- If you have a public code repo, please share it here: https://github.com/rabbitholegg/quest-protocol - How many contracts are in scope?: 10 - Total SLoC for these contracts?: 752 - How many external imports are there?: 18 - How many separate interfaces and struct definitions are there for the contracts within scope?: 11 - Does most of your code generally use composition or inheritance?: Yes. Only inheritance is abstraction of Quest Types into a parent Quest - How many external calls?: 1 - What is the overall line coverage percentage provided by your tests?: 89 - Is there a need to understand a separate part of the codebase / get context in order to audit this part of the protocol?: Yes - Please describe required context: There is an ECDSA signature that provides proof of action on chain from our own event indexer - Does it use an oracle?: Yes (sorta), described in previous question. - Does the token conform to the ERC20 standard?: No - Are there any novel or unique curve logic or mathematical models?: N/A - Does it use a timelock function?: No - Is it an NFT?: There are two NFT contracts as part of this. RabbitHoleReceipt is an ERC-721 contract that distributes receipts for on-chain usage. RabbitHoleTickets is an ERC-1155 that is a reward for an ERC-1155 Quest. - Does it have an AMM?: No - Is it a fork of a popular project?: No - Does it use rollups?: No - Is it multi-chain?: Yes (but currently just deployed to Goerli) - Does it use a side-chain?: Yes (same note as above, will go on Polygon)
cd quest-protocol yarn yarn compile
yarn test
yarn test:coverage
yarn test:gas-stories
Slither works from the root directory. We also have a GitHub action you can find on our repo linked through in the docs.
slither .