-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathISettlerActions.sol
More file actions
341 lines (310 loc) · 11.3 KB
/
ISettlerActions.sol
File metadata and controls
341 lines (310 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
interface ISettlerActions {
/// VIP actions should always start with `recipient` address and the `permit` from the taker
/// followed by all the other parameters to ensure compatibility with `executeWithPermit` entrypoint.
/// @dev Transfer funds from msg.sender Permit2.
function TRANSFER_FROM(address recipient, ISignatureTransfer.PermitTransferFrom memory permit, bytes memory sig)
external;
// @dev msgValue is interpreted as an upper bound on the expected msg.value, not as an exact specification
function NATIVE_CHECK(uint256 deadline, uint256 msgValue) external;
/// @dev Transfer funds from metatransaction requestor into the Settler contract using Permit2. Only for use in `Settler.executeMetaTxn` where the signature is provided as calldata
function METATXN_TRANSFER_FROM(address recipient, ISignatureTransfer.PermitTransferFrom memory permit) external;
/// @dev Settle an RfqOrder between maker and taker transfering funds directly between the parties
// Post-req: Payout if recipient != taker
function RFQ_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory takerPermit,
ISignatureTransfer.PermitTransferFrom memory makerPermit,
address maker,
bytes memory makerSig,
bytes memory takerSig
) external;
/// @dev Settle an RfqOrder between maker and taker transfering funds directly between the parties for the entire amount
function METATXN_RFQ_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory takerPermit,
ISignatureTransfer.PermitTransferFrom memory makerPermit,
address maker,
bytes memory makerSig
) external;
/// @dev Settle an RfqOrder between Maker and Settler. Transfering funds from the Settler contract to maker.
/// Retaining funds in the settler contract.
// Pre-req: Funded
// Post-req: Payout
function RFQ(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
address maker,
bytes memory makerSig,
address takerToken,
uint256 maxTakerAmount
) external;
function UNISWAPV4(
address recipient,
address sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function UNISWAPV4_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
bytes memory sig,
uint256 amountOutMin
) external;
function METATXN_UNISWAPV4_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function BALANCERV3(
address recipient,
address sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function BALANCERV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
bytes memory sig,
uint256 amountOutMin
) external;
function METATXN_BALANCERV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function PANCAKE_INFINITY(
address recipient,
address sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function PANCAKE_INFINITY_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
bytes memory sig,
uint256 amountOutMin
) external;
function METATXN_PANCAKE_INFINITY_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
/// @dev Trades against UniswapV3 using the contracts balance for funding
// Pre-req: Funded
// Post-req: Payout
function UNISWAPV3(address recipient, uint256 bps, bytes memory path, uint256 amountOutMin) external;
/// @dev Trades against UniswapV3 using user funds via Permit2 for funding
function UNISWAPV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes memory path,
bytes memory sig,
uint256 amountOutMin
) external;
/// @dev Trades against UniswapV3 using user funds via Permit2 for funding. Metatransaction variant. Signature is over all actions.
function METATXN_UNISWAPV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes memory path,
uint256 amountOutMin
) external;
function MAKERPSM(address recipient, uint256 bps, bool buyGem, uint256 amountOutMin, address psm, address dai)
external;
function CURVE_TRICRYPTO_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
uint80 poolInfo,
bytes memory sig,
uint256 minBuyAmount
) external;
function METATXN_CURVE_TRICRYPTO_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
uint80 poolInfo,
uint256 minBuyAmount
) external;
function DODOV1(address sellToken, uint256 bps, address pool, bool quoteForBase, uint256 minBuyAmount) external;
function DODOV2(
address recipient,
address sellToken,
uint256 bps,
address pool,
bool quoteForBase,
uint256 minBuyAmount
) external;
function VELODROME(address recipient, uint256 bps, address pool, uint24 swapInfo, uint256 minBuyAmount) external;
/// @dev Trades against MaverickV2 using the contracts balance for funding
/// This action does not use the MaverickV2 callback, so it takes an arbitrary pool address to make calls against.
/// Passing `tokenAIn` as a parameter actually saves gas relative to introspecting the pool's `tokenA()` accessor.
function MAVERICKV2(
address recipient,
address sellToken,
uint256 bps,
address pool,
bool tokenAIn,
int32 tickLimit,
uint256 minBuyAmount
) external;
/// @dev Trades against MaverickV2, spending the taker's coupon inside the callback
/// This action requires the use of the MaverickV2 callback, so we take the MaverickV2 CREATE2 salt as an argument to derive the pool address from the trusted factory and inithash.
/// @param salt is formed as `keccak256(abi.encode(feeAIn, feeBIn, tickSpacing, lookback, tokenA, tokenB, kinds, address(0)))`
function MAVERICKV2_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes32 salt,
bool tokenAIn,
bytes memory sig,
int32 tickLimit,
uint256 minBuyAmount
) external;
/// @dev Trades against MaverickV2, spending the taker's coupon inside the callback; metatransaction variant
function METATXN_MAVERICKV2_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bytes32 salt,
bool tokenAIn,
int32 tickLimit,
uint256 minBuyAmount
) external;
/// @dev Trades against UniswapV2 using the contracts balance for funding
/// @param swapInfo is encoded as the upper 16 bits as the fee of the pool in bps, the second
/// lowest bit as "sell token has transfer fee", and the lowest bit as the
/// "token0 for token1" flag.
function UNISWAPV2(
address recipient,
address sellToken,
uint256 bps,
address pool,
uint24 swapInfo,
uint256 amountOutMin
) external;
function POSITIVE_SLIPPAGE(address payable recipient, address token, uint256 expectedAmount, uint256 maxBps)
external;
/// @dev Trades against a basic AMM which follows the approval, transferFrom(msg.sender) interaction
// Pre-req: Funded
// Post-req: Payout
function BASIC(address sellToken, uint256 bps, address pool, uint256 offset, bytes calldata data) external;
function EKUBO(
address recipient,
address sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function EKUBOV3(
address recipient,
address sellToken,
uint256 bps,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function EKUBOV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
bytes memory sig,
uint256 amountOutMin
) external;
function METATXN_EKUBOV3_VIP(
address recipient,
ISignatureTransfer.PermitTransferFrom memory permit,
bool feeOnTransfer,
uint256 hashMul,
uint256 hashMod,
bytes memory fills,
uint256 amountOutMin
) external;
function EULERSWAP(
address recipient,
address sellToken,
uint256 bps,
address pool,
bool zeroForOne,
uint256 amountOutMin
) external;
function RENEGADE(address target, address baseToken, bytes memory data) external;
struct BebopMakerSignature {
bytes signatureBytes;
uint256 flags;
}
struct BebopOrder {
uint256 expiry;
address maker_address;
uint256 maker_nonce;
address maker_token;
uint256 taker_amount;
uint256 maker_amount;
// the high 5 bits are unused
// the next 3 bits are the `takerHasNative`, `makerHasNative`, and
// `takerUsingPermit2` flags (in that order from high to low) from the
// original `packed_commands` field
// the next 120 bits are unused
// the low 128 bits are the `event_id` from the original `flags` field
uint256 event_id_and_flags;
}
function BEBOP(
address recipient,
address sellToken,
BebopOrder memory order,
BebopMakerSignature memory makerSignature,
uint256 amountOutMin
) external;
function HANJI(
address sellToken,
uint256 bps,
address pool,
uint256 sellScalingFactor,
uint256 buyScalingFactor,
bool isAsk,
uint256 priceLimit,
uint256 minBuyAmount
) external;
}