NativeRouter
Functions
exactInputSingle
Used for single hop exact input swap. Process as below:
Verify if the pool exists in the Pool Factory
Call Pool swap() function
Check the slippage for the transaction is within specified amount
params
Order parameters
exactInput
Used for multi-hop exact input swap. Process as below:
Loop all orders
Decode and slice first order
Call Pool swap() function
Verify if the pool exists in the Pool Factory
Check to make slippage for the transaction is within specified amount
params
Order parameters
swapCallback
Called whenever a swap happens. Process as below:
Verify if the pool exists in the Pool Factory
Transfer token from user wallet to pool (Single hop) or router to pool (Multi-hop)
If user is selling native token, this function will wrap the token before transfering to the pool
If user is buying native token, a multiple call transaction will be called: Treasury transfer the wrapped token to Router and from the Router, unwrap the token and transfer it to the user wallet
amount0Delta
int256
The amount of output token that was sent (negative) or input token that must be received (positive) by the pool by the end of the swap. If positive, the callback must send that amount of input token to the pool.
amount1Delta
int256
The amount of output token that was sent (negative) or input token that must be received (positive) by the pool by the end of the swap. If positive, the callback must send that amount of input token to the pool.
_data
bytes
Callback bytes data
Last updated