IExchangeHelper

Git Source

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

NameTypeDescription
sourceTokenaddresssource token to pull into this address
targetTokenaddresstarget token to buy
sourceTokenAmountuint256amount of source token to start the trade
calleeaddressexchange address to call to execute the trade.
allowanceTargetaddressaddress for which to set allowance for the trade
databytescalldata to execute the trade
refundAddressaddressaddress that un-used source token goes to

Returns

NameTypeDescription
amountOutuint256quantity of targetToken yielded by swap
sourceLeftuint256quantity of sourceToken left and refunded to refundAddress