Router
Structs & enums used in the contract
State-changing functions
startExecution
The main function for interaction is execute() / executeWithChi()
. To use executeWithChi()
function, the user must approve CHI tokens to the Router contract prior to the function call. It returns resulting funds to the msg.sender
address.
Parameter | Description |
| Array of actions to be executed. |
| Array of tokens and amounts to be taken from |
|
|
| Array of required token amounts to be returned after the execution of all the actions from |
| Array of actual token amounts to be returned after the execution of all the actions from |
Note, that this function can be called both using "call" and "send".
The suggested flow is the following:
Call
execute
function with zero amounts inrequiredOutputs
.Fetch amounts in
actualOutputs
– these are expected returned amounts.Use expected returned values in
requiredOutputs
when sending transaction in order to prevent high slippage.
Router contract supports EIP712, i.e. the user may sign his data and the Router will transfer tokens to the recovered address. In this case, all the parameters will be wrapped in one struct. It returns funds to the recovered address.
view
functions
view
functionsgetRequiredAllowances
Returns the difference between required token allowance and current allowance for every token in inputs
array.