Code Monkey home page Code Monkey logo

rabbithole-quest-protocol's Introduction

Quest Protocol

Tests Lint

Overview

Quests Protocol is a protocol to distribute token rewards for completing on-chain tasks.

img.png


Table of Contents


Documentation

For more information on all docs related to the Quest Protocol, see the documentation directory here.


Layout

Generated with:

tree --filelimit 20 -I artifacts -I contracts-upgradeable -I factories -I typechain-types -I cache -I img.png
├── LICENSE
├── README.md
├── audits
├── contracts
│   ├── Erc1155Quest.sol
│   ├── Erc20Quest.sol
│   ├── Quest.sol
│   ├── QuestFactory.sol
│   ├── RabbitHoleReceipt.sol
│   ├── RabbitHoleTickets.sol
│   ├── ReceiptRenderer.sol
│   ├── SampleERC20.sol
│   ├── SampleErc1155.sol
│   ├── TicketRenderer.sol
│   ├── interfaces
│   │   ├── IQuest.sol
│   │   └── IQuestFactory.sol
│   └── test
│       └── TestERC20.sol
├── coverage
│   ├── base.css
│   ├── contracts
│   │   ├── Erc1155Quest.sol.html
│   │   ├── Erc20Quest.sol.html
│   │   ├── Quest.sol.html
│   │   ├── QuestFactory.sol.html
│   │   ├── RabbitHoleReceipt.sol.html
│   │   ├── RabbitHoleTickets.sol.html
│   │   ├── ReceiptRenderer.sol.html
│   │   ├── SampleERC20.sol.html
│   │   ├── SampleErc1155.sol.html
│   │   ├── TicketRenderer.sol.html
│   │   ├── index.html
│   │   ├── interfaces
│   │   │   ├── IQuest.sol.html
│   │   │   ├── IQuestFactory.sol.html
│   │   │   └── index.html
│   │   └── test
│   │       ├── TestERC20.sol.html
│   │       └── index.html
│   ├── coverage-final.json
│   ├── index.html
│   ├── lcov-report
│   │   ├── base.css
│   │   ├── contracts
│   │   │   ├── Erc1155Quest.sol.html
│   │   │   ├── Erc20Quest.sol.html
│   │   │   ├── Quest.sol.html
│   │   │   ├── QuestFactory.sol.html
│   │   │   ├── RabbitHoleReceipt.sol.html
│   │   │   ├── RabbitHoleTickets.sol.html
│   │   │   ├── ReceiptRenderer.sol.html
│   │   │   ├── SampleERC20.sol.html
│   │   │   ├── SampleErc1155.sol.html
│   │   │   ├── TicketRenderer.sol.html
│   │   │   ├── index.html
│   │   │   ├── interfaces
│   │   │   │   ├── IQuest.sol.html
│   │   │   │   ├── IQuestFactory.sol.html
│   │   │   │   └── index.html
│   │   │   └── test
│   │   │       ├── TestERC20.sol.html
│   │   │       └── index.html
│   │   ├── index.html
│   │   ├── prettify.css
│   │   ├── prettify.js
│   │   ├── sort-arrow-sprite.png
│   │   └── sorter.js
│   ├── lcov.info
│   ├── prettify.css
│   ├── prettify.js
│   ├── sort-arrow-sprite.png
│   └── sorter.js
├── coverage.json
├── docs
│   ├── audit-endpoints.md
│   ├── overview.md
│   ├── quest-claim.md
│   └── quest-create.md
├── hardhat.config.ts
├── node_modules  [492 entries exceeds filelimit, not opening dir]
├── package.json
├── scripts
│   ├── deployQuestFactory.js
│   ├── deployRabbitHoleReceipt.js
│   ├── deployRabbitHoleTickets.js
│   ├── upgradeQuestFactory.js
│   ├── upgradeRabbitHoleReceipt.js
│   └── upgradeRabbitHoleTickets.js
├── test
│   ├── Erc1155Quest.spec.ts
│   ├── Erc20Quest.spec.ts
│   ├── Quest.spec.ts
│   ├── QuestFactory.spec.ts
│   ├── RabbitHoleReceipt.spec.ts
│   ├── RabbitHoleTickets.spec.ts
│   ├── SampleErc1155.spec.ts
│   ├── SampleErc20.spec.ts
│   └── types.ts
├── test-gas-stories
├── tsconfig.json
├── waffle.json
└── yarn.lock

Deployments

Chain Quest Factory Contract
Ethereum 0x0
Goerli 0x37A4a767269B5D1651E544Cd2f56BDfeADC37B05
Polygon Mainnet 0x0
Optimism 0x0
Arbitrum 0x0
Chain RabbitHole Receipt Contract
Ethereum 0x0
Goerli 0xa61826ea8F5C08B0c9DC6925A9DEc80204F32292
Polygon Mainnet 0x0
Optimism 0x0
Arbitrum 0x0
Chain RabbitHole Tickets Contract
Ethereum 0x0
Goerli 0xCa0A3439803e1EA9B787258Eafb85A6C665a9b30
Polygon Mainnet 0x0
Optimism 0x0
Arbitrum 0x0

Contracts

The main contracts involved in this phase are:

  • Quest Factory (code)
    • Creates new Quest instances of an ERC-1155 reward Quest or ERC-20 reward Quest.
  • RabbitHole Receipt (code)
    • An ERC-721 contract that acts as a proof of on-chain activity. Claimed via usage of ECDSA sig/hash
  • ERC-20 Quest (code)
    • A Quest in which the reward is an ERC-20 token
  • ERC-1155 Quest (code)
    • A Quest in which the reward is an ERC-1155 token

Patterns

The contracts use two main patterns.

Factory Pattern

More reading here

image

Dependency Injection

More reading here image

Factory Creation Pattern

More reading here


Install

Install dependencies

yarn

Compile Contracts

yarn compile

Testing

Run all tests:

yarn test

Run test coverage report:

yarn test:coverage

Run gas test:

yarn test:gas-stories

Upgrading

The Quest Factory is an upgradable contract. Over time as the space evolves there will be more than just ERC-20 or ERC-1155 rewards and we want to be non-limiting in our compatibility.

  1. yarn hardhat run --network goerli scripts/upgradeQuestFactory.js or scripts/upgradeRabbitHoleReceipt.js and replace the network with mainnet if you are upgrading on mainnet.
    1. If you get an error like NomicLabsHardhatPluginError: Failed to send contract verification request. It's usually because the contract wasn't deployed by the time verification ran. You can run verification again with yarn hardhat verify --network goerli IMPLENTATION_ADDRESS where the implementation address is in the output of the upgrade script.
  2. go to https://defender.openzeppelin.com/#/admin and approve the upgrade proposal (the link is also in the output of the upgrade script)
  3. After the upgrade proposal is approved, create a PR with the updates to the .openzeppelin/[network-name].json file.

Audits

The following auditors reviewed the protocol. You can see reports in /audits directory:

  • Code4rena TBD (report here)

Bug Bounty

Once all audits are wrapped up, all contracts except tests, interfaces, dependencies are in scope and eligible for the Quest Protocol Bug Bounty program.

The rubric we use to determine bug bounties is as follows:

Level Example Maximum Bug Bounty
6. Severe - Draining or freezing of holdings protocol-wide (e.g. draining token distributor, economic attacks, reentrancy, MEV, logic errors) Let's talk
5. Critical - Contracts with balances can be exploited to steal holdings under specific conditions (e.g. bypass guardrails to transfer precious NFT from parties, user can steal their party's distribution) Up to 25 ETH
4. High - Contracts temporarily unable to transfer holdings
- Users spoof each other
Up to 10 ETH
3. Medium - Contract consumes unbounded gas
- Griefing, denial of service (i.e. attacker spends as much in gas as damage to the contract)
Up to 5 ETH
2. Low - Contract fails to behave as expected, but doesn't lose value Up to 1 ETH
1. None - Best practices

Any vulnerability or bug discovered must be reported only to the following email: [email protected].


License

The primary license for the Quest Protocol is the GNU General Public License 3.0 (GPL-3.0), see LICENSE.

Several interface/dependencies files from other sources maintain their original license (as indicated in their SPDX header). All files in test/ remain unlicensed (as indicated in their SPDX header).

rabbithole-quest-protocol's People

Contributors

gakonst avatar garrettjmu avatar jonathandiep avatar lint-action avatar moodysalem avatar noahzinsmeister avatar proy24 avatar waynehoover avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.