What you can do
| swap via router | Swap any tokens through up to 5 Curve pools. | Compute _route and _swap_params off-chain (Curve JS @curvefi/api router or curve-router-js), or for one hop: pool = MetaRegistry.find_pools_for_coins(tokenIn, tokenOut)[0]; (i, j, _) = MetaRegistry.get_coin_indices(pool, tokenIn, tokenOut); route = [tokenIn, pool, tokenOut, 0x0...]; params[0] = [i, j, 1, pool_type, n_coins]. Quote router.get_dy(route, params, amount); approve tokenIn to the router (Ethereum v1.2 0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e); router.exchange(route, params, amount, minOut). |
| swap directly in a pool | Single-pool swap without the router. | Find indices with pool.coins(n) or MetaRegistry.get_coin_indices; approve coin i to the pool; pool.exchange(i, j, dx, min_dy). Stableswap pools use int128 indices, Twocrypto/Tricrypto-NG use uint256. |
| add liquidity | Deposit coins into a pool for LP. | Approve each coin to the pool; quote calc_token_amount(amounts, true); add_liquidity(amounts, minLP). Amount array length = n_coins (NG stableswap takes a dynamic array). Remove with remove_liquidity_one_coin(lp, i, min) after calc_withdraw_one_coin. |
| stake LP for CRV | Earn CRV emissions on Ethereum. | gauge = MetaRegistry.get_gauge(pool); approve LP to gauge; gauge.deposit(amount). Claim CRV with Minter.mint(gauge); extra rewards with gauge.claim_rewards() on newer gauges. |
| lock CRV (veCRV) | Get voting power, boost and revenue. | CRV.approve(veCRV, amt); veCRV.create_lock(amt, unlockTime up to now+4y). Vote with GaugeController.vote_for_gauge_weights(gauge, bps). Claim weekly crvUSD revenue with FeeDistributor.claim(). Withdraw only after expiry: veCRV.withdraw(). |
| save in scrvUSD | Earn the crvUSD savings rate. | crvUSD.approve(scrvUSD, amt); scrvUSD.deposit(amt, receiver); exit with redeem(shares, receiver, owner). |
July 30, 2023: a Vyper compiler bug (versions 0.2.15, 0.2.16, 0.3.0 had broken @nonreentrant locks) let attackers re-enter and drain several Curve pools compiled with those versions (tens of millions of USD lost; partly recovered). Current pool implementations use fixed compiler versions, but old pools and other Vyper contracts may still carry legacy code risk.
Depeg risk: in stable pools an LP ends up holding mostly the depegged asset if one coin loses its peg; losses can be permanent.
Permissionless factories: anyone can deploy pools with any token (including malicious or fee-on-transfer tokens). Only use pools whose coins you have verified; MetaRegistry/API listing is not an endorsement.
Volatile (Twocrypto/Tricrypto) pools have impermanent loss and re-pegging dynamics; quotes for multi-hop routes can move between quote and execution: always set _expected/min_dy.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).CurveRouterNG v1.2.0router on ethereum0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
CurveRouterNG v1.1 (AddressProvider ID 2)router on ethereum0x16C6521Dff6baB339122a0FE25a9116693265353
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same interface as v1.2 (route/swap_params encoding identical). Still registered as 'Exchange Router' (ID 2) in the Ethereum AddressProvider; the docs list it as router-v1 and 0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e (v1.2) as router-v2. Approve _route[0] to whichever router you call.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote output for a route.
read get_dx(address[11],uint256[5][5],uint256,address[5],address[5],address[5])
Required input for a desired output (_out_amount, _pools, _base_pools, _base_tokens).
AddressProvider (NG)other on ethereum0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on ethereum0xF98B45FA17DE75FB1aD0e7aFD971b0ca00e379fC
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
Stableswap-NG Factoryfactory on ethereum0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf
read find_pool_for_coins(address,address,uint256)
i-th pool deployed by this factory that holds both coins.
read pool_count()
Number of pools deployed by this factory; enumerate with pool_list(uint256).
read pool_list(uint256)
Pool address by index.
read get_coins(address)
Coins of a pool deployed by this factory.
read get_coin_indices(address,address,address)
(pool, from, to) -> coin indices (int128 i, int128 j, is_underlying).
read get_gauge(address)
Gauge of a pool (zero if none).
write deploy_gauge(address)
Permissionless: deploy a liquidity gauge for a pool of this factory (it still needs a DAO vote to receive CRV emissions).
write deploy_plain_pool(string,string,address[],uint256,uint256,uint256,uint256,uint256,uint8[],bytes4[],address[])
Permissionless pool creation (name, symbol, coins, A, fee, offpeg_fee_multiplier, ma_exp_time, implementation_idx, asset_types, method_ids, oracles). Pools from this factory are the LP token themselves and expose exchange(int128,int128,uint256,uint256[,address receiver]) -> uint256, exchange_received(int128,int128,uint256,uint256,address), get_dy(int128,int128,uint256), get_dx(int128,int128,uint256), add_liquidity(uint256[],uint256[,address]) (dynamic array), calc_token_amount(uint256[],bool), remove_liquidity_one_coin(uint256,int128,uint256[,address]) and calc_withdraw_one_coin(uint256,int128).
Twocrypto-NG Factoryfactory on ethereum0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F
read find_pool_for_coins(address,address,uint256)
i-th pool deployed by this factory that holds both coins.
read pool_count()
Number of pools deployed by this factory; enumerate with pool_list(uint256).
read pool_list(uint256)
Pool address by index.
read get_coins(address)
Coins of a pool deployed by this factory.
read get_coin_indices(address,address,address)
(pool, from, to) -> coin indices (uint256 i, uint256 j).
read get_gauge(address)
Gauge of a pool (zero if none).
write deploy_gauge(address)
Permissionless: deploy a liquidity gauge for a pool of this factory (it still needs a DAO vote to receive CRV emissions).
write deploy_pool(string,string,address[2],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)
Permissionless two-coin volatile pool creation. Twocrypto-NG pools are their own LP token and expose exchange(uint256,uint256,uint256,uint256[,address]) -> uint256 (uint256 indices), exchange_received, get_dy(uint256,uint256,uint256), get_dx, add_liquidity(uint256[2],uint256[,address]), calc_token_amount(uint256[2],bool), remove_liquidity_one_coin(uint256,uint256,uint256[,address]), calc_withdraw_one_coin(uint256,uint256). The same factory also deploys FXSwap pools.
Tricrypto-NG Factoryfactory on ethereum0x0c0e5f2fF0ff18a3be9b835635039256dC4B4963
read find_pool_for_coins(address,address,uint256)
i-th pool deployed by this factory that holds both coins.
read pool_count()
Number of pools deployed by this factory; enumerate with pool_list(uint256).
read pool_list(uint256)
Pool address by index.
read get_coins(address)
Coins of a pool deployed by this factory.
read get_coin_indices(address,address,address)
(pool, from, to) -> coin indices (uint256 i, uint256 j).
read get_gauge(address)
Gauge of a pool (zero if none).
write deploy_gauge(address)
Permissionless: deploy a liquidity gauge for a pool of this factory (it still needs a DAO vote to receive CRV emissions).
write deploy_pool(string,string,address[3],address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[2])
Permissionless three-coin volatile pool creation. Tricrypto-NG pools are their own LP token and expose exchange(uint256,uint256,uint256,uint256[,bool use_eth][,address receiver]), get_dy(uint256,uint256,uint256), add_liquidity(uint256[3],uint256[,bool,address]), calc_token_amount(uint256[3],bool), remove_liquidity_one_coin(uint256,uint256,uint256[,bool,address]).
CRV (Curve DAO Token)token on ethereum0xD533a949740bb3306d119CC777fa900bA034cd52
read balanceOf(address)
CRV balance (18 decimals).
write approve(address,uint256)
Approve a spender. Approve CRV to veCRV 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 before create_lock/increase_amount.
write transfer(address,uint256)
Transfer (18 decimals).
read totalSupply()
Total supply.
veCRV (VotingEscrow)governance on ethereum0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2
write create_lock(uint256,uint256)
Lock CRV (_value, 18 decimals) until _unlock_time (unix seconds, rounded down to whole weeks; 1 week to 4 years). Approve CRV to veCRV first. One lock per address; smart contracts must be whitelisted by the DAO (smart_wallet_checker).
write increase_amount(uint256)
Add CRV to an existing, unexpired lock.
write increase_unlock_time(uint256)
Extend the lock end (new time, rounded to weeks, max 4 years from now).
write withdraw()
Withdraw all CRV after the lock has expired. No early exit.
read locked(address)
(amount int128, end) of a lock.
read locked__end(address)
Lock end timestamp.
read balanceOf(address)
Current veCRV voting power (decays linearly to 0 at lock end); not transferable.
read totalSupply()
Total veCRV voting power.
GaugeControllergovernance on ethereum0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB
write vote_for_gauge_weights(address,uint256)
Allocate veCRV voting power to a gauge (_user_weight in basis points, 0-10000 across all your votes). Each gauge vote can be changed once every 10 days.
read gauge_relative_weight(address)
Gauge's share of weekly CRV emissions (1e18 = 100%).
read get_gauge_weight(address)
Absolute gauge weight.
read gauge_types(address)
Gauge type id (reverts if the gauge is not added).
read vote_user_power(address)
Basis points of a user's voting power already used.
read last_user_vote(address,address)
Timestamp of a user's last vote for a gauge.
read n_gauges()
Number of gauges; gauges(uint256) enumerates them.
Minter (CRV emissions)staking on ethereum0xd061D61a4d941c39E5453435B6345Dc261C2fcE0
write mint(address)
Claim the caller's accrued CRV from an Ethereum liquidity gauge (gauge address as argument).
write mint_many(address[8])
Claim CRV from up to 8 gauges (zero-padded).
write mint_for(address,address)
Claim for another address (gauge, for); that address must have approved the caller via toggle_approve_mint.
read minted(address,address)
CRV already minted (user, gauge).
FeeDistributor (crvUSD revenue to veCRV)staking on ethereum0xD16d5eC345Dd86Fb63C6a9C43c517210F1027914
write claim()
Claim the caller's weekly protocol revenue (paid in crvUSD) earned by veCRV. Revenue is distributed within 24 h after Thursday 00:00 UTC each week.
write claim(address)
Claim on behalf of an address (funds go to that address).
write claim_many(address[20])
Claim for up to 20 addresses.
read token()
Reward token (crvUSD).
crvUSDtoken on ethereum0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E
read balanceOf(address)
crvUSD balance (18 decimals).
write approve(address,uint256)
Approve a spender. Approve to scrvUSD 0x0655977FEb2f289A4aB78af67BAB0d17aAb84367 for deposit, or to a pool/router for swaps.
write transfer(address,uint256)
Transfer (18 decimals).
read totalSupply()
Total supply.
crvUSD ControllerFactory (mint markets)factory on ethereum0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC
read n_collaterals()
Number of crvUSD mint markets (9 at research time); enumerate with collaterals(uint256), controllers(uint256), amms(uint256).
read get_controller(address)
Controller (loan management) for a collateral token. Controllers expose create_loan(uint256 collateral, uint256 debt, uint256 N) (payable for ETH markets), add_collateral(uint256), remove_collateral(uint256), borrow_more(uint256,uint256), repay(...), debt(address), health(address), max_borrowable(uint256,uint256); approve collateral to the Controller first. N = number of LLAMMA liquidation bands (4-50).
read get_amm(address)
LLAMMA AMM for a collateral token.
read controllers(uint256)
Controller by index.
read total_debt()
Total crvUSD debt across mint markets.
read debt_ceiling(address)
Debt ceiling of a controller.
read stablecoin()
crvUSD address.
scrvUSD (Savings crvUSD, Yearn V3 vault, ERC-4626)vault on ethereum0x0655977FEb2f289A4aB78af67BAB0d17aAb84367
write deposit(uint256,address)
Deposit crvUSD (assets, 18 decimals) for scrvUSD shares. Approve crvUSD to scrvUSD first.
write redeem(uint256,address,address)
Burn shares (shares, receiver, owner) for crvUSD.
write withdraw(uint256,address,address)
Withdraw an exact crvUSD amount.
read convertToAssets(uint256)
crvUSD per share amount.
read pricePerShare()
crvUSD per 1e18 shares (about 1.1158 at research time).
read previewRedeem(uint256)
Exact crvUSD for redeeming shares.
read totalAssets()
Total crvUSD in the vault.
read balanceOf(address)
scrvUSD balance (18 decimals).
3pool (DAI/USDC/USDT StableSwap)pool on ethereum0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7
write exchange(int128,int128,uint256,uint256)
Swap coin i for coin j (indices: 0 DAI 18 dec, 1 USDC 6 dec, 2 USDT 6 dec): (i, j, dx in coin i units, min_dy). Approve coin i to the pool first (USDT requires resetting the allowance to 0 before setting a new non-zero value). Returns nothing; check balances.
read get_dy(int128,int128,uint256)
Output amount of coin j for dx of coin i (after fee).
write add_liquidity(uint256[3],uint256)
Deposit [DAI, USDC, USDT] amounts (each in its own decimals) for at least min_mint_amount 3Crv LP (0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490). Approve each coin first.
read calc_token_amount(uint256[3],bool)
Approximate LP minted (deposit=true) or burned (false), fees excluded; apply slippage.
write remove_liquidity_one_coin(uint256,int128,uint256)
Burn 3Crv (_token_amount) for one coin i with min_amount.
read calc_withdraw_one_coin(uint256,int128)
Coin i received for burning an LP amount.
write remove_liquidity(uint256,uint256[3])
Burn LP for all three coins proportionally (min_amounts).
read get_virtual_price()
LP value in USD-ish units (1e18).
read coins(uint256)
Coin address by index.
read balances(uint256)
Pool balance of coin index.
read fee()
Swap fee (1e10 = 100%).
3Crv (3pool LP token)token on ethereum0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490
read balanceOf(address)
3Crv balance (18 decimals).
write approve(address,uint256)
Approve a spender. Approve to the 3pool gauge 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A before deposit.
write transfer(address,uint256)
Transfer (18 decimals).
read totalSupply()
Total supply.
3pool LiquidityGauge (v1)staking on ethereum0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A
write deposit(uint256)
Stake 3Crv (approve 3Crv to the gauge first) to earn CRV emissions.
write deposit(uint256,address)
Stake on behalf of an address.
write withdraw(uint256)
Unstake 3Crv.
write claimable_tokens(address)
Pending CRV (non-view in Vyper; call it with eth_call). CRV is claimed through Minter 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 .mint(gauge), not on the gauge. Newer gauges (LiquidityGaugeV6) add deposit(uint256,address,bool), withdraw(uint256,bool) and claim_rewards() for extra reward tokens.
read balanceOf(address)
Staked LP.
read working_balances(address)
Boost-adjusted balance (veCRV boost up to 2.5x).
crvUSD/USDC pool (Stableswap factory plain pool)pool on ethereum0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E
write exchange(int128,int128,uint256,uint256)
Swap (i, j, dx, min_dy); coins: 0 USDC (6 dec), 1 crvUSD (18 dec). Approve coin i first. Returns dy.
write exchange(int128,int128,uint256,uint256,address)
Swap with a receiver.
read get_dy(int128,int128,uint256)
Quote.
write add_liquidity(uint256[2],uint256)
Deposit [USDC, crvUSD]; the pool is its own LP token.
read calc_token_amount(uint256[2],bool)
Approximate LP for a deposit/withdrawal.
write remove_liquidity_one_coin(uint256,int128,uint256)
Burn LP for one coin.
read calc_withdraw_one_coin(uint256,int128)
Coin received for an LP amount.
read price_oracle()
EMA price of crvUSD in USDC (1e18).
read coins(uint256)
Coin by index.
CurveRouterNG v1.1.0router on arbitrum0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on arbitrum0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on arbitrum0x13526206545e2DC7CcfBaF28dC88F440ce7AD3e0
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
CurveRouterNG v1.1.0router on base0x4f37A9d177470499A2dD084621020b023fcffc1F
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on base0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on base0x87DD13Dd25a1DBde0E1EdcF5B8Fa6cfff7eABCaD
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
CurveRouterNG v1.1.0router on optimism0x0DCDED3545D565bA3B19E683431381007245d983
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on optimism0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on optimism0xc65CB3156225380BEda366610BaB18D5835A1647
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
CurveRouterNG v1.1.0router on polygon0x0DCDED3545D565bA3B19E683431381007245d983
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on polygon0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on polygon0x296d2B5C23833A70D07c8fCBB97d846c1ff90DDD
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
CurveRouterNG v1.1.0router on bsc0xA72C85C258A81761433B4e8da60505Fe3Dd551CC
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on bsc0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on bsc0x4C7A5A5D57F98D362f1c00D7135F0dA5B6f82227
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).
CurveRouterNG v1.1.0router on avalanche0x0DCDED3545D565bA3B19E683431381007245d983
write exchange(address[11],uint256[5][5],uint256,uint256)
Swap along a route of up to 5 Curve pools: (_route, _swap_params, _amount of _route[0] in its decimals, _expected = min output of the final token). Approve _route[0] to the router first; send ETH as msg.value when _route[0] is 0xEeee...EEeE. Returns the amount received. _route is address[11] = [tokenIn, pool1, token1, pool2, token2, ...] padded with zero addresses (up to 5 hops; native ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). _swap_params is uint256[5][5], one row per hop = [i, j, swap_type, pool_type, n_coins] where i/j are coin indices in that pool (pool.coins(n) or MetaRegistry.get_coin_indices), swap_type 1=exchange, 2=exchange_underlying, 3=underlying via zap, 4=coin->LP (add_liquidity), 5=lending underlying->LP, 6=LP->coin (remove_liquidity_one_coin), 7=LP->lending underlying, 8=ETH/WETH/stETH-type wraps, 9=SNX; pool_type 1=stableswap, 2=twocrypto, 3=tricrypto, 4=LLAMMA; unused rows are zeros. Routes are computed off-chain: use Curve's JS library (@curvefi/api router, github.com/curvefi/curve-js, or curve-router-js) or build a one-hop route yourself from MetaRegistry.find_pools_for_coins + get_coin_indices.
write exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)
Same with _pools (only needed for swap_type 3 zaps; zeros otherwise) and an explicit _receiver.
read get_dy(address[11],uint256[5][5],uint256)
Quote output of the final token for _amount in (same route encoding). Use it to set _expected with slippage.
read get_dy(address[11],uint256[5][5],uint256,address[5])
Quote with _pools for zap routes.
read get_dx(address[11],uint256[5][5],uint256,address[5])
Required input for a desired final output (_out_amount); pass zero-filled _pools when not using zaps. Approximate for crypto pools.
read version()
Router version string.
AddressProvider (NG)other on avalanche0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98
read get_address(uint256)
Address registered under an ID. IDs: 2 Exchange Router, 7 MetaRegistry, 11 TricryptoNG Factory, 12 StableswapNG Factory, 13 TwocryptoNG Factory, 14/15 calc zaps, 16 crvUSD controller factory, 19 CRV, 25 crvUSD (not every ID exists on every chain).
read get_id_info(uint256)
(addr, description, version, last_modified) for an ID.
read ids()
All registered IDs.
read num_entries()
Number of entries.
MetaRegistryother on avalanche0xB6845b562F01eB02ef20CBB63553d2a768e5a1Cb
read find_pools_for_coins(address,address)
All registered pools (all factories and legacy registries) that hold both tokens. Main on-chain pool discovery call.
read find_pool_for_coins(address,address,uint256)
The i-th pool for a token pair (i = 0 is the first).
read get_coin_indices(address,address,address)
(pool, from, to) -> (i, j, is_underlying). Use i/j in pool.exchange or as the router's swap_params.
read get_coins(address)
Coins of a pool (address[8], zero-padded).
read get_n_coins(address)
Number of coins.
read get_decimals(address)
Coin decimals (uint256[8]).
read get_balances(address)
Pool balances (uint256[8]).
read get_lp_token(address)
LP token of a pool (same as the pool for NG pools).
read get_pool_from_lp_token(address)
Pool address for an LP token (e.g. 3Crv -> 3pool).
read get_gauge(address)
Liquidity gauge of a pool (zero if none).
read get_virtual_price_from_lp_token(address)
LP virtual price (1e18).
read get_pool_name(address)
Pool name.
read pool_count()
Number of registered pools; enumerate with pool_list(uint256).