Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 62 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
# Curve Core

A minimal version of all curve infrastructure for AMM in one place.
A minimal version of all Curve infrastructure for AMM in one place.

## Structure

### AMM

- Stableswap - pools for 2 tokens with similar value (1~1)
- Twocrypto - pools for 2 different tokens
- Tricrypto - pools for USD-pegged coins combined with any coins
- **Stableswap** — pools for 2 tokens with similar value (≈1:1)
- **Twocrypto** — pools for 2 different tokens
- **Tricrypto** — pools for USD-pegged coins combined with any coins

### Helpers

- Deposit and Stake Zap - for depositing and staking LPs in one tx
- Meta Zap - for easy exchange between LP and underlying tokens
- Router - router contract for executing complicated trades using different places
- **Deposit and Stake Zap** — deposit and stake LPs in one tx
- **Meta Zap** — easy exchange between LP and underlying tokens
- **Router** — execute complex trades across different venues

### Governance

- Agent and relayer for governance from mainnet DAO
- Vault for fee receiving from pools
- **Agent** and **Relayer** for governance from mainnet DAO
- **Vault** for receiving fees from pools

### Gauge

- Reward-only gauge for incentives
- **Reward-only gauge** for incentives

### Registries

- Metaregistry for AMMs
- Address provider that has all address of factories/DAO/tokens:
- 2: "Exchange Router"
- 4: "Fee Distributor"
- 7: "Metaregistry"
- 11: "TricryptoNG Factory"
- 12: "StableswapNG Factory"
- 13: "TwocryptoNG Factory"
- 18: "Spot Rate Provider"
- 19: "CRV Token"
- 20: "Gauge Factory"
- 21: "Ownership Admin"
- 22: "Parameter Admin"
- 23: "Emergency Admin"
- 24: "CurveDAO Vault"
- 25: "crvUSD Token"
- 26: "Deposit and Stake Zap"
- 27: "Stableswap Meta Zap"
- **Metaregistry** for AMMs
- **Address provider** that contains all addresses of factories/DAO/tokens:
- 2: Exchange Router
- 4: Fee Distributor
- 7: Metaregistry
- 11: TricryptoNG Factory
- 12: StableswapNG Factory
- 13: TwocryptoNG Factory
- 18: Spot Rate Provider
- 19: CRV Token
- 20: Gauge Factory
- 21: Ownership Admin
- 22: Parameter Admin
- 23: Emergency Admin
- 24: CurveDAO Vault
- 25: crvUSD Token
- 26: Deposit and Stake Zap
- 27: Stableswap Meta Zap

## Deployment

### Set up environment

#### Env file

Put settings file ("_env_") into [settings](/settings) directory.
[Example](/settings/env.example). It contains RPC url for target chain.
Put a settings file (`env`) into the [settings](/settings) directory.
[Example](/settings/env.example). It contains the RPC URL for the target chain.

#### Set up Python environment

Project requires Python 3.11+
Project requires **Python 3.11+**.

Install dependencies using poetry
Install dependencies using Poetry:

```
```bash
pip install poetry==1.8.3
poetry install
```

#### Chain params file

Put settings file {chain_name}.yaml into [settings/chains](/settings/chains) directory.
Put a settings file `{chain_name}.yaml` into the [settings/chains](/settings/chains) directory.
[Example](/settings/chains/example.yaml). It will be used for deployment.

- **network_name** - chain name
- **chain_id** - chain id
- **rollup_type** - can be _op_stack_, _arb_orbit_, _polygon_cdk_, _zksync_ or "\_". Zksync rollups currently aren't
fully supported
- **native_wrapped_token** - address of native wrapped token (can be non-eth token)
- **dao** - params of contracts already present on chain (script will deploy x-gov contracts, CRV and crvUSD should
be bridged using native bridges)
- **network_name** chain name
- **chain_id** chain ID
- **rollup_type** — one of `_op_stack_`, `_arb_orbit_`, `_polygon_cdk_`, `_zksync_`, or `_`
ZKSync rollups are currently not fully supported
- **native_wrapped_token** address of the wrapped native token (can be a non-ETH token)
- **dao** — parameters of contracts already present on chain
(the script will deploy x-gov contracts; **CRV** and **crvUSD** should be bridged using native bridges)

Integration parameters
Integration parameters:

- **layer** - chain layer (general info)
- **native_currency_symbol** - symbol of native token
- **public_rpc_url** - rpc used in UI (only public)
- **layer** chain layer (general info)
- **native_currency_symbol** symbol of the native token
- **public_rpc_url** — RPC used in UI (must be public)

#### Deployment

Make sure you have funds at your account for gas at target chain.
Make sure you have sufficient funds for gas on the target chain.

- Export private key to env (don't store it in file!)
- Export your private key to the environment (dont store it in a file):

```
export DEPLOYER_EOA_PRIVATE_KEY={your key}
```bash
export DEPLOYER_EOA_PRIVATE_KEY=<your_private_key>
```

- Run deployment (replace chain_name with name of target chain you want to deploy - make sure you added chain config for
this chain in previous step!)
- Run deployment (replace `devnet/chain_config_filename.yaml` with your chain config path; ensure you added the chain config in the previous step):

```
```bash
python manage.py deploy all devnet/chain_config_filename.yaml
```

#### Deployment results

Upon success, script will generate deployment file with address and other info in [deployments](/deployments) directory.
File will have the same name as chain. ABI is stored in [abi](/abi) folder.
Deployments are reusable, so if something fails, it can be fixed and rerun.
**NOTE:** contracts should be verified separately on explorers like etherscan since it doesn't support Vyper contract
verification by API.

Upon success, the script will generate a deployment file with addresses and other info in the [deployments](/deployments) directory.
The file will have the same name as the chain. ABIs are stored in the [abi](/abi) folder.
Deployments are reusable; if something fails, it can be fixed and rerun.
**Note:** Contracts should be verified separately on explorers like Etherscan, since API verification for Vyper contracts is not supported.

### Deploy test pools
When infra is deployed, run
```

When the infrastructure is deployed, run:

```bash
python manage.py deploy test_pools {chain_name}
```
to deploy test tokens and pools + add liquidity and permorm a swap in test pool. WARNING!: these are test tokens, don't
use mocks in production.

This deploys test tokens and pools, adds liquidity, and performs a swap in a test pool.
**Warning:** These are test tokens; do not use mocks in production.