IExchangeHelper
deployed standalone and referenced by internal functions
do NOT set approval to this contract!
Functions
swapWithToken
perform arbitrary swap transaction
function swapWithToken(
address sourceToken,
address targetToken,
uint256 sourceTokenAmount,
address callee,
address allowanceTarget,
bytes calldata data,
address refundAddress
) external returns (uint256 amountOut, uint256 sourceLeft);
Parameters
Name | Type | Description |
---|---|---|
sourceToken | address | source token to pull into this address |
targetToken | address | target token to buy |
sourceTokenAmount | uint256 | amount of source token to start the trade |
callee | address | exchange address to call to execute the trade. |
allowanceTarget | address | address for which to set allowance for the trade |
data | bytes | calldata to execute the trade |
refundAddress | address | address that un-used source token goes to |
Returns
Name | Type | Description |
---|---|---|
amountOut | uint256 | quantity of targetToken yielded by swap |
sourceLeft | uint256 | quantity of sourceToken left and refunded to refundAddress |