SV3 logo

quoteSellExactAvmIn

Quote net USDC out for selling an exact AVM amount on the curve.

Burns amount AVM along the curve and returns gross USDC, the 1.25% sell fee, and net proceeds. This is the cheaper sell selector.

Compare with quoteRedeemAtFloor when spot is close to floor. sv3.quote.quoteExitOptions runs both and tells you which pays more.

Import

import { quoteSellExactAvmIn } from "@repo/contract-client/math";

Usage

import { parseAvm } from "@repo/contract-client";
import { quoteSellExactAvmIn } from "@repo/contract-client/math";

const quote = quoteSellExactAvmIn(snapshot, parseAvm("1000"));

quote.avmIn;
quote.grossReserveOutRaw;
quote.netReserveOutRaw;
quote.fees.totalRaw;
quote.priceImpact.totalPriceImpactWad;
quote.nextSpotPriceWad;

A curve sell does move spot down. Floor redemption does not.

Return Value

SellExactInQuote

FieldMeaning
kind'sellExactAvmIn'
avmInTokens burned
grossReserveOutRawCurve payout before fee
netReserveOutRawWallet proceeds after 1.25%
nextEngineCoefficients after a possible contraction
priceImpactUniswap-style, worse-is-positive

Parameters

snapshot

  • Type: MarketSnapshot
quoteSellExactAvmIn(snapshot, parseAvm("1000"));

amount

  • Type: AvmAtoms

AVM to sell. Must be > 0 and ≤ curveSupply. Gross payout must be ≥ 100 raw.

quoteSellExactAvmIn(snapshot, asAvmAtoms(10n ** 18n));

Error

ErrorWhen
ProtocolRevertError ZeroAmountAmount is 0 or exceeds curve supply
ProtocolRevertError BelowMinimumCurve payout < 100 raw

Tips

  • Prefer this selector unless the user typed a USDC target. Exact-output sells are the expensive path — see quoteSellExactReserveOut.