Contract templates used as the basis for future pools.
Each subdirectory holds contracts and other files specific to a single Curve pool template.
- [
a
]: Pool implementation with aToken-style lending (i.e., interest accrues as balance increases) - [
base
]: Minimal pool implementation optimized for no lending - [
eth
]: Pool implementation with ETH - [
meta
]: Metapool implementation for swapping base assets against a Curve LP token - [
y
]: Pool implementation with yearn-style lending (i.e., interest accrues as rate increases)
Contracts in this subdirectory contain special triple-dunder variables which are modified according to the quantity and properties of each stablecoin in a pool.
___USE_LENDING___
: Array of booleans indicating whether each underlying coin in the pool is lent on the associated lending protocol___N_COINS___
: The number of coins within the pool___PRECISION_MUL___
: Array of integers that coin balances are multiplied by in order to adjust their precision to 18 decimal places___RATES___
: Array of integers indicating the relative value of1e18
tokens for each stablecoin
Metapools also make use of the following variables:
___BASE_N_COINS___
: The number of coins within the base pool___BASE_PRECISION_MUL___
: Array of integers that base coin balances are multiplied by to adjust their precision to 18 decimal places___BASE_RATES___
: Array of integers indicating the relative walue of1e18
tokens for each base pool stablecoin
These variables are substituted out at compile-time. To set the values, edit the pooldata.json
file within the template directory.
The layout of a template's pooldata.json
is similar to that of an actual pool, but less fields are required:
{
"wrapped_contract": "yERC20", // mock wrapped coin contract to use, from `contracts/testing`
"base_pool_contract": "" // for metapool templates, use this contract for the base pool
"coins": [ // each list item represents 1 swappable coin within the pool
{
"decimals": 18, // number of decimal places for the underlying coin
"tethered": false, // does the token contract return `None` on a successful transfer/approve?
"wrapped": true, // is wrapping used for this coin?
"wrapped_decimals": 18, // decimal places for the wrapped coin - can be omitted if wrapped == false
},
]
"rate_calculator_address": "" // address of exchange rate calculator for pools with unique logic
}
Note: For y
and a
pools, the implementor may have to remove/change some small parts in the template code which is specific to yearn
and aave
pools.
The rate_calcultor_address
is used when adding a pool to the Curve Pool Registry.