Tracer contest details
- $28,500 USDC (+ $19,000 in tokens) main award pot
- $1,500 USDC (+ $1,000 in tokens) gas optimization award pot
- Join C4 Discord to register
- Submit findings using the C4 form
- Read our guidelines for more details
- Starts October 7, 2021 00:00 UTC
- Ends October 13, 2021 23:59 UTC
Tracer Perpetual Pools
Project base generated with the Typescript Solidity Dev Starter Kit. See Blog Post for more details
C4 Audit Known Issues
shadowPools[_commitType] is passed in as a parameter to this function, but that's already been incremented yet the tokens haven't yet been burnt.
These are the current contracts that are being used on Arbitrum One.
Calculating ABDKMathQuad values
PoolSwapLibrary contains several methods for generating, converting, and using the raw ratio values. These can be used in the frontend to estimate the result of a transaction. It is vital when estimating the result of a transaction that the shadow pool amount for the commit type's opposite is included in the token total supply.
The environment variables used in this project are documented in the
example.env file at the root of the project. To configure, create a copy of
example.env, rename to
.env, and replace the placeholders with the correct values.
Using this Project
Install the dependencies with
Build everything with
Run the tests with
Build Contracts and Generate Typechain Typeings
You'll need to run this before running tests if typescript throws an error about not finding the typechain artifacts.
Run Slither for static analysis report
If you have
slither installed and on your PATH, you can run
npm run slither to get a report on the current codebase.
Deploy to Ethereum
Create/modify network config in
hardhat.config.ts and add API key and private key, then run:
npx hardhat run --network rinkeby scripts/deploy.ts
Note: As of this commit, deploys are out of sync with the current contract set-up and therefore will not work.
Verify on Etherscan
Using the hardhat-etherscan plugin, add Etherscan API key to
hardhat.config.ts, then run:
npx hardhat verify --network rinkeby <DEPLOYED ADDRESS>
PRs and feedback welcome!
Frequently Asked Questions
How are pool keepers to be chosen? How many keepers are there?
The Pool Keeper is simply a contract that enforces the correct keeper behaviour. Anyone may be a keeper by calling the keeper function on that contract with a pool that is valid for upkeep. We will initially be adding wrappers for Chainlink keepers as well as having custom keepers.
The leveraged pool fee is represented as a
bytes16 value. Why is this chosen over something like
uint? What denomination does this represent?
The leveraged pool fee is a
bytes16 value simply due to the maths library used. We often represent values in WAD values (popularised by the Maker DAO team). WAD values are the integer value multiplied by 10^18 (e.g.
1 = 1*10^18). The maths library we currently use represents values in IEEE quad precision numbers and uses bytes as way of storing this. A good primer on the above can be found here and WAD / RAY maths is introduced here.
How many different type of tests are there? There are unit tests in the test suite. Are there also end to end tests?
Most tests are unit tests. There is a single E2E test in
e2e.spec.ts right now. We plan to add more.
deployments/kovan folder for? They seem to be different from the ABIs I get from
artifacts folder when I compile.
We use a plugin for hardhat called hardhat deploy that helps with deployment. They recommend you commit the
deployments folder to have consistent data across deploys. The deploys you find there will be deploys that have been run from old versions of the contract, hence the ABI difference.