@@ -6,82 +6,108 @@ Clipper router that allows to use `ClipperExchangeInterface` for swaps
66
77
88## Derives
9- - [ Permitable] ( helpers/Permitable.md )
109- [ EthReceiver] ( helpers/EthReceiver.md )
1110
1211## Functions
1312### constructor
1413``` solidity
15- function constructor(
16- address weth,
17- contract IClipperExchangeInterface clipperExchange
18- ) public
14+ function constructor(contract IWETH weth)
1915```
2016
2117
2218#### Parameters:
2319| Name | Type | Description |
2420| :--- | :--- | :------------------------------------------------------------------- |
25- | ` weth ` | address |
26- | ` clipperExchange ` | contract IClipperExchangeInterface |
21+ | ` weth ` | contract IWETH |
2722
2823
2924### clipperSwapToWithPermit
3025``` solidity
3126function clipperSwapToWithPermit(
32- address payable recipient,
33- contract IERC20 srcToken,
34- contract IERC20 dstToken,
35- uint256 amount,
36- uint256 minReturn,
37- bytes permit
38- ) external returns (uint256 returnAmount)
27+ contract IClipperExchangeInterface clipperExchange,
28+ address payable recipient,
29+ contract IERC20 srcToken,
30+ contract IERC20 dstToken,
31+ uint256 inputAmount,
32+ uint256 outputAmount,
33+ uint256 expiryWithFlags,
34+ bytes32 r,
35+ bytes32 vs,
36+ bytes calldata permit
37+ ) external returns(uint256 returnAmount)
3938```
40- Same as ` clipperSwapTo ` but calls permit first,
41- allowing to approve token spending and make a swap in one transaction.
39+ Same as ` clipperSwapTo ` but calls permit first, allowing to approve token spending and make a swap in one transaction.
4240
4341
4442#### Parameters:
4543| Name | Type | Description |
4644| :--- | :--- | :------------------------------------------------------------------- |
45+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
4746|` recipient ` | address payable | Address that will receive swap funds
4847|` srcToken ` | contract IERC20 | Source token
4948|` dstToken ` | contract IERC20 | Destination token
50- |` amount ` | uint256 | Amount of source tokens to swap
51- |` minReturn ` | uint256 | Minimal allowed returnAmount to make transaction commit
49+ |` inputAmount ` | uint256 | Amount of source tokens to swap
50+ |` outputAmount ` | uint256 | Amount of destination tokens to receive
51+ |` expiryWithFlags ` | uint256 | Timestamp until the swap will be valid with permit2 flag
52+ |` r ` | bytes32 | Clipper order signature (r part)
53+ |` vs ` | bytes32 | Clipper order signature (vs part)
5254|` permit ` | bytes | Should contain valid permit that can be used in ` IERC20Permit.permit ` calls. See tests for examples
5355
5456
57+ #### Return values
58+ | Name | Type | Description |
59+ | :--- | :--- | :------------------------------------------------------------------- |
60+ |` returnAmount ` | uint256 | Amount of destination tokens received
61+
62+
5563### clipperSwap
5664``` solidity
5765function clipperSwap(
58- contract IERC20 srcToken,
59- contract IERC20 dstToken,
60- uint256 amount,
61- uint256 minReturn
62- ) external returns (uint256 returnAmount)
66+ contract IClipperExchangeInterface clipperExchange,
67+ contract IERC20 srcToken,
68+ contract IERC20 dstToken,
69+ uint256 inputAmount,
70+ uint256 outputAmount,
71+ uint256 expiryWithFlags,
72+ bytes32 r,
73+ bytes32 vs
74+ ) external payable returns(uint256 returnAmount)
6375```
6476Same as ` clipperSwapTo ` but uses ` msg.sender ` as recipient
6577
6678
6779#### Parameters:
6880| Name | Type | Description |
6981| :--- | :--- | :------------------------------------------------------------------- |
82+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
7083|` srcToken ` | contract IERC20 | Source token
7184|` dstToken ` | contract IERC20 | Destination token
72- |` amount ` | uint256 | Amount of source tokens to swap
73- |` minReturn ` | uint256 | Minimal allowed returnAmount to make transaction commit
85+ |` inputAmount ` | uint256 | Amount of source tokens to swap
86+ |` outputAmount ` | uint256 | Amount of destination tokens to receive
87+ |` expiryWithFlags ` | uint256 | Timestamp until the swap will be valid with permit2 flag
88+ |` r ` | bytes32 | Clipper order signature (r part)
89+ |` vs ` | bytes32 | Clipper order signature (vs part)
90+
91+
92+ #### Return values
93+ | Name | Type | Description |
94+ | :--- | :--- | :------------------------------------------------------------------- |
95+ |` returnAmount ` | uint256 | Amount of destination tokens received
7496
7597
7698### clipperSwapTo
7799``` solidity
78100function clipperSwapTo(
79- address payable recipient,
80- contract IERC20 srcToken,
81- contract IERC20 dstToken,
82- uint256 amount,
83- uint256 minReturn
84- ) public returns (uint256 returnAmount)
101+ contract IClipperExchangeInterface clipperExchange,
102+ address payable recipient,
103+ contract IERC20 srcToken,
104+ contract IERC20 dstToken,
105+ uint256 inputAmount,
106+ uint256 outputAmount,
107+ uint256 expiryWithFlags,
108+ bytes32 r,
109+ bytes32 vs
110+ ) public payable returns(uint256 returnAmount)
85111```
86112Performs swap using Clipper exchange. Wraps and unwraps ETH if required.
87113Sending non-zero ` msg.value ` for anything but ETH swaps is prohibited
@@ -90,9 +116,19 @@ Sending non-zero `msg.value` for anything but ETH swaps is prohibited
90116#### Parameters:
91117| Name | Type | Description |
92118| :--- | :--- | :------------------------------------------------------------------- |
119+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
93120|` recipient ` | address payable | Address that will receive swap funds
94121|` srcToken ` | contract IERC20 | Source token
95122|` dstToken ` | contract IERC20 | Destination token
96- |` amount ` | uint256 | Amount of source tokens to swap
97- |` minReturn ` | uint256 | Minimal allowed returnAmount to make transaction commit
123+ |` inputAmount ` | uint256 | Amount of source tokens to swap
124+ |` outputAmount ` | uint256 | Amount of destination tokens to receive
125+ |` expiryWithFlags ` | uint256 | Timestamp until the swap will be valid with permit2 flag
126+ |` r ` | bytes32 | Clipper order signature (r part)
127+ |` vs ` | bytes32 | Clipper order signature (vs part)
128+
129+
130+ #### Return values
131+ | Name | Type | Description |
132+ | :--- | :--- | :------------------------------------------------------------------- |
133+ |` returnAmount ` | uint256 | Amount of destination tokens received
98134
0 commit comments