• Stars
    star
    1,009
  • Rank 45,557 (Top 0.9 %)
  • Language
    Python
  • License
    Other
  • Created almost 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vyper contracts used in Curve.fi exchange pools.

curve-contract

Vyper contracts used in Curve exchange pools.

Overview

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.

Testing and Development

Dependencies

Curve contracts are compiled using Vyper, however installation of the required Vyper versions is handled by Brownie.

Setup

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

Organization and Workflow

See the documentation within contracts and it's subdirectories for more detailed information on how to get started developing on Curve.

Running the Tests

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.

Deployment

To deploy a new pool:

  1. Ensure the pooldata.json for the pool you are deploying contains all the necessary fields.

  2. Edit the configuration settings within scripts/deploy.py.

  3. 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.

  4. 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.

Audits and Security

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.

License

(c) Curve.Fi, 2020 - All rights reserved.

More Repositories

1

curve-stablecoin

Stablecoin powered by LLAMMAs
Python
434
star
2

curve-dao-contracts

Vyper contracts to be used by Curve DAO
Python
336
star
3

curve-pool-registry

On-chain registry and unified API for Curve.fi pools.
Python
178
star
4

brownie-tutorial

Brownie Video Tutorial at https://www.youtube.com/playlist?list=PLVOHzVzbg7bFUaOGwN0NOgkTItUAVyBBQ
Python
147
star
5

curve-stablecoin-js

JavaScript library for Curve Stablecoin
TypeScript
102
star
6

curve-api

JavaScript
95
star
7

vyper-tutorial

Curve Vyper Tutorial : How to Build a $CRV-stablecoin
Python
76
star
8

curve-crypto-contract

Guess what
Python
71
star
9

tricrypto-ng

Automatic Market Maker (AMM) for three unpegged assets, written in Vyper.
Vyper
66
star
10

curve-factory

Python
65
star
11

curve-js

TypeScript
60
star
12

multi-rewards

A modified version of the SNX staking rewards contract, allowing for multiple reward tokens. Designed for use with Curve.fi liquidity gauges.
Python
58
star
13

curve-assets

56
star
14

curve-contract-polygon

Curve.fi exchange implementation for Polygon.
Python
47
star
15

curve-docs

Sphinx documentation for curve.readthedocs.io
45
star
16

lending-amm-model

Model of LLAMMA for lending and stablecoin purposes
Python
37
star
17

security-incident-reports

A repository documenting security incident reports at Curve Finance.
30
star
18

curve-factory-crypto

Python
29
star
19

curve-veBoost

Curve veCRV Boost Delegation
Vyper
28
star
20

curve-cross-asset-swaps

Cross asset swaps using Curve and Synthetix
Python
27
star
21

stableswap-ng

Automatic Market Maker (AMM) for 2 or more pegged assets, written in Vyper.
Vyper
24
star
22

curve-dao

Vue
22
star
23

curve-measure-profit

Scripts to record and measure virtual profit on curve.fi, written in Python
Python
21
star
24

curve-aragon-voting

Solidity
21
star
25

metaregistry

One Registry to Rule Them All
Vyper
20
star
26

crv.finance

JavaScript
20
star
27

volume-subgraphs

TypeScript
18
star
28

curve-frontend

TypeScript
18
star
29

curve-subgraph

TypeScript
17
star
30

cryptopool-analytics

Semi-analytical approach to simulations where dense liquidity is a small perturbation to constant-product invariant
Python
16
star
31

curve-zaps

Useful zaps for curve pools
Python
15
star
32

curve-external-integrations

15
star
33

curve-gas-estimates

Gets gas cost estimates for Curve contracts using evm-trace.
Python
13
star
34

curve-xchain-factory

Permission-less gauge factory for cross-chain CRV emissions
Python
11
star
35

cryptopool-simulator

Similator for cryptopools written in C++
C++
11
star
36

unipool-fork

A modified version of the SNX staking rewards contract, for use with Curve.fi liquidity gauges.
Solidity
10
star
37

CRV-distribution-data

JavaScript
8
star
38

curve-stablecoin-dashboard

Dashboard of Curve stablecoin
Python
8
star
39

curve-stablecoin-researches

Researches around Curve Stablecoin
Jupyter Notebook
8
star
40

autobribe

Pipeline to create protocol-aligned CRV voting incentives for crvUSD
Python
8
star
41

crvusd-ape-tutorial

Python
7
star
42

early-user-distribution

Python
7
star
43

curve-xdao

Vyper
7
star
44

crypto_lp_pricing

Python
7
star
45

curve-crypto-calc

Original python-based cryptopool simulator added for history
6
star
46

curve-xgov

Python
6
star
47

vest-split

Split VestingEscrow for multiple users
Python
6
star
48

llamma-simulator

Python
6
star
49

twocrypto-ng

Jupyter Notebook
5
star
50

discord-bot

JavaScript
5
star
51

curve-router-ng

Curve Router. Performs up to 5 swaps in a single transaction, can do estimations with get_dy and get_dx
Vyper
5
star
52

curve-snapshot

Python
5
star
53

curve-burners

Vyper
5
star
54

curve-dao-operations

A set of CLI tools for conducting Curve DAO operations, written in python using the very cool Ape Framework.
Python
4
star
55

curve-stable-peg

Python
4
star
56

curve-base-repo

Repository template for a Curve repository.
3
star
57

boa-tutorial

Jupyter Notebook
3
star
58

curve-metapool

Python
2
star
59

announcements

2
star
60

contract-migrations

Migration contract and tests
Python
2
star
61

curve-api-metadata

2
star
62

curve-router-js

TypeScript
2
star
63

CRV-distribution-BPT

TypeScript
1
star
64

CRV-distribution

TypeScript
1
star
65

deposit-and-stake-zap

Python
1
star
66

curve-letters

A place to publish scientific papers researching Curve and DeFi in general
1
star
67

curve-ren-adapter

Exchange adapter for Curve renBTC and sBTC pool
JavaScript
1
star
68

lp-snapshots

Python
1
star
69

curve-reward-manager

Vyper
1
star
70

curve-external-reward

1
star