@@ -6,82 +6,108 @@ Clipper router that allows to use `ClipperExchangeInterface` for swaps
6
6
7
7
8
8
## Derives
9
- - [ Permitable] ( helpers/Permitable.md )
10
9
- [ EthReceiver] ( helpers/EthReceiver.md )
11
10
12
11
## Functions
13
12
### constructor
14
13
``` solidity
15
- function constructor(
16
- address weth,
17
- contract IClipperExchangeInterface clipperExchange
18
- ) public
14
+ function constructor(contract IWETH weth)
19
15
```
20
16
21
17
22
18
#### Parameters:
23
19
| Name | Type | Description |
24
20
| :--- | :--- | :------------------------------------------------------------------- |
25
- | ` weth ` | address |
26
- | ` clipperExchange ` | contract IClipperExchangeInterface |
21
+ | ` weth ` | contract IWETH |
27
22
28
23
29
24
### clipperSwapToWithPermit
30
25
``` solidity
31
26
function 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)
39
38
```
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.
42
40
43
41
44
42
#### Parameters:
45
43
| Name | Type | Description |
46
44
| :--- | :--- | :------------------------------------------------------------------- |
45
+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
47
46
|` recipient ` | address payable | Address that will receive swap funds
48
47
|` srcToken ` | contract IERC20 | Source token
49
48
|` 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)
52
54
|` permit ` | bytes | Should contain valid permit that can be used in ` IERC20Permit.permit ` calls. See tests for examples
53
55
54
56
57
+ #### Return values
58
+ | Name | Type | Description |
59
+ | :--- | :--- | :------------------------------------------------------------------- |
60
+ |` returnAmount ` | uint256 | Amount of destination tokens received
61
+
62
+
55
63
### clipperSwap
56
64
``` solidity
57
65
function 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)
63
75
```
64
76
Same as ` clipperSwapTo ` but uses ` msg.sender ` as recipient
65
77
66
78
67
79
#### Parameters:
68
80
| Name | Type | Description |
69
81
| :--- | :--- | :------------------------------------------------------------------- |
82
+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
70
83
|` srcToken ` | contract IERC20 | Source token
71
84
|` 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
74
96
75
97
76
98
### clipperSwapTo
77
99
``` solidity
78
100
function 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)
85
111
```
86
112
Performs swap using Clipper exchange. Wraps and unwraps ETH if required.
87
113
Sending 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
90
116
#### Parameters:
91
117
| Name | Type | Description |
92
118
| :--- | :--- | :------------------------------------------------------------------- |
119
+ |` clipperExchange ` | contract IClipperExchangeInterface | Clipper pool address
93
120
|` recipient ` | address payable | Address that will receive swap funds
94
121
|` srcToken ` | contract IERC20 | Source token
95
122
|` 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
98
134
0 commit comments