Curve Finance Knowledge Hub

website·Indexed 38 days ago

https://docs.curve.finance

Technical documentation for Curve's Automated Market Maker (AMM), covering Stableswap and Cryptoswap algorithms, pool rebalancing, dynamic fees, and the Stableswap-NG Factory for permissionless deployment of liquidity pools and gauges.

Tokens
459.4K
Snippets
2.3K
Records
3.4K
Agent score
67%

What's inside Curve

  1. Overview of the FeeCollector burn process

    The FeeCollector manages the process of converting admin fees from various sources into a single target reward token (the target coin) for distribution to veCRV holders. The general workflow is:

    1. Withdrawal: Admin fees are collected from pools using withdraw_many.
    2. Burning/Conversion: The collect function is called during the COLLECT epoch. This triggers the burn function in the burner contract, which creates a conditional order on CowSwap to exchange the collected fee tokens into the target coin.
    3. Forwarding: Once burned, tokens are forwarded to the FeeDistributor using the forward function.
  2. Overview of Curve FXSwap AMM

    FXSwap is a two-asset automated market maker (AMM) designed for markets where primary price discovery occurs externally (e.g., fiat FX pairs or BTC/USD). It maintains passive liquidity concentrated around a moving external market price using four core mechanisms: StableSwap-style concentration around a variable price_scale, an exponential moving-average oracle for gradual recentering, 'refuels' (finite external liquidity buffers used to fund recentering), and passive full-range LP positions.
  3. Overview of staking LP tokens in Curve gauges

    Liquidity pool (LP) tokens can be deposited into or withdrawn from a gauge at any time. While user interfaces often refer to this as 'staking' and 'unstaking', the underlying smart contract functions are deposit and withdraw. When LP tokens are deposited, the contract mints an equivalent amount of 'gauge tokens' to the depositor to track their share. This allows the user to earn CRV rewards based on their liquidity share and boost factor.
  4. Overview of the FastBridgeVault contract

    The FastBridgeVault is the Ethereum mainnet component of the FastBridge system. It manages pre-minted crvUSD tokens and handles the fast bridge mechanism, acting as a secure intermediary that allows users to receive crvUSD immediately while their native bridge transactions are still pending. The vault incorporates risk management via debt ceilings, fee collection, and emergency controls.
  5. Overview of crvUSD Stablecoin Infrastructure Components

    The crvUSD ecosystem consists of several interconnected components that manage lending, collateral, stability, and yield:

    • crvUSD: The primary stablecoin token based on the ERC-20 standard.
    • Savings crvUSD (scrvUSD): A yield-bearing version of crvUSD built on a Yearn V3 Vault that earns interest from crvUSD borrowers.
    • Controller: The primary user interface contract for creating loans, managing positions, and executing external liquidations. It maintains all user debt information.
    • LLAMMA: The market-making contract responsible for rebalancing and liquidating collateral. Each market has its own AMM containing the collateral asset and crvUSD.
    • Factory: Used for administrative tasks including adding new markets, adjusting debt ceilings, setting blueprint contracts for AMMs and Controllers, and designating the fee receiver.
    • Monetary Policy: Contracts that determine the interest rates for crvUSD markets.
    • PegKeepers: Contracts dedicated to stabilizing the crvUSD peg using allocated crvUSD.
    • Price Aggregator (AggregatorStablePrice): Aggregates crvUSD prices from multiple Curve pools to provide an exponential moving average price used as an oracle for interest rate calculations.
    • Oracles: Contracts used to determine the value of collaterals within the markets.
    • Flash Loan (FlashLender.vy): A contract that enables users to take out flash loans of crvUSD.
  6. Overview of Curve Token V2 API changes

    Curve Token V2 introduces several changes compared to V1:

    • The minter attribute is now public with an associated getter.
    • Token name and symbol can be updated via the set_name method.
    • The mint and burnFrom methods now return a bool.
    • The burn method has been removed.

    Critical Constraint: For Curve LP Tokens V1 and V2, non-zero to non-zero approvals are prohibited. After any non-zero approval, the allowance for the spender must be reset to 0.

  7. Overview of the CryptoSwap Exchange algorithm

    The CryptoSwap algorithm implements Automatic Market-Making with Dynamic Peg, designed to provide liquidity for assets that are not necessarily pegged to each other. It concentrates liquidity around a price point determined by an internal oracle, which is adjusted to balance system profits and potential losses. The system utilizes transformed pegged invariants, the CurveCrypto invariant (optimized for EVM execution), and a dynamic fee structure that adapts to market conditions to optimize returns for liquidity providers.
  8. Overview of VaultMessengerLZ in FastBridge

    The VaultMessengerLZ contract is the Ethereum mainnet receiver for LayerZero messages in the FastBridge system. It implements the LayerZero OApp (Omnichain Application) standard to receive fast bridge messages from L2 networks. When a message is received, it triggers immediate crvUSD minting in the FastBridgeVault, allowing users to access bridged funds instantly while the native bridge transaction is still pending.
  9. Overview of the Curve Finance Hooker contract

    The Hooker contract is a component of the Curve Finance ecosystem designed to manage and execute hooks that interact with the FeeCollector contract. It handles the execution of predefined actions (hooks) triggered under specific conditions, such as fee collection, and manages the calculation and distribution of compensations for those executing the hooks.
  10. Overview of Deposit Zap Burners

    Burners are specialized contracts used to unwrap, swap, or convert specific asset types into underlying assets to be forwarded to other burners or distributors.

    • Lending Burners (ABurner, CBurner, YBurner): Unwrap lending tokens into underlying assets. No configuration required.
    • CryptoSwap Burner: Used to burn fees from Crypto Pools.
    • StableSwap Burner: Swaps an asset into another using a Stable pool and forwards it to another burner.
    • MetaBurner: Converts Metapool-paired coins to 3CRV and transfers them to the FeeDistributor using exchange_with_best_rate. No configuration required.
    • SynthBurner: Converts non-USD assets into sUSD via synth conversion or intermediate swaps.