@morpho-org/bundler-sdk-viem 3.0.0-next.1 → 3.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActionBundle.d.ts +35 -0
- package/lib/ActionBundle.js +28 -0
- package/lib/BundlerAction.d.ts +78 -44
- package/lib/BundlerAction.js +146 -119
- package/lib/actions.d.ts +6 -8
- package/lib/actions.js +129 -84
- package/lib/bundle.d.ts +12 -0
- package/lib/bundle.js +11 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/operations.js +6 -5
- package/lib/types/actions.d.ts +102 -46
- package/lib/types/operations.d.ts +1 -1
- package/lib/types/operations.js +1 -0
- package/package.json +12 -12
package/lib/BundlerAction.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, universalRewardsDistributorAbi, } from "./abis.js";
|
|
2
2
|
import { getChainAddresses, } from "@morpho-org/blue-sdk";
|
|
3
3
|
import { blueAbi, erc2612Abi, permit2Abi, publicAllocatorAbi, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
-
import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature,
|
|
4
|
+
import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
|
|
5
5
|
import { BundlerErrors } from "./errors.js";
|
|
6
|
-
const
|
|
6
|
+
const reenterAbiInputs = bundler3Abi.find((item) => item.name === "reenter").inputs;
|
|
7
7
|
/**
|
|
8
|
-
* Namespace to easily encode calls to the Bundler contract, using
|
|
8
|
+
* Namespace to easily encode calls to the Bundler contract, using viem.
|
|
9
9
|
*/
|
|
10
10
|
export var BundlerAction;
|
|
11
11
|
(function (BundlerAction) {
|
|
12
12
|
function encodeBundle(chainId, actions) {
|
|
13
13
|
const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
|
|
14
14
|
let value = 0n;
|
|
15
|
-
let generalAdapter1Value = 0n;
|
|
16
15
|
for (const { type, args } of actions) {
|
|
17
16
|
if (type !== "nativeTransfer")
|
|
18
17
|
continue;
|
|
@@ -21,18 +20,8 @@ export var BundlerAction;
|
|
|
21
20
|
owner !== generalAdapter1 &&
|
|
22
21
|
(recipient === bundler3 || recipient === generalAdapter1))
|
|
23
22
|
value += amount;
|
|
24
|
-
if (owner !== generalAdapter1 && recipient === generalAdapter1)
|
|
25
|
-
generalAdapter1Value += amount;
|
|
26
23
|
}
|
|
27
24
|
const encodedActions = actions.flatMap(BundlerAction.encode.bind(null, chainId));
|
|
28
|
-
if (generalAdapter1Value > 0n)
|
|
29
|
-
encodedActions.unshift({
|
|
30
|
-
to: generalAdapter1,
|
|
31
|
-
value: generalAdapter1Value,
|
|
32
|
-
data: "0x",
|
|
33
|
-
skipRevert: false,
|
|
34
|
-
callbackHash: zeroHash,
|
|
35
|
-
});
|
|
36
25
|
return {
|
|
37
26
|
to: bundler3,
|
|
38
27
|
value,
|
|
@@ -107,19 +96,19 @@ export var BundlerAction;
|
|
|
107
96
|
return BundlerAction.morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert);
|
|
108
97
|
}
|
|
109
98
|
case "morphoSupply": {
|
|
110
|
-
const [market, assets, shares, slippageAmount, onBehalf, onMorphoSupply,] = args;
|
|
111
|
-
return BundlerAction.morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoSupply.flatMap(BundlerAction.encode.bind(null, chainId)));
|
|
99
|
+
const [market, assets, shares, slippageAmount, onBehalf, onMorphoSupply, skipRevert,] = args;
|
|
100
|
+
return BundlerAction.morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoSupply.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
|
|
112
101
|
}
|
|
113
102
|
case "morphoSupplyCollateral": {
|
|
114
|
-
const [market, amount, onBehalf, onMorphoSupplyCollateral] = args;
|
|
115
|
-
return BundlerAction.morphoSupplyCollateral(chainId, market, amount, onBehalf, onMorphoSupplyCollateral.flatMap(BundlerAction.encode.bind(null, chainId)));
|
|
103
|
+
const [market, amount, onBehalf, onMorphoSupplyCollateral, skipRevert] = args;
|
|
104
|
+
return BundlerAction.morphoSupplyCollateral(chainId, market, amount, onBehalf, onMorphoSupplyCollateral.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
|
|
116
105
|
}
|
|
117
106
|
case "morphoBorrow": {
|
|
118
107
|
return BundlerAction.morphoBorrow(chainId, ...args);
|
|
119
108
|
}
|
|
120
109
|
case "morphoRepay": {
|
|
121
|
-
const [market, assets, shares, slippageAmount, onBehalf, onMorphoRepay,] = args;
|
|
122
|
-
return BundlerAction.morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoRepay.flatMap(BundlerAction.encode.bind(null, chainId)));
|
|
110
|
+
const [market, assets, shares, slippageAmount, onBehalf, onMorphoRepay, skipRevert,] = args;
|
|
111
|
+
return BundlerAction.morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, onMorphoRepay.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
|
|
123
112
|
}
|
|
124
113
|
case "morphoWithdraw": {
|
|
125
114
|
return BundlerAction.morphoWithdraw(chainId, ...args);
|
|
@@ -178,10 +167,10 @@ export var BundlerAction;
|
|
|
178
167
|
return BundlerAction.aaveV3OptimizerWithdrawCollateral(chainId, ...args);
|
|
179
168
|
}
|
|
180
169
|
case "aaveV3OptimizerApproveManagerWithSig": {
|
|
181
|
-
const [owner, isApproved, nonce, deadline, signature, manager, skipRevert,] = args;
|
|
170
|
+
const [aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert,] = args;
|
|
182
171
|
if (signature == null)
|
|
183
172
|
throw new BundlerErrors.MissingSignature();
|
|
184
|
-
return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, owner, isApproved, nonce, deadline, signature, manager, skipRevert);
|
|
173
|
+
return BundlerAction.aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert);
|
|
185
174
|
}
|
|
186
175
|
/* CompoundV2 */
|
|
187
176
|
case "compoundV2Repay": {
|
|
@@ -214,8 +203,9 @@ export var BundlerAction;
|
|
|
214
203
|
* @param owner The owner of native tokens.
|
|
215
204
|
* @param recipient The address to send native tokens to.
|
|
216
205
|
* @param amount The amount of native tokens to send (in wei).
|
|
206
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
217
207
|
*/
|
|
218
|
-
function nativeTransfer(chainId, owner, recipient, amount) {
|
|
208
|
+
function nativeTransfer(chainId, owner, recipient, amount, skipRevert = false) {
|
|
219
209
|
const { bundler3: { bundler3, generalAdapter1 }, } = getChainAddresses(chainId);
|
|
220
210
|
if (recipient === bundler3)
|
|
221
211
|
return [];
|
|
@@ -238,7 +228,7 @@ export var BundlerAction;
|
|
|
238
228
|
to: recipient,
|
|
239
229
|
data: "0x",
|
|
240
230
|
value: amount,
|
|
241
|
-
skipRevert
|
|
231
|
+
skipRevert,
|
|
242
232
|
callbackHash: zeroHash,
|
|
243
233
|
},
|
|
244
234
|
];
|
|
@@ -250,19 +240,22 @@ export var BundlerAction;
|
|
|
250
240
|
* @param asset The address of the ERC20 token to transfer.
|
|
251
241
|
* @param recipient The address to send tokens to.
|
|
252
242
|
* @param amount The amount of tokens to send.
|
|
243
|
+
* @param adapter The address of the adapter to use. Defaults to the chain's bundler3 general adapter.
|
|
244
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
253
245
|
*/
|
|
254
|
-
function erc20Transfer(chainId, asset, recipient, amount) {
|
|
246
|
+
function erc20Transfer(chainId, asset, recipient, amount, adapter, skipRevert = false) {
|
|
255
247
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
248
|
+
adapter ??= generalAdapter1;
|
|
256
249
|
return [
|
|
257
250
|
{
|
|
258
|
-
to:
|
|
251
|
+
to: adapter,
|
|
259
252
|
data: encodeFunctionData({
|
|
260
253
|
abi: coreAdapterAbi,
|
|
261
254
|
functionName: "erc20Transfer",
|
|
262
255
|
args: [asset, recipient, amount],
|
|
263
256
|
}),
|
|
264
257
|
value: 0n,
|
|
265
|
-
skipRevert
|
|
258
|
+
skipRevert,
|
|
266
259
|
callbackHash: zeroHash,
|
|
267
260
|
},
|
|
268
261
|
];
|
|
@@ -274,8 +267,9 @@ export var BundlerAction;
|
|
|
274
267
|
* @param asset The address of the ERC20 token to transfer.
|
|
275
268
|
* @param amount The amount of tokens to send.
|
|
276
269
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
270
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
277
271
|
*/
|
|
278
|
-
function erc20TransferFrom(chainId, asset, amount, recipient) {
|
|
272
|
+
function erc20TransferFrom(chainId, asset, amount, recipient, skipRevert = false) {
|
|
279
273
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
280
274
|
recipient ??= generalAdapter1;
|
|
281
275
|
return [
|
|
@@ -287,7 +281,7 @@ export var BundlerAction;
|
|
|
287
281
|
args: [asset, recipient, amount],
|
|
288
282
|
}),
|
|
289
283
|
value: 0n,
|
|
290
|
-
skipRevert
|
|
284
|
+
skipRevert,
|
|
291
285
|
callbackHash: zeroHash,
|
|
292
286
|
},
|
|
293
287
|
];
|
|
@@ -303,7 +297,7 @@ export var BundlerAction;
|
|
|
303
297
|
* @param deadline The timestamp until which the signature is valid.
|
|
304
298
|
* @param signature The Ethers signature to permit the tokens.
|
|
305
299
|
* @param spender The address allowed to spend the tokens.
|
|
306
|
-
* @param skipRevert Whether to allow the permit to revert without making the whole
|
|
300
|
+
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
|
|
307
301
|
*/
|
|
308
302
|
function permit(chainId, owner, asset, amount, deadline, signature, spender, skipRevert = true) {
|
|
309
303
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
@@ -333,7 +327,7 @@ export var BundlerAction;
|
|
|
333
327
|
* @param allowed The amount of DAI to permit.
|
|
334
328
|
* @param signature The Ethers signature to permit the tokens.
|
|
335
329
|
* @param spender The address allowed to spend the tokens.
|
|
336
|
-
* @param skipRevert Whether to allow the permit to revert without making the whole
|
|
330
|
+
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert.
|
|
337
331
|
*/
|
|
338
332
|
function permitDai(chainId, owner, nonce, expiry, allowed, signature, spender, skipRevert = true) {
|
|
339
333
|
const { dai, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
@@ -382,7 +376,7 @@ export var BundlerAction;
|
|
|
382
376
|
* @param owner The owner of ERC20 tokens.
|
|
383
377
|
* @param permitSingle The permit details to submit to Permit2.
|
|
384
378
|
* @param signature The Ethers signature to permit the tokens.
|
|
385
|
-
* @param skipRevert Whether to allow the permit to revert without making the whole
|
|
379
|
+
* @param skipRevert Whether to allow the permit to revert without making the whole bundle revert. Defaults to true.
|
|
386
380
|
*/
|
|
387
381
|
function approve2(chainId, owner, permitSingle, signature, skipRevert = true) {
|
|
388
382
|
const { permit2 } = getChainAddresses(chainId);
|
|
@@ -410,8 +404,9 @@ export var BundlerAction;
|
|
|
410
404
|
* @param owner The owner of ERC20 tokens.
|
|
411
405
|
* @param amount The amount of tokens to send.
|
|
412
406
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
407
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
413
408
|
*/
|
|
414
|
-
function transferFrom2(chainId, asset, owner, amount, recipient) {
|
|
409
|
+
function transferFrom2(chainId, asset, owner, amount, recipient, skipRevert = false) {
|
|
415
410
|
const { permit2, bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
416
411
|
if (permit2 == null)
|
|
417
412
|
throw new BundlerErrors.UnexpectedAction("transferFrom2", chainId);
|
|
@@ -426,7 +421,7 @@ export var BundlerAction;
|
|
|
426
421
|
args: [owner, recipient, amount, asset],
|
|
427
422
|
}),
|
|
428
423
|
value: 0n,
|
|
429
|
-
skipRevert
|
|
424
|
+
skipRevert,
|
|
430
425
|
callbackHash: zeroHash,
|
|
431
426
|
},
|
|
432
427
|
];
|
|
@@ -439,8 +434,9 @@ export var BundlerAction;
|
|
|
439
434
|
* @param wrapper The address of the ERC20 wrapper token.
|
|
440
435
|
* @param underlying The address of the underlying ERC20 token.
|
|
441
436
|
* @param amount The amount of tokens to send.
|
|
437
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
442
438
|
*/
|
|
443
|
-
function erc20WrapperDepositFor(chainId, wrapper, underlying, amount) {
|
|
439
|
+
function erc20WrapperDepositFor(chainId, wrapper, underlying, amount, skipRevert = false) {
|
|
444
440
|
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
|
|
445
441
|
if (erc20WrapperAdapter == null)
|
|
446
442
|
throw new BundlerErrors.UnexpectedAction("erc20WrapperDepositFor", chainId);
|
|
@@ -453,7 +449,7 @@ export var BundlerAction;
|
|
|
453
449
|
args: [underlying, erc20WrapperAdapter, maxUint256],
|
|
454
450
|
}),
|
|
455
451
|
value: 0n,
|
|
456
|
-
skipRevert
|
|
452
|
+
skipRevert,
|
|
457
453
|
callbackHash: zeroHash,
|
|
458
454
|
},
|
|
459
455
|
{
|
|
@@ -464,7 +460,7 @@ export var BundlerAction;
|
|
|
464
460
|
args: [wrapper, amount],
|
|
465
461
|
}),
|
|
466
462
|
value: 0n,
|
|
467
|
-
skipRevert
|
|
463
|
+
skipRevert,
|
|
468
464
|
callbackHash: zeroHash,
|
|
469
465
|
},
|
|
470
466
|
{
|
|
@@ -475,7 +471,7 @@ export var BundlerAction;
|
|
|
475
471
|
args: [underlying, generalAdapter1, maxUint256],
|
|
476
472
|
}),
|
|
477
473
|
value: 0n,
|
|
478
|
-
skipRevert
|
|
474
|
+
skipRevert,
|
|
479
475
|
callbackHash: zeroHash,
|
|
480
476
|
},
|
|
481
477
|
];
|
|
@@ -487,8 +483,9 @@ export var BundlerAction;
|
|
|
487
483
|
* @param wrapper The address of the ERC20 wrapper token.
|
|
488
484
|
* @param account The address to send the underlying ERC20 tokens.
|
|
489
485
|
* @param amount The amount of tokens to send.
|
|
486
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
490
487
|
*/
|
|
491
|
-
function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount) {
|
|
488
|
+
function erc20WrapperWithdrawTo(chainId, wrapper, receiver, amount, skipRevert = false) {
|
|
492
489
|
const { bundler3: { generalAdapter1, erc20WrapperAdapter }, } = getChainAddresses(chainId);
|
|
493
490
|
if (erc20WrapperAdapter == null)
|
|
494
491
|
throw new BundlerErrors.UnexpectedAction("erc20WrapperWithdrawTo", chainId);
|
|
@@ -501,7 +498,7 @@ export var BundlerAction;
|
|
|
501
498
|
args: [wrapper, erc20WrapperAdapter, maxUint256],
|
|
502
499
|
}),
|
|
503
500
|
value: 0n,
|
|
504
|
-
skipRevert
|
|
501
|
+
skipRevert,
|
|
505
502
|
callbackHash: zeroHash,
|
|
506
503
|
},
|
|
507
504
|
{
|
|
@@ -512,7 +509,7 @@ export var BundlerAction;
|
|
|
512
509
|
args: [wrapper, receiver, amount],
|
|
513
510
|
}),
|
|
514
511
|
value: 0n,
|
|
515
|
-
skipRevert
|
|
512
|
+
skipRevert,
|
|
516
513
|
callbackHash: zeroHash,
|
|
517
514
|
},
|
|
518
515
|
{
|
|
@@ -523,7 +520,7 @@ export var BundlerAction;
|
|
|
523
520
|
args: [wrapper, generalAdapter1, maxUint256],
|
|
524
521
|
}),
|
|
525
522
|
value: 0n,
|
|
526
|
-
skipRevert
|
|
523
|
+
skipRevert,
|
|
527
524
|
callbackHash: zeroHash,
|
|
528
525
|
},
|
|
529
526
|
];
|
|
@@ -537,8 +534,9 @@ export var BundlerAction;
|
|
|
537
534
|
* @param shares The amount of shares to mint.
|
|
538
535
|
* @param maxSharePrice The maximum amount of assets to pay to get 1 share (scaled by RAY).
|
|
539
536
|
* @param receiver The address to send the shares to.
|
|
537
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
540
538
|
*/
|
|
541
|
-
function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver) {
|
|
539
|
+
function erc4626Mint(chainId, erc4626, shares, maxSharePrice, receiver, skipRevert = false) {
|
|
542
540
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
543
541
|
return [
|
|
544
542
|
{
|
|
@@ -549,7 +547,7 @@ export var BundlerAction;
|
|
|
549
547
|
args: [erc4626, shares, maxSharePrice, receiver],
|
|
550
548
|
}),
|
|
551
549
|
value: 0n,
|
|
552
|
-
skipRevert
|
|
550
|
+
skipRevert,
|
|
553
551
|
callbackHash: zeroHash,
|
|
554
552
|
},
|
|
555
553
|
];
|
|
@@ -562,8 +560,9 @@ export var BundlerAction;
|
|
|
562
560
|
* @param assets The amount of assets to deposit.
|
|
563
561
|
* @param maxSharePrice The maximum amount of assets to pay to get 1 share (scaled by RAY).
|
|
564
562
|
* @param receiver The address to send the shares to.
|
|
563
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
565
564
|
*/
|
|
566
|
-
function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver) {
|
|
565
|
+
function erc4626Deposit(chainId, erc4626, assets, maxSharePrice, receiver, skipRevert = false) {
|
|
567
566
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
568
567
|
return [
|
|
569
568
|
{
|
|
@@ -574,7 +573,7 @@ export var BundlerAction;
|
|
|
574
573
|
args: [erc4626, assets, maxSharePrice, receiver],
|
|
575
574
|
}),
|
|
576
575
|
value: 0n,
|
|
577
|
-
skipRevert
|
|
576
|
+
skipRevert,
|
|
578
577
|
callbackHash: zeroHash,
|
|
579
578
|
},
|
|
580
579
|
];
|
|
@@ -588,8 +587,9 @@ export var BundlerAction;
|
|
|
588
587
|
* @param minSharePrice The minimum number of assets to receive per share (scaled by RAY).
|
|
589
588
|
* @param receiver The address to send the assets to.
|
|
590
589
|
* @param owner The address on behalf of which the assets are withdrawn.
|
|
590
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
591
591
|
*/
|
|
592
|
-
function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner) {
|
|
592
|
+
function erc4626Withdraw(chainId, erc4626, assets, minSharePrice, receiver, owner, skipRevert = false) {
|
|
593
593
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
594
594
|
return [
|
|
595
595
|
{
|
|
@@ -600,7 +600,7 @@ export var BundlerAction;
|
|
|
600
600
|
args: [erc4626, assets, minSharePrice, receiver, owner],
|
|
601
601
|
}),
|
|
602
602
|
value: 0n,
|
|
603
|
-
skipRevert
|
|
603
|
+
skipRevert,
|
|
604
604
|
callbackHash: zeroHash,
|
|
605
605
|
},
|
|
606
606
|
];
|
|
@@ -614,8 +614,9 @@ export var BundlerAction;
|
|
|
614
614
|
* @param minSharePrice The minimum number of assets to receive per share (scaled by RAY).
|
|
615
615
|
* @param receiver The address to send the assets to.
|
|
616
616
|
* @param owner The address on behalf of which the assets are withdrawn.
|
|
617
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
617
618
|
*/
|
|
618
|
-
function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner) {
|
|
619
|
+
function erc4626Redeem(chainId, erc4626, shares, minSharePrice, receiver, owner, skipRevert = false) {
|
|
619
620
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
620
621
|
return [
|
|
621
622
|
{
|
|
@@ -626,7 +627,7 @@ export var BundlerAction;
|
|
|
626
627
|
args: [erc4626, shares, minSharePrice, receiver, owner],
|
|
627
628
|
}),
|
|
628
629
|
value: 0n,
|
|
629
|
-
skipRevert
|
|
630
|
+
skipRevert,
|
|
630
631
|
callbackHash: zeroHash,
|
|
631
632
|
},
|
|
632
633
|
];
|
|
@@ -638,7 +639,7 @@ export var BundlerAction;
|
|
|
638
639
|
* @param chainId The chain id for which to encode the call.
|
|
639
640
|
* @param authorization The authorization details to submit to Morpho Blue.
|
|
640
641
|
* @param signature The Ethers signature to authorize the account.
|
|
641
|
-
* @param skipRevert Whether to allow the authorization call to revert without making the whole
|
|
642
|
+
* @param skipRevert Whether to allow the authorization call to revert without making the whole bundle revert. Defaults to true.
|
|
642
643
|
*/
|
|
643
644
|
function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
|
|
644
645
|
const { morpho } = getChainAddresses(chainId);
|
|
@@ -667,12 +668,13 @@ export var BundlerAction;
|
|
|
667
668
|
* @param slippageAmount The maximum (resp. minimum) amount of assets (resp. supply shares) to supply (resp. mint) (protects the sender from unexpected slippage).
|
|
668
669
|
* @param onBehalf The address to supply on behalf of.
|
|
669
670
|
* @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
|
|
671
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
670
672
|
*/
|
|
671
|
-
function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls) {
|
|
673
|
+
function morphoSupply(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
|
|
672
674
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
673
675
|
const reenter = callbackCalls.length > 0;
|
|
674
676
|
const reenterData = reenter
|
|
675
|
-
? encodeAbiParameters(
|
|
677
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
676
678
|
: "0x";
|
|
677
679
|
return [
|
|
678
680
|
{
|
|
@@ -683,7 +685,7 @@ export var BundlerAction;
|
|
|
683
685
|
args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
|
|
684
686
|
}),
|
|
685
687
|
value: 0n,
|
|
686
|
-
skipRevert
|
|
688
|
+
skipRevert,
|
|
687
689
|
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
688
690
|
},
|
|
689
691
|
];
|
|
@@ -696,12 +698,13 @@ export var BundlerAction;
|
|
|
696
698
|
* @param assets The amount of assets to supply.
|
|
697
699
|
* @param onBehalf The address to supply on behalf of.
|
|
698
700
|
* @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupplyCollateral` callback.
|
|
701
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
699
702
|
*/
|
|
700
|
-
function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls) {
|
|
703
|
+
function morphoSupplyCollateral(chainId, market, assets, onBehalf, callbackCalls, skipRevert = false) {
|
|
701
704
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
702
705
|
const reenter = callbackCalls.length > 0;
|
|
703
706
|
const reenterData = reenter
|
|
704
|
-
? encodeAbiParameters(
|
|
707
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
705
708
|
: "0x";
|
|
706
709
|
return [
|
|
707
710
|
{
|
|
@@ -712,7 +715,7 @@ export var BundlerAction;
|
|
|
712
715
|
args: [market, assets, onBehalf, reenterData],
|
|
713
716
|
}),
|
|
714
717
|
value: 0n,
|
|
715
|
-
skipRevert
|
|
718
|
+
skipRevert,
|
|
716
719
|
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
717
720
|
},
|
|
718
721
|
];
|
|
@@ -726,8 +729,9 @@ export var BundlerAction;
|
|
|
726
729
|
* @param shares The amount of borrow shares to mint.
|
|
727
730
|
* @param slippageAmount The minimum (resp. maximum) amount of assets (resp. borrow shares) to borrow (resp. mint) (protects the sender from unexpected slippage).
|
|
728
731
|
* @param receiver The address to send borrowed tokens to.
|
|
732
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
729
733
|
*/
|
|
730
|
-
function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver) {
|
|
734
|
+
function morphoBorrow(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
|
|
731
735
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
732
736
|
return [
|
|
733
737
|
{
|
|
@@ -738,7 +742,7 @@ export var BundlerAction;
|
|
|
738
742
|
args: [market, assets, shares, slippageAmount, receiver],
|
|
739
743
|
}),
|
|
740
744
|
value: 0n,
|
|
741
|
-
skipRevert
|
|
745
|
+
skipRevert,
|
|
742
746
|
callbackHash: zeroHash,
|
|
743
747
|
},
|
|
744
748
|
];
|
|
@@ -753,12 +757,13 @@ export var BundlerAction;
|
|
|
753
757
|
* @param slippageAmount The maximum (resp. minimum) amount of assets (resp. borrow shares) to repay (resp. redeem) (protects the sender from unexpected slippage).
|
|
754
758
|
* @param onBehalf The address to repay on behalf of.
|
|
755
759
|
* @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoSupply` callback.
|
|
760
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
756
761
|
*/
|
|
757
|
-
function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls) {
|
|
762
|
+
function morphoRepay(chainId, market, assets, shares, slippageAmount, onBehalf, callbackCalls, skipRevert = false) {
|
|
758
763
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
759
764
|
const reenter = callbackCalls.length > 0;
|
|
760
765
|
const reenterData = reenter
|
|
761
|
-
? encodeAbiParameters(
|
|
766
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
762
767
|
: "0x";
|
|
763
768
|
return [
|
|
764
769
|
{
|
|
@@ -769,7 +774,7 @@ export var BundlerAction;
|
|
|
769
774
|
args: [market, assets, shares, slippageAmount, onBehalf, reenterData],
|
|
770
775
|
}),
|
|
771
776
|
value: 0n,
|
|
772
|
-
skipRevert
|
|
777
|
+
skipRevert,
|
|
773
778
|
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
774
779
|
},
|
|
775
780
|
];
|
|
@@ -783,8 +788,9 @@ export var BundlerAction;
|
|
|
783
788
|
* @param shares The amount of supply shares to redeem.
|
|
784
789
|
* @param slippageAmount The minimum (resp. maximum) amount of assets (resp. supply shares) to withdraw (resp. redeem) (protects the sender from unexpected slippage).
|
|
785
790
|
* @param receiver The address to send withdrawn tokens to.
|
|
791
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
786
792
|
*/
|
|
787
|
-
function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver) {
|
|
793
|
+
function morphoWithdraw(chainId, market, assets, shares, slippageAmount, receiver, skipRevert = false) {
|
|
788
794
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
789
795
|
return [
|
|
790
796
|
{
|
|
@@ -795,7 +801,7 @@ export var BundlerAction;
|
|
|
795
801
|
args: [market, assets, shares, slippageAmount, receiver],
|
|
796
802
|
}),
|
|
797
803
|
value: 0n,
|
|
798
|
-
skipRevert
|
|
804
|
+
skipRevert,
|
|
799
805
|
callbackHash: zeroHash,
|
|
800
806
|
},
|
|
801
807
|
];
|
|
@@ -807,8 +813,9 @@ export var BundlerAction;
|
|
|
807
813
|
* @param market The market params to withdraw from.
|
|
808
814
|
* @param assets The amount of assets to withdraw.
|
|
809
815
|
* @param receiver The address to send withdrawn tokens to.
|
|
816
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
810
817
|
*/
|
|
811
|
-
function morphoWithdrawCollateral(chainId, market, assets, receiver) {
|
|
818
|
+
function morphoWithdrawCollateral(chainId, market, assets, receiver, skipRevert = false) {
|
|
812
819
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
813
820
|
return [
|
|
814
821
|
{
|
|
@@ -819,7 +826,7 @@ export var BundlerAction;
|
|
|
819
826
|
args: [market, assets, receiver],
|
|
820
827
|
}),
|
|
821
828
|
value: 0n,
|
|
822
|
-
skipRevert
|
|
829
|
+
skipRevert,
|
|
823
830
|
callbackHash: zeroHash,
|
|
824
831
|
},
|
|
825
832
|
];
|
|
@@ -831,9 +838,14 @@ export var BundlerAction;
|
|
|
831
838
|
* @param asset The address of the ERC20 token to flash loan.
|
|
832
839
|
* @param amount The amount of tokens to flash loan.
|
|
833
840
|
* @param callbackCalls The array of calls to execute inside Morpho Blue's `onMorphoFlashLoan` callback.
|
|
841
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
834
842
|
*/
|
|
835
|
-
function morphoFlashLoan(chainId, asset, amount, callbackCalls) {
|
|
843
|
+
function morphoFlashLoan(chainId, asset, amount, callbackCalls, skipRevert = false) {
|
|
836
844
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
845
|
+
const reenter = callbackCalls.length > 0;
|
|
846
|
+
const reenterData = reenter
|
|
847
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
848
|
+
: "0x";
|
|
837
849
|
return [
|
|
838
850
|
{
|
|
839
851
|
to: generalAdapter1,
|
|
@@ -851,8 +863,8 @@ export var BundlerAction;
|
|
|
851
863
|
],
|
|
852
864
|
}),
|
|
853
865
|
value: 0n,
|
|
854
|
-
skipRevert
|
|
855
|
-
callbackHash: keccak256(
|
|
866
|
+
skipRevert,
|
|
867
|
+
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
856
868
|
},
|
|
857
869
|
];
|
|
858
870
|
}
|
|
@@ -864,9 +876,12 @@ export var BundlerAction;
|
|
|
864
876
|
* @param fee The vault public reallocation fee.
|
|
865
877
|
* @param withdrawals The array of withdrawals to perform, before supplying everything to the supply market.
|
|
866
878
|
* @param supplyMarketParams The market params to reallocate to.
|
|
879
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
867
880
|
*/
|
|
868
|
-
function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams) {
|
|
881
|
+
function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
|
|
869
882
|
const { publicAllocator } = getChainAddresses(chainId);
|
|
883
|
+
if (publicAllocator == null)
|
|
884
|
+
throw new BundlerErrors.UnexpectedAction("reallocateTo", chainId);
|
|
870
885
|
return [
|
|
871
886
|
{
|
|
872
887
|
to: publicAllocator,
|
|
@@ -876,7 +891,7 @@ export var BundlerAction;
|
|
|
876
891
|
args: [vault, withdrawals, supplyMarketParams],
|
|
877
892
|
}),
|
|
878
893
|
value: fee,
|
|
879
|
-
skipRevert
|
|
894
|
+
skipRevert,
|
|
880
895
|
callbackHash: zeroHash,
|
|
881
896
|
},
|
|
882
897
|
];
|
|
@@ -891,7 +906,7 @@ export var BundlerAction;
|
|
|
891
906
|
* @param reward The address of the reward token to claim.
|
|
892
907
|
* @param amount The amount of rewards to claim.
|
|
893
908
|
* @param proof The Merkle proof to claim the rewards.
|
|
894
|
-
* @param skipRevert Whether to allow the claim to revert without making the whole
|
|
909
|
+
* @param skipRevert Whether to allow the claim to revert without making the whole bundle revert. Defaults to true.
|
|
895
910
|
*/
|
|
896
911
|
function urdClaim(distributor, account, reward, amount, proof, skipRevert = true) {
|
|
897
912
|
return [
|
|
@@ -915,8 +930,9 @@ export var BundlerAction;
|
|
|
915
930
|
* @param chainId The chain id for which to encode the call.
|
|
916
931
|
* @param amount The amount of native tokens to wrap (in wei).
|
|
917
932
|
* @param recipient The address to send tokens to. Defaults to the chain's bundler3 general adapter.
|
|
933
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
918
934
|
*/
|
|
919
|
-
function wrapNative(chainId, amount, recipient) {
|
|
935
|
+
function wrapNative(chainId, amount, recipient, skipRevert = false) {
|
|
920
936
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
921
937
|
recipient ??= generalAdapter1;
|
|
922
938
|
return [
|
|
@@ -928,7 +944,7 @@ export var BundlerAction;
|
|
|
928
944
|
args: [amount, recipient],
|
|
929
945
|
}),
|
|
930
946
|
value: 0n,
|
|
931
|
-
skipRevert
|
|
947
|
+
skipRevert,
|
|
932
948
|
callbackHash: zeroHash,
|
|
933
949
|
},
|
|
934
950
|
];
|
|
@@ -939,8 +955,9 @@ export var BundlerAction;
|
|
|
939
955
|
* @param chainId The chain id for which to encode the call.
|
|
940
956
|
* @param amount The amount of native tokens to unwrap (in wei).
|
|
941
957
|
* @param recipient The address to send tokens to. Defaults to the chain's bundler3 general adapter.
|
|
958
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
942
959
|
*/
|
|
943
|
-
function unwrapNative(chainId, amount, recipient) {
|
|
960
|
+
function unwrapNative(chainId, amount, recipient, skipRevert = false) {
|
|
944
961
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
945
962
|
recipient ??= generalAdapter1;
|
|
946
963
|
return [
|
|
@@ -952,7 +969,7 @@ export var BundlerAction;
|
|
|
952
969
|
args: [amount, recipient],
|
|
953
970
|
}),
|
|
954
971
|
value: 0n,
|
|
955
|
-
skipRevert
|
|
972
|
+
skipRevert,
|
|
956
973
|
callbackHash: zeroHash,
|
|
957
974
|
},
|
|
958
975
|
];
|
|
@@ -966,8 +983,9 @@ export var BundlerAction;
|
|
|
966
983
|
* @param maxSharePrice The maximum amount of wei to pay for minting 1 share (scaled by RAY).
|
|
967
984
|
* @param referral The referral address to use.
|
|
968
985
|
* @param recipient The address to send stETH to. Defaults to the chain's bundler3 general adapter.
|
|
986
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
969
987
|
*/
|
|
970
|
-
function stakeEth(chainId, amount, maxSharePrice, referral, recipient) {
|
|
988
|
+
function stakeEth(chainId, amount, maxSharePrice, referral, recipient, skipRevert = false) {
|
|
971
989
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
972
990
|
recipient ??= generalAdapter1;
|
|
973
991
|
return [
|
|
@@ -979,7 +997,7 @@ export var BundlerAction;
|
|
|
979
997
|
args: [amount, maxSharePrice, referral, recipient],
|
|
980
998
|
}),
|
|
981
999
|
value: 0n,
|
|
982
|
-
skipRevert
|
|
1000
|
+
skipRevert,
|
|
983
1001
|
callbackHash: zeroHash,
|
|
984
1002
|
},
|
|
985
1003
|
];
|
|
@@ -991,8 +1009,9 @@ export var BundlerAction;
|
|
|
991
1009
|
* @param chainId The chain id for which to encode the call.
|
|
992
1010
|
* @param amount The amount of stETH to wrap (in wei).
|
|
993
1011
|
* @param recipient The address to send wstETH to. Defaults to the chain's bundler3 general adapter.
|
|
1012
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
994
1013
|
*/
|
|
995
|
-
function wrapStEth(chainId, amount, recipient) {
|
|
1014
|
+
function wrapStEth(chainId, amount, recipient, skipRevert = false) {
|
|
996
1015
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
997
1016
|
recipient ??= generalAdapter1;
|
|
998
1017
|
return [
|
|
@@ -1004,7 +1023,7 @@ export var BundlerAction;
|
|
|
1004
1023
|
args: [amount, recipient],
|
|
1005
1024
|
}),
|
|
1006
1025
|
value: 0n,
|
|
1007
|
-
skipRevert
|
|
1026
|
+
skipRevert,
|
|
1008
1027
|
callbackHash: zeroHash,
|
|
1009
1028
|
},
|
|
1010
1029
|
];
|
|
@@ -1015,8 +1034,9 @@ export var BundlerAction;
|
|
|
1015
1034
|
* @param chainId The chain id for which to encode the call.
|
|
1016
1035
|
* @param amount The amount of wstETH to unwrap (in wei).
|
|
1017
1036
|
* @param recipient The address to send stETH to. Defaults to the chain's bundler3 general adapter.
|
|
1037
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1018
1038
|
*/
|
|
1019
|
-
function unwrapStEth(chainId, amount, recipient) {
|
|
1039
|
+
function unwrapStEth(chainId, amount, recipient, skipRevert = false) {
|
|
1020
1040
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
1021
1041
|
recipient ??= generalAdapter1;
|
|
1022
1042
|
return [
|
|
@@ -1028,7 +1048,7 @@ export var BundlerAction;
|
|
|
1028
1048
|
args: [amount, recipient],
|
|
1029
1049
|
}),
|
|
1030
1050
|
value: 0n,
|
|
1031
|
-
skipRevert
|
|
1051
|
+
skipRevert,
|
|
1032
1052
|
callbackHash: zeroHash,
|
|
1033
1053
|
},
|
|
1034
1054
|
];
|
|
@@ -1042,8 +1062,9 @@ export var BundlerAction;
|
|
|
1042
1062
|
* @param amount The amount of debt to repay.
|
|
1043
1063
|
* @param onBehalf The address on behalf of which to repay.
|
|
1044
1064
|
* @param rateMode The interest rate mode used by the debt to repay.
|
|
1065
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1045
1066
|
*/
|
|
1046
|
-
function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n) {
|
|
1067
|
+
function aaveV2Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
|
|
1047
1068
|
const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1048
1069
|
if (aaveV2MigrationAdapter == null)
|
|
1049
1070
|
throw new BundlerErrors.UnexpectedAction("aaveV2Repay", chainId);
|
|
@@ -1056,7 +1077,7 @@ export var BundlerAction;
|
|
|
1056
1077
|
args: [asset, amount, rateMode, onBehalf],
|
|
1057
1078
|
}),
|
|
1058
1079
|
value: 0n,
|
|
1059
|
-
skipRevert
|
|
1080
|
+
skipRevert,
|
|
1060
1081
|
callbackHash: zeroHash,
|
|
1061
1082
|
},
|
|
1062
1083
|
];
|
|
@@ -1068,8 +1089,9 @@ export var BundlerAction;
|
|
|
1068
1089
|
* @param asset The asset to withdraw.
|
|
1069
1090
|
* @param amount The amount of asset to withdraw.
|
|
1070
1091
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1092
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1071
1093
|
*/
|
|
1072
|
-
function aaveV2Withdraw(chainId, asset, amount, recipient) {
|
|
1094
|
+
function aaveV2Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
|
|
1073
1095
|
const { bundler3: { aaveV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1074
1096
|
if (aaveV2MigrationAdapter == null)
|
|
1075
1097
|
throw new BundlerErrors.UnexpectedAction("aaveV2Withdraw", chainId);
|
|
@@ -1083,7 +1105,7 @@ export var BundlerAction;
|
|
|
1083
1105
|
args: [asset, amount, recipient],
|
|
1084
1106
|
}),
|
|
1085
1107
|
value: 0n,
|
|
1086
|
-
skipRevert
|
|
1108
|
+
skipRevert,
|
|
1087
1109
|
callbackHash: zeroHash,
|
|
1088
1110
|
},
|
|
1089
1111
|
];
|
|
@@ -1097,8 +1119,9 @@ export var BundlerAction;
|
|
|
1097
1119
|
* @param amount The amount of debt to repay.
|
|
1098
1120
|
* @param onBehalf The address on behalf of which to repay.
|
|
1099
1121
|
* @param rateMode The interest rate mode used by the debt to repay.
|
|
1122
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1100
1123
|
*/
|
|
1101
|
-
function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n) {
|
|
1124
|
+
function aaveV3Repay(chainId, asset, amount, onBehalf, rateMode = 1n, skipRevert = false) {
|
|
1102
1125
|
const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
|
|
1103
1126
|
} = getChainAddresses(chainId);
|
|
1104
1127
|
if (aaveV3CoreMigrationAdapter == null)
|
|
@@ -1112,7 +1135,7 @@ export var BundlerAction;
|
|
|
1112
1135
|
args: [asset, amount, rateMode, onBehalf],
|
|
1113
1136
|
}),
|
|
1114
1137
|
value: 0n,
|
|
1115
|
-
skipRevert
|
|
1138
|
+
skipRevert,
|
|
1116
1139
|
callbackHash: zeroHash,
|
|
1117
1140
|
},
|
|
1118
1141
|
];
|
|
@@ -1124,8 +1147,9 @@ export var BundlerAction;
|
|
|
1124
1147
|
* @param asset The asset to withdraw.
|
|
1125
1148
|
* @param amount The amount of asset to withdraw.
|
|
1126
1149
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1150
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1127
1151
|
*/
|
|
1128
|
-
function aaveV3Withdraw(chainId, asset, amount, recipient) {
|
|
1152
|
+
function aaveV3Withdraw(chainId, asset, amount, recipient, skipRevert = false) {
|
|
1129
1153
|
const { bundler3: { aaveV3CoreMigrationAdapter }, // TODO: choose between core & prime
|
|
1130
1154
|
} = getChainAddresses(chainId);
|
|
1131
1155
|
if (aaveV3CoreMigrationAdapter == null)
|
|
@@ -1140,7 +1164,7 @@ export var BundlerAction;
|
|
|
1140
1164
|
args: [asset, amount, recipient],
|
|
1141
1165
|
}),
|
|
1142
1166
|
value: 0n,
|
|
1143
|
-
skipRevert
|
|
1167
|
+
skipRevert,
|
|
1144
1168
|
callbackHash: zeroHash,
|
|
1145
1169
|
},
|
|
1146
1170
|
];
|
|
@@ -1153,8 +1177,9 @@ export var BundlerAction;
|
|
|
1153
1177
|
* @param underlying The underlying debt asset to repay.
|
|
1154
1178
|
* @param amount The amount of debt to repay.
|
|
1155
1179
|
* @param onBehalf The address on behalf of which to repay.
|
|
1180
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1156
1181
|
*/
|
|
1157
|
-
function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf) {
|
|
1182
|
+
function aaveV3OptimizerRepay(chainId, underlying, amount, onBehalf, skipRevert = false) {
|
|
1158
1183
|
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1159
1184
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1160
1185
|
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerRepay", chainId);
|
|
@@ -1167,7 +1192,7 @@ export var BundlerAction;
|
|
|
1167
1192
|
args: [underlying, amount, onBehalf],
|
|
1168
1193
|
}),
|
|
1169
1194
|
value: 0n,
|
|
1170
|
-
skipRevert
|
|
1195
|
+
skipRevert,
|
|
1171
1196
|
callbackHash: zeroHash,
|
|
1172
1197
|
},
|
|
1173
1198
|
];
|
|
@@ -1180,8 +1205,9 @@ export var BundlerAction;
|
|
|
1180
1205
|
* @param amount The amount to withdraw.
|
|
1181
1206
|
* @param maxIterations The maximum amount of iterations to use for the withdrawal.
|
|
1182
1207
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1208
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1183
1209
|
*/
|
|
1184
|
-
function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient) {
|
|
1210
|
+
function aaveV3OptimizerWithdraw(chainId, underlying, amount, maxIterations, recipient, skipRevert = false) {
|
|
1185
1211
|
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1186
1212
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1187
1213
|
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdraw", chainId);
|
|
@@ -1195,7 +1221,7 @@ export var BundlerAction;
|
|
|
1195
1221
|
args: [underlying, amount, maxIterations, recipient],
|
|
1196
1222
|
}),
|
|
1197
1223
|
value: 0n,
|
|
1198
|
-
skipRevert
|
|
1224
|
+
skipRevert,
|
|
1199
1225
|
callbackHash: zeroHash,
|
|
1200
1226
|
},
|
|
1201
1227
|
];
|
|
@@ -1207,8 +1233,9 @@ export var BundlerAction;
|
|
|
1207
1233
|
* @param underlying The underlying asset to withdraw.
|
|
1208
1234
|
* @param amount The amount to withdraw.
|
|
1209
1235
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1236
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1210
1237
|
*/
|
|
1211
|
-
function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient) {
|
|
1238
|
+
function aaveV3OptimizerWithdrawCollateral(chainId, underlying, amount, recipient, skipRevert = false) {
|
|
1212
1239
|
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1213
1240
|
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1214
1241
|
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerWithdrawCollateral", chainId);
|
|
@@ -1222,7 +1249,7 @@ export var BundlerAction;
|
|
|
1222
1249
|
args: [underlying, amount, recipient],
|
|
1223
1250
|
}),
|
|
1224
1251
|
value: 0n,
|
|
1225
|
-
skipRevert
|
|
1252
|
+
skipRevert,
|
|
1226
1253
|
callbackHash: zeroHash,
|
|
1227
1254
|
},
|
|
1228
1255
|
];
|
|
@@ -1237,11 +1264,11 @@ export var BundlerAction;
|
|
|
1237
1264
|
* @param deadline The timestamp until which the signature is valid.
|
|
1238
1265
|
* @param signature The Ethers signature to submit.
|
|
1239
1266
|
* @param manager The address of the manager to approve. Defaults to the chain's bundler3 AaveV3OptimizerMigrationAdapter.
|
|
1240
|
-
* @param skipRevert Whether to allow the signature to revert without making the whole
|
|
1267
|
+
* @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
|
|
1241
1268
|
*/
|
|
1242
|
-
function aaveV3OptimizerApproveManagerWithSig(chainId, owner, isApproved, nonce, deadline, signature, manager, skipRevert = true) {
|
|
1243
|
-
const {
|
|
1244
|
-
if (
|
|
1269
|
+
function aaveV3OptimizerApproveManagerWithSig(chainId, aaveV3Optimizer, owner, isApproved, nonce, deadline, signature, manager, skipRevert = true) {
|
|
1270
|
+
const { bundler3: { aaveV3OptimizerMigrationAdapter }, } = getChainAddresses(chainId);
|
|
1271
|
+
if (aaveV3OptimizerMigrationAdapter == null)
|
|
1245
1272
|
throw new BundlerErrors.UnexpectedAction("aaveV3OptimizerApproveManagerWithSig", chainId);
|
|
1246
1273
|
manager ??= aaveV3OptimizerMigrationAdapter;
|
|
1247
1274
|
const { r, s, yParity } = parseSignature(signature);
|
|
@@ -1298,13 +1325,12 @@ export var BundlerAction;
|
|
|
1298
1325
|
* @param cToken The cToken on which to repay the debt.
|
|
1299
1326
|
* @param amount The amount of debt to repay.
|
|
1300
1327
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1328
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1301
1329
|
*/
|
|
1302
|
-
function compoundV2Repay(chainId, cToken, amount,
|
|
1303
|
-
const {
|
|
1304
|
-
if (
|
|
1330
|
+
function compoundV2Repay(chainId, cToken, amount, isEth, onBehalf, skipRevert = false) {
|
|
1331
|
+
const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1332
|
+
if (compoundV2MigrationAdapter == null)
|
|
1305
1333
|
throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1306
|
-
const isEth = cToken === cEth;
|
|
1307
|
-
recipient ??= compoundV2MigrationAdapter;
|
|
1308
1334
|
return [
|
|
1309
1335
|
{
|
|
1310
1336
|
to: compoundV2MigrationAdapter,
|
|
@@ -1312,15 +1338,15 @@ export var BundlerAction;
|
|
|
1312
1338
|
? encodeFunctionData({
|
|
1313
1339
|
abi: compoundV2MigrationAdapterAbi,
|
|
1314
1340
|
functionName: "compoundV2RepayEth",
|
|
1315
|
-
args: [amount,
|
|
1341
|
+
args: [amount, onBehalf],
|
|
1316
1342
|
})
|
|
1317
1343
|
: encodeFunctionData({
|
|
1318
1344
|
abi: compoundV2MigrationAdapterAbi,
|
|
1319
1345
|
functionName: "compoundV2RepayErc20",
|
|
1320
|
-
args: [cToken, amount,
|
|
1346
|
+
args: [cToken, amount, onBehalf],
|
|
1321
1347
|
}),
|
|
1322
1348
|
value: isEth ? amount : 0n,
|
|
1323
|
-
skipRevert
|
|
1349
|
+
skipRevert,
|
|
1324
1350
|
callbackHash: zeroHash,
|
|
1325
1351
|
},
|
|
1326
1352
|
];
|
|
@@ -1332,12 +1358,12 @@ export var BundlerAction;
|
|
|
1332
1358
|
* @param cToken The cToken on which to withdraw.
|
|
1333
1359
|
* @param amount The amount to withdraw.
|
|
1334
1360
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1361
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1335
1362
|
*/
|
|
1336
|
-
function compoundV2Redeem(chainId, cToken, amount, recipient) {
|
|
1337
|
-
const {
|
|
1338
|
-
if (
|
|
1363
|
+
function compoundV2Redeem(chainId, cToken, amount, isEth, recipient, skipRevert = false) {
|
|
1364
|
+
const { bundler3: { compoundV2MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1365
|
+
if (compoundV2MigrationAdapter == null)
|
|
1339
1366
|
throw new BundlerErrors.UnexpectedAction("compoundV2Repay", chainId);
|
|
1340
|
-
const isEth = cToken === cEth;
|
|
1341
1367
|
recipient ??= compoundV2MigrationAdapter;
|
|
1342
1368
|
return [
|
|
1343
1369
|
{
|
|
@@ -1354,7 +1380,7 @@ export var BundlerAction;
|
|
|
1354
1380
|
args: [cToken, amount, recipient],
|
|
1355
1381
|
}),
|
|
1356
1382
|
value: 0n,
|
|
1357
|
-
skipRevert
|
|
1383
|
+
skipRevert,
|
|
1358
1384
|
callbackHash: zeroHash,
|
|
1359
1385
|
},
|
|
1360
1386
|
];
|
|
@@ -1367,8 +1393,9 @@ export var BundlerAction;
|
|
|
1367
1393
|
* @param instance The CompoundV3 instance on which to repay the debt.
|
|
1368
1394
|
* @param amount The amount of debt to repay.
|
|
1369
1395
|
* @param onBehalf The address on behalf of which to repay.
|
|
1396
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1370
1397
|
*/
|
|
1371
|
-
function compoundV3Repay(chainId, instance, amount, onBehalf) {
|
|
1398
|
+
function compoundV3Repay(chainId, instance, amount, onBehalf, skipRevert = false) {
|
|
1372
1399
|
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1373
1400
|
if (compoundV3MigrationAdapter == null)
|
|
1374
1401
|
throw new BundlerErrors.UnexpectedAction("compoundV3Repay", chainId);
|
|
@@ -1381,7 +1408,7 @@ export var BundlerAction;
|
|
|
1381
1408
|
args: [instance, amount, onBehalf],
|
|
1382
1409
|
}),
|
|
1383
1410
|
value: 0n,
|
|
1384
|
-
skipRevert
|
|
1411
|
+
skipRevert,
|
|
1385
1412
|
callbackHash: zeroHash,
|
|
1386
1413
|
},
|
|
1387
1414
|
];
|
|
@@ -1394,8 +1421,9 @@ export var BundlerAction;
|
|
|
1394
1421
|
* @param asset The asset to withdraw.
|
|
1395
1422
|
* @param amount The amount to withdraw.
|
|
1396
1423
|
* @param recipient The recipient of ERC20 tokens. Defaults to the chain's bundler3 general adapter.
|
|
1424
|
+
* @param skipRevert Whether to allow the transfer to revert without making the whole bundler revert. Defaults to false.
|
|
1397
1425
|
*/
|
|
1398
|
-
function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient) {
|
|
1426
|
+
function compoundV3WithdrawFrom(chainId, instance, asset, amount, recipient, skipRevert = false) {
|
|
1399
1427
|
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
1400
1428
|
if (compoundV3MigrationAdapter == null)
|
|
1401
1429
|
throw new BundlerErrors.UnexpectedAction("compoundV3WithdrawFrom", chainId);
|
|
@@ -1409,7 +1437,7 @@ export var BundlerAction;
|
|
|
1409
1437
|
args: [instance, asset, amount, recipient],
|
|
1410
1438
|
}),
|
|
1411
1439
|
value: 0n,
|
|
1412
|
-
skipRevert
|
|
1440
|
+
skipRevert,
|
|
1413
1441
|
callbackHash: zeroHash,
|
|
1414
1442
|
},
|
|
1415
1443
|
];
|
|
@@ -1425,7 +1453,7 @@ export var BundlerAction;
|
|
|
1425
1453
|
* @param expiry The timestamp until which the signature is valid.
|
|
1426
1454
|
* @param signature The Ethers signature to submit.
|
|
1427
1455
|
* @param manager The address of the manager to approve. Defaults to the chain's bundler3 CompoundV3MigrationAdapter.
|
|
1428
|
-
* @param skipRevert Whether to allow the signature to revert without making the whole
|
|
1456
|
+
* @param skipRevert Whether to allow the signature to revert without making the whole bundle revert. Defaults to true.
|
|
1429
1457
|
*/
|
|
1430
1458
|
function compoundV3AllowBySig(chainId, instance, owner, isAllowed, nonce, expiry, signature, manager, skipRevert = true) {
|
|
1431
1459
|
const { bundler3: { compoundV3MigrationAdapter }, } = getChainAddresses(chainId);
|
|
@@ -1466,4 +1494,3 @@ export var BundlerAction;
|
|
|
1466
1494
|
}
|
|
1467
1495
|
BundlerAction.compoundV3AllowBySig = compoundV3AllowBySig;
|
|
1468
1496
|
})(BundlerAction || (BundlerAction = {}));
|
|
1469
|
-
export default BundlerAction;
|