Applies a slippage tolerance to an expected output amount to derive a minAmountOutScaled value suitable for the V2 swap instruction.
minAmountOutScaled
The minimum acceptable output amount
const quote = getSwapResult(bucket, 1_000_000n, SwapDirection.Buy);const minOut = applySlippage(quote.amountOut, 200); // 2% slippage
The expected output from getSwapResult
getSwapResult
Slippage tolerance in basis points (e.g. 50 = 0.5%, 200 = 2%)
Generated using TypeDoc
Applies a slippage tolerance to an expected output amount to derive a
minAmountOutScaledvalue suitable for the V2 swap instruction.Returns
The minimum acceptable output amount
Example