SlimRouter
This documentation provides an overview of the ISlimRouter.sol contract, which defines the functions & events for conducting token swaps & managing token balances. The IRouter inherits this contract.
Last updated
This documentation provides an overview of the ISlimRouter.sol contract, which defines the functions & events for conducting token swaps & managing token balances. The IRouter inherits this contract.
Last updated
Name : ISlimRouter
Solidity Version : ^0.8.0
SPDX License-Identifier : GPL-2.0-or-later
Code:
tokenIn
: The address of the token to be swapped.
tokenOut
: The address of the desired token to receive in the swap.
pool
: An instance of the IPool interface representing the pool to perform the swap in.
recipient
: The address where the swapped tokens will be sent.
deadline
: The deadline timestamp for the swap to be executed before it expires.
amountIn
: The amount of tokenIn token to be swapped.
amountOutMinimum
: The minimum amount of tokenOut tokens expected to be received from the swap.
sqrtPriceLimitD18
: The square root of the price limit for the swap, represented with 18 decimal places.
tokenIn
: The address of the token to be used as input in the swap.
tokenOut
: The address of the token to be received as output in the swap.
pool
: An instance of the IPool interface representing the pool to perform the swap in.
recipient
: The address where the swapped tokens will be sent.
deadline
: The deadline timestamp for the swap to be executed before it expires.
amountOut
: The desired amount of tokenOut tokens to be received from the swap.
amountInMaximum
: The maximum amount of tokenIn tokens to be used for the swap.
Retrieves the address of the WETH9 token.
Returns :
IWETH9
: An instance of the IWETH9
interface representing the WETH9 token.
Swaps amountIn
of one token for as much as possible of another token.
Parameters :
params
: The parameters necessary for the swap, encoded as ExactInputSingleParams
structure in calldata.
Returns :
amountOut
: The amount of the received token uint256
.
Swaps as little as possible of one token for amountOut
of another token.
Parameters :
params
: The parameters necessary for the swap, encoded as ExactOutputSingleParams
structure in calldata.
Returns:
amountIn
: The amount of the input token uint256
.
Unwraps the contract's WETH9
balance and sends it to the specified recipient as ETH
.
Parameters:
amountMinimum
: The minimum amount
of WETH9
to unwrap.
recipient
: The address
receiving ETH.
Refunds any ETH
balance held by this contract to the msg.sender
.
Transfers the full amount of a specified token held by this contract to the recipient.
Parameters:
token
: The contract address
of the token to be transferred.
amountMinimum
: The minimum amount
of token uint256
required for the transfer.
recipient
: The destination address
of the token.