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
| Field | Meaning |
|---|---|
kind | 'sellExactAvmIn' |
avmIn | Tokens burned |
grossReserveOutRaw | Curve payout before fee |
netReserveOutRaw | Wallet proceeds after 1.25% |
nextEngine | Coefficients after a possible contraction |
priceImpact | Uniswap-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
| Error | When |
|---|---|
ProtocolRevertError ZeroAmount | Amount is 0 or exceeds curve supply |
ProtocolRevertError BelowMinimum | Curve payout < 100 raw |
Tips
- Prefer this selector unless the user typed a USDC target. Exact-output sells are the expensive path — see quoteSellExactReserveOut.