Skip to main content

ClipperRouter

Clipper router that allows to use ClipperExchangeInterface for swaps

Derives#

Functions#

constructor#

function constructor(  address weth,  contract IClipperExchangeInterface clipperExchange) public

Parameters:#

NameTypeDescription
wethaddress
clipperExchangecontract IClipperExchangeInterface

clipperSwapToWithPermit#

function clipperSwapToWithPermit(  address payable recipient,  contract IERC20 srcToken,  contract IERC20 dstToken,  uint256 amount,  uint256 minReturn,  bytes permit) external returns (uint256 returnAmount)

Same as clipperSwapTo but calls permit first, allowing to approve token spending and make a swap in one transaction.

Parameters:#

NameTypeDescription
recipientaddress payableAddress that will receive swap funds
srcTokencontract IERC20Source token
dstTokencontract IERC20Destination token
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit
permitbytesShould contain valid permit that can be used in IERC20Permit.permit calls. See tests for examples

clipperSwap#

function clipperSwap(  contract IERC20 srcToken,  contract IERC20 dstToken,  uint256 amount,  uint256 minReturn) external returns (uint256 returnAmount)

Same as clipperSwapTo but uses msg.sender as recipient

Parameters:#

NameTypeDescription
srcTokencontract IERC20Source token
dstTokencontract IERC20Destination token
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit

clipperSwapTo#

function clipperSwapTo(  address payable recipient,  contract IERC20 srcToken,  contract IERC20 dstToken,  uint256 amount,  uint256 minReturn) public returns (uint256 returnAmount)

Performs swap using Clipper exchange. Wraps and unwraps ETH if required. Sending non-zero msg.value for anything but ETH swaps is prohibited

Parameters:#

NameTypeDescription
recipientaddress payableAddress that will receive swap funds
srcTokencontract IERC20Source token
dstTokencontract IERC20Destination token
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit