Skip to content

ILeveragedPositionManagement

Atomic position expansion and shrinkage flows composed from cash advance and spot trading primitives.

All token amounts are RawTokenQuantity values in the relevant token’s native decimals. grossDebtIncrease is gross reserve-token debt opened against the position; the cash-advance origination fee is withheld before the borrowed proceeds are composed into a trade. Exact reserve-token output means the actual reserve tokens received by the trader after sell fees, never the gross reserve value quoted by the curve.

Buy and collateralize exact AVM using newly opened debt plus caller wallet reserve.

@avmCollateralAdded — Exact AVM collateral added to the caller’s position.

@grossDebtIncrease — Exact gross reserve-token debt added to the caller’s position.

@maxReserveFromUser — Slippage ceiling on reserve tokens pulled from the caller’s wallet.

function expandWithExactAvmOut(RawTokenQuantity avmCollateralAdded, RawTokenQuantity grossDebtIncrease, RawTokenQuantity maxReserveFromUser) nonpayable

Parameters

Spend exact wallet reserve plus exact newly opened debt to buy and collateralize AVM.

@grossDebtIncrease — Exact gross reserve-token debt added to the caller’s position.

@minAvmCollateral — Slippage floor on AVM collateral added to the position.

@reserveFromUser — Exact reserve tokens pulled from the caller’s wallet.

function expandWithExactReserveIn(RawTokenQuantity reserveFromUser, RawTokenQuantity grossDebtIncrease, RawTokenQuantity minAvmCollateral) nonpayable

Parameters

Sell exact AVM collateral, repay exact debt, and send residual reserve to the caller.

@avmCollateralRemoved — Exact AVM collateral removed from the caller’s position and sold.

@debtDecrease — Exact reserve-token debt repaid from the sell proceeds.

@minReserveTokensToUser — Slippage floor on actual reserve tokens sent to the caller after fees and repayment.

function shrinkWithExactAvmIn(RawTokenQuantity avmCollateralRemoved, RawTokenQuantity debtDecrease, RawTokenQuantity minReserveTokensToUser) nonpayable

Parameters

Sell enough AVM collateral to repay exact debt and send exact reserve tokens to the caller.

@debtDecrease — Exact reserve-token debt repaid from the sell proceeds.

@maxAvmCollateralRemoved — Slippage ceiling on AVM collateral removed and sold.

@netReserveTokensToUser — Exact reserve tokens sent to the caller after sell fees and debt repayment.

function shrinkWithExactReserveOut(RawTokenQuantity netReserveTokensToUser, RawTokenQuantity debtDecrease, RawTokenQuantity maxAvmCollateralRemoved) nonpayable

Parameters