What it offers
- swap: Swap tokens with route-based routing specifying stable or volatile pool type
- addLiquidity: Add liquidity to a stable or volatile pool
- removeLiquidity: Remove liquidity from a stable or volatile pool
Notes
- Two pool types:
stable=truefor correlated assets (uses Curve-like invariant),stable=falsefor uncorrelated (uses x*y=k) - Fees: volatile pools typically 0.3%, stable pools typically 0.04% (set by governance)
- ve(3,3) model: VELO holders vote-lock tokens to direct gauge emissions to pools weekly
- Routes include both
stableflag andfactoryaddress per hop - Optimism-only deployment; Aerodrome is the Base equivalent (same interface)
- LP tokens can be staked in gauges for VELO emissions
Its names in a program
On Optimism,Velodrome is a namespace: its contracts need no import.
Deployments
ABI
Where a line says what an address it returns is, a program that calls the function through its namespace calls that contract’s methods on the result directly:<Namespace>.<Contract>.<function>(...).<method>(...). A token’s methods are the ERC-20
functions, and its writes are SafeERC20.
VelodromePoolABI
import VelodromePoolABI from "./protocols/velodrome/VelodromePoolABI.json";
getReserves() view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast)getAmountOut(uint256 amountIn, address tokenIn) view returns (uint256)stable() view returns (bool)token0() view returns (address): the address is a tokentoken1() view returns (address): the address is a tokenswap(uint256 amount0Out, uint256 amount1Out, address to, bytes data)
VelodromePoolFactoryABI
import VelodromePoolFactoryABI from "./protocols/velodrome/VelodromePoolFactoryABI.json"; Speaks for: poolFactory.
getPool(address tokenA, address tokenB, bool stable) view returns (address pool): the address is aVelodrome.Pool
VelodromeRouterABI
import VelodromeRouterABI from "./protocols/velodrome/VelodromeRouterABI.json"; Speaks for: routerV2.
swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, (address from, address to, bool stable, address factory)[] routes, address to, uint256 deadline) returns (uint256[] amounts)addLiquidity(address tokenA, address tokenB, bool stable, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns (uint256 amountA, uint256 amountB, uint256 liquidity)removeLiquidity(address tokenA, address tokenB, bool stable, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns (uint256 amountA, uint256 amountB)
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
