Vyper contracts used in Curve exchange pools.
Curve is an exchange liquidity pool on Ethereum designed for extremely efficient stablecoin trading and low risk, supplemental fee income for liquidity providers, without an opportunity cost.
Curve allows users to trade between correlated cryptocurrencies with a bespoke low slippage, low fee algorithm. The liquidity pool is also supplied to lending protocol where it generates additional income for liquidity providers.
- python3 from version 3.6 to 3.8, python3-dev
- brownie - tested with version 1.12.0
- ganache-cli - tested with version 6.11.0
Curve contracts are compiled using Vyper, however installation of the required Vyper versions is handled by Brownie.
To get started, first create and initialize a Python virtual environment. Next, clone the repo and install the developer dependencies:
git clone https://github.com/curvefi/curve-contract.git
cd curve-contract
pip install -r requirements.txt
- New Curve pools are built from the contract templates at
contracts/pool-templates
- Once deployed, the contracts for a pool are added to
contracts/pools
See the documentation within contracts
and it's subdirectories for more detailed information on how to get started developing on Curve.
The test suite contains common tests for all Curve pools, as well as unique per-pool tests. To run the entire suite:
brownie test
To run tests on a specific pool:
brownie test tests/ --pool <POOL NAME>
Valid pool names are the names of the subdirectories within contracts/pools
. For templates, prepend template-
to the subdirectory names within contracts/pool-templates
. For example, the base template is template-base
.
You can optionally include the --coverage
flag to view a coverage report upon completion of the tests.
To deploy a new pool:
-
Ensure the
pooldata.json
for the pool you are deploying contains all the necessary fields. -
Edit the configuration settings within
scripts/deploy.py
. -
Test the deployment locally against a forked mainnet.
brownie run deploy --network mainnet-fork -I
When the script completes it will open a console. You should call the various getter methods on the deployed contracts to ensure the pool has been configured correctly.
-
Deploy the pool to the mainnet.
brownie run deploy --network mainnet
Be sure to open a pull request that adds the deployment addresses to the pool
README.md
.
Curve smart contracts have been audited by Trail of Bits. These audit reports are made available on the Curve website.
There is also an active bug bounty for issues which can lead to substantial loss of money, critical bugs such as a broken live-ness condition, or irreversible loss of funds.
(c) Curve.Fi, 2020 - All rights reserved.