Swap Parameters
The swap
function contains _swapParams
as input, whose type is the following struct:
_swapParams.isSwapCallback
True ifmsg.sender
expects a callback to claim input token amounts after all swap amounts have been determined (analogous to the swap callback in UniswapV3 pools). If False, input token claiming will happen viaERC20.transferFrom
_swapParams.isZeroToOne
Direction of the swap_swapParams.amountIn
Maximum amount of input token which the user wants to trade._swapParams.amountOutMin
Minimum required amount of output token._swapParams.deadline
Block height at which the swap becomes invalid._swapParams.recipient
Address which should receive the output token amount._swapParams.swapTokenOut
Token which the user wants to receive as output. Does not necessarily need to betoken0
ortoken1
._swapParams.swapContext
Struct containing external byte encoded calldata for the Liquidity Module, Swap Fee Module, Verifier Module and swap callback, if applicable.
Swap Context
The swapContext
struct includes 4 fields optionally utilized by different modules during swap execution.
_swapParams.swapContext.externalContext
Is sent to the Liquidity Module during thegetLiquidityQuote
call, this context is likely used to inform the Liquidity Module about any external data it should use for pricing._swapParams.swapContext.verifierContext
Is sent to the Verifier Module before a swap is made. The verifier module can revert or produceverifierContext
sent to the Liquidity Module during thegetLiquidityQuote
call._swapParams.swapContext.swapCallbackContext
Is sent to the Liquidity Module after a swap has been made. This allows the AMM to update state according to external data post swap._swapParams.swapContext.swapFeeModuleContext
Is sent to the Swap Fee Module before a swap to compute the fees.
Last updated