Skip to main content

GenericRouter

Router that allows to use IAggregationExecutor for swaps

Derives

Functions

swap

function swap(
contract IAggregationExecutor executor,
contract SwapDescription calldata desc,
bytes calldata permit,
bytes calldata data
) external payable returns (uint256 returnAmount, uint256 spentAmount)

Performs a swap, delegating all calls encoded in data to executor. See tests for usage examples

Parameters:

NameTypeDescription
executorcontract IAggregationExecutoreAggregation executor that executes calls described in data
desccontract SwapDescriptionSwap description
permitbytesShould contain valid permit that can be used in IERC20Permit.permit calls
databytesEncoded calls that caller should execute in between of swaps

Return values

NameTypeDescription
returnAmountuint256Resulting token amount
spentAmountuint256Source token amount