Search…
⌃K

ISwapWrapper

ISwapWrapper is the interface that all swap wrappers should implement. This will be used to support swap protocols like Uniswap V2 and V3, Sushiswap, 1inch, etc.

Methods

name

function name() external nonpayable returns (string)
Name of swap wrapper for UX readability.

Returns

Name
Type
Description
_0
string
undefined

swap

function swap(address _tokenIn, address _tokenOut, address _recipient, uint256 _amount, bytes _data) external payable returns (uint256)
Swap function. Generally we expect the implementer to call some exactAmountIn-like swap method, and so the documentation is written with this in mind. However, the method signature is general enough to support exactAmountOut swaps as well.

Parameters

Name
Type
Description
_tokenIn
address
Token to be swapped (or 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH).
_tokenOut
address
Token to receive (or 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH).
_recipient
address
Reciever of _tokenOut.
_amount
uint256
Amount of _tokenIn that should be swapped.
_data
bytes
Additional data that the swap wrapper may require to execute the swap.

Returns

Name
Type
Description
_0
uint256
Amount of _tokenOut received.

Events

WrapperSwapExecuted

event WrapperSwapExecuted(address indexed tokenIn, address indexed tokenOut, address sender, address indexed recipient, uint256 amountIn, uint256 amountOut)
Event emitted after a successful swap.

Parameters

Name
Type
Description
tokenIn indexed
address
undefined
tokenOut indexed
address
undefined
sender
address
undefined
recipient indexed
address
undefined
amountIn
uint256
undefined
amountOut
uint256
undefined
Last modified 1mo ago