Curve
04 / 06

Read state, quote, and trade

Every curve trade carries a 0.97% fee: 0.30% to the creator wallet, 0.67% to the platform. Every quote on this page is already net of it. Use the API if you want unsigned transactions handed to you, or the ABI if you build your own.

Through the API

  1. 01
    Quote
    GET /tokens/:token/quote

    Net-of-fee output for a buy or sell amount.

  2. 02
    Build
    POST /tokens/:token/build-tx

    An unsigned transaction with slippage applied.

  3. 03
    Sign
    your user's wallet

    Nothing here signs. The recipient wallet does.

# The API prices and builds the transaction. The response is unsigned; your user signs it.
curl "https://api.vectr.bot/tokens/0xTOKEN/quote?type=buy&amount=0.1"
curl -X POST https://api.vectr.bot/tokens/0xTOKEN/build-tx -H "Content-Type: application/json" -d '{"type":"buy","amount":"0.1","slippage":1,"recipient":"0xUSER"}'
# slippage is a percent. recipient is the wallet that signs; after graduation the router delivers output there.

Or call the curve directly

Reads
  • token()address

    The ERC-20 this curve prices

  • quoteAsset()address

    Pairing asset. Zero address means the native coin

  • creator()address

    Receives the creator share of every trade

  • graduated()bool

    True once reserves moved to Uniswap

  • getPrice()uint256

    Spot price in quote units, scaled by priceScale()

  • getMarketCap()uint256

    Price times total supply, quote units

  • realQuoteReserves()uint256

    Quote actually held by the curve

  • realTokenReserves()uint256

    Tokens still for sale on the curve

  • graduationThreshold()uint256

    Quote reserve that triggers migration

  • getBuyQuote(uint256 quoteIn)uint256 tokensOut

    Net of fee, use for minTokensOut

  • getSellQuote(uint256 tokenAmount)uint256 quoteOut

    Net of fee, use for minQuoteOut

Writes
  • buy(uint256 amountIn, uint256 minTokensOut)

    payable. Native quote: amountIn must equal msg.value. ERC-20 quote: approve the curve first, send no value.

  • buyFor(uint256 amountIn, uint256 minTokensOut, address recipient)

    Same as buy, tokens go to recipient. For terminals and routers trading on behalf of a user.

  • sell(uint256 tokenAmount, uint256 minQuoteOut)

    Approve the curve for tokenAmount first.

After graduated() flips true the curve rejects trades and quotes return zero. Route to the Uniswap V3 pool from PoolCreated at the 1.00% fee tier, using the standard SwapRouter02 and QuoterV2 addresses listed on the contracts page. The API endpoints above already do this switch for you.