Skip to content

p00ls/contracts

Repository files navigation

P00ls Contracts

Introduction

This repo contains the smart contract for the p00ls platform.

Some parts of these contracts are still being worked on and might change. See the status section below.

Setup

Environment

The development and test environments are configured through environment variables. It is recommended to configure that using a .env file. The .env.example provides an example of such file, with the different variables listed.

The main variables used are:

  • MODE: use production to enable optimization
  • REVERT_STRINGS: if set to strip, this option removes all the revert reasons
  • XXX_NODE: rpc endpoint for chain XXX (for migration scripts)
  • MNEMONIC: mnemonic of the wallet to use (for migration scripts)
  • PRIVATE_KEY: private key of the wallet to use (for migration scripts)

If both MNEMONIC and PRIVATE_KEY are defined, MNEMONIC will take priority.

  • COVERAGE: enable the coverage plugin (needed to produce coverage reports)
  • REPORT: enable the gas report plugin (will produce gas usage reports when running the tests)
  • DEBUG: add extra debug. Set DEBUG=migration for extra verbosity during deployments.

Contract configuration

The contract deployment script takes its parameters from the scripts/config.js file. This file contains can be used to customize the deployment. If anyone wants to perform a deployment of these contracts, it is strongly encouraged to read the deployment script AND do test deployments.

Compile

To compile the contract smart contracts, run

npm run compile

Run tests

  • Tests are run using the following command
npm run test
  • Gas usage report can be produced by adding REPORT=true to the command line or to the .env configuration file

  • Code coverage report can be produced by adding COVERAGE=true to the command line or to the .env configuration file and running

npm run coverage

Deploy

In other to deploy these contracts, one should fill two different files:

  • the .env file must contain credentials (private key or mnemonic) and an url endpoint for the targeted blockchain.
  • the scripts/config.js file must contain the deploying arguments for the contracts (name, symbol, ...).

See the setup section to learn more about the environment configuration.

Once the settings are configured, you can use the scripts/migrate.js script with the following command:

npx hardhat run scripts/migrate.js --network <blockchain-name>

The migration script will produce a .cache-<chainId>.json file containing the addresses of the deployed contracts.

Note: the deployment workflow is still being worked on.

Architecture

architecture

Status

Contract name Status Audited Deployment Upgradeable
P00lsCreatorRegistry Finalized 1 2 Proxy - Implementation ✔️
P00lsTokenCreator Finalized 1 2 Implementation ✔️
P00lsTokenXCreator Deprecated 1 Implementation ✔️
P00lsTokenXCreatorV2 Finalized 2 Implementation ✔️
AMM Router Finalized 1 2 Instance
AMM Factory Finalized 1 2 Instance
AMM Pair Finalized 1 2 Implementation
AuctionFactory Finalized 1 2 Instance
Auction Finalized 1 2 Implementation
VestedAirdrops Finalized 1 2 Instance
VestingFactory Finalized 2 Instance
Escrow Finalized 1 2 Instance
Locking Work in progress 1 -
DAO Timelock Finalized 1 2 -
DAO Governor Finalized 1 2 - ✔️

Footnotes

  1. Zokyo audit 2 3 4 5 6 7 8 9 10 11 12 13

  2. Byterocket audit 2 3 4 5 6 7 8 9 10 11 12 13