@enzymefinance/testutils 4.0.0-next.0 → 4.0.0-next.5
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/CHANGELOG.md +33 -0
- package/dist/declarations/src/assertions.d.ts +4 -4
- package/dist/declarations/src/deployment.d.ts +181 -82
- package/dist/declarations/src/gasRelayer.d.ts +56 -54
- package/dist/declarations/src/helpers.d.ts +16 -15
- package/dist/declarations/src/index.d.ts +6 -6
- package/dist/declarations/src/scaffolding/assets.d.ts +10 -10
- package/dist/declarations/src/scaffolding/chainlink.d.ts +3 -3
- package/dist/declarations/src/scaffolding/common.d.ts +7 -7
- package/dist/declarations/src/scaffolding/core.d.ts +17 -16
- package/dist/declarations/src/scaffolding/extensions/common.d.ts +11 -11
- package/dist/declarations/src/scaffolding/extensions/external-positions/actions.d.ts +35 -0
- package/dist/declarations/src/scaffolding/extensions/external-positions/compound.d.ts +56 -59
- package/dist/declarations/src/scaffolding/extensions/external-positions/index.d.ts +4 -2
- package/dist/declarations/src/scaffolding/extensions/external-positions/mocks.d.ts +53 -20
- package/dist/declarations/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.d.ts +99 -0
- package/dist/declarations/src/scaffolding/extensions/fees.d.ts +12 -12
- package/dist/declarations/src/scaffolding/extensions/index.d.ts +5 -5
- package/dist/declarations/src/scaffolding/extensions/integrations/aave.d.ts +20 -19
- package/dist/declarations/src/scaffolding/extensions/integrations/compound.d.ts +28 -28
- package/dist/declarations/src/scaffolding/extensions/integrations/curve.d.ts +272 -271
- package/dist/declarations/src/scaffolding/extensions/integrations/idle.d.ts +28 -28
- package/dist/declarations/src/scaffolding/extensions/integrations/index.d.ts +14 -12
- package/dist/declarations/src/scaffolding/extensions/integrations/mock.d.ts +32 -32
- package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV4.d.ts +23 -22
- package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV5.d.ts +23 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/poolTogetherV4.d.ts +29 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/synthetix.d.ts +33 -25
- package/dist/declarations/src/scaffolding/extensions/integrations/trackedAssets.d.ts +15 -15
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV2.d.ts +46 -46
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV3.d.ts +15 -15
- package/dist/declarations/src/scaffolding/extensions/integrations/yearn.d.ts +22 -22
- package/dist/declarations/src/scaffolding/extensions/integrations/zeroExV2.d.ts +12 -12
- package/dist/declarations/src/scaffolding/extensions/policies.d.ts +17 -17
- package/dist/declarations/src/scaffolding/index.d.ts +8 -8
- package/dist/declarations/src/scaffolding/setup.d.ts +77 -75
- package/dist/declarations/src/scaffolding/shares.d.ts +35 -35
- package/dist/declarations/src/scaffolding/vaultCalls.d.ts +32 -17
- package/dist/declarations/src/whales.d.ts +42 -44
- package/dist/enzymefinance-testutils.browser.cjs.js +1470 -697
- package/dist/enzymefinance-testutils.browser.esm.js +1257 -508
- package/dist/enzymefinance-testutils.cjs.dev.js +1470 -697
- package/dist/enzymefinance-testutils.cjs.prod.js +1470 -697
- package/dist/enzymefinance-testutils.esm.js +1257 -508
- package/package.json +6 -6
- package/src/assertions.ts +5 -2
- package/src/deployment.ts +202 -99
- package/src/gasRelayer.ts +17 -18
- package/src/helpers.ts +6 -4
- package/src/scaffolding/assets.ts +6 -5
- package/src/scaffolding/chainlink.ts +2 -2
- package/src/scaffolding/common.ts +1 -1
- package/src/scaffolding/core.ts +28 -12
- package/src/scaffolding/extensions/common.ts +4 -4
- package/src/scaffolding/extensions/external-positions/actions.ts +103 -0
- package/src/scaffolding/extensions/external-positions/compound.ts +69 -114
- package/src/scaffolding/extensions/external-positions/index.ts +2 -0
- package/src/scaffolding/extensions/external-positions/mocks.ts +132 -10
- package/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.ts +290 -0
- package/src/scaffolding/extensions/fees.ts +1 -1
- package/src/scaffolding/extensions/integrations/aave.ts +6 -8
- package/src/scaffolding/extensions/integrations/compound.ts +10 -11
- package/src/scaffolding/extensions/integrations/curve.ts +72 -68
- package/src/scaffolding/extensions/integrations/idle.ts +9 -11
- package/src/scaffolding/extensions/integrations/index.ts +2 -0
- package/src/scaffolding/extensions/integrations/mock.ts +11 -13
- package/src/scaffolding/extensions/integrations/paraSwapV4.ts +16 -11
- package/src/scaffolding/extensions/integrations/paraSwapV5.ts +73 -0
- package/src/scaffolding/extensions/integrations/poolTogetherV4.ts +117 -0
- package/src/scaffolding/extensions/integrations/synthetix.ts +45 -12
- package/src/scaffolding/extensions/integrations/trackedAssets.ts +3 -4
- package/src/scaffolding/extensions/integrations/uniswapV2.ts +31 -27
- package/src/scaffolding/extensions/integrations/uniswapV3.ts +9 -10
- package/src/scaffolding/extensions/integrations/yearn.ts +9 -11
- package/src/scaffolding/extensions/integrations/zeroExV2.ts +9 -7
- package/src/scaffolding/extensions/policies.ts +2 -1
- package/src/scaffolding/setup.ts +27 -19
- package/src/scaffolding/shares.ts +5 -4
- package/src/scaffolding/vaultCalls.ts +50 -3
- package/src/whales.ts +26 -17
- package/tsconfig.json +2 -1
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { AddressLike, Call, Contract,
|
|
2
|
-
import {
|
|
1
|
+
import type { AddressLike, Call, Contract, Send } from '@enzymefinance/ethers';
|
|
2
|
+
import { contract } from '@enzymefinance/ethers';
|
|
3
|
+
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
4
|
+
import type {
|
|
5
|
+
ComptrollerLib,
|
|
6
|
+
CurveExchangeAdapter,
|
|
7
|
+
CurveLiquidityAaveAdapter,
|
|
8
|
+
CurveLiquidityEursAdapter,
|
|
9
|
+
CurveLiquiditySethAdapter,
|
|
10
|
+
CurveLiquidityStethAdapter,
|
|
11
|
+
IntegrationManager,
|
|
12
|
+
StandardToken,
|
|
13
|
+
} from '@enzymefinance/protocol';
|
|
3
14
|
import {
|
|
4
15
|
callOnIntegrationArgs,
|
|
5
16
|
claimRewardsSelector,
|
|
6
|
-
ComptrollerLib,
|
|
7
17
|
curveAaveLendAndStakeArgs,
|
|
8
18
|
curveAaveLendArgs,
|
|
9
19
|
curveAaveRedeemArgs,
|
|
@@ -16,11 +26,6 @@ import {
|
|
|
16
26
|
curveEursStakeArgs,
|
|
17
27
|
curveEursUnstakeAndRedeemArgs,
|
|
18
28
|
curveEursUnstakeArgs,
|
|
19
|
-
CurveExchangeAdapter,
|
|
20
|
-
CurveLiquidityAaveAdapter,
|
|
21
|
-
CurveLiquidityEursAdapter,
|
|
22
|
-
CurveLiquiditySethAdapter,
|
|
23
|
-
CurveLiquidityStethAdapter,
|
|
24
29
|
curveSethLendAndStakeArgs,
|
|
25
30
|
curveSethLendArgs,
|
|
26
31
|
curveSethRedeemArgs,
|
|
@@ -34,18 +39,17 @@ import {
|
|
|
34
39
|
curveStethUnstakeAndRedeemArgs,
|
|
35
40
|
curveStethUnstakeArgs,
|
|
36
41
|
curveTakeOrderArgs,
|
|
37
|
-
IntegrationManager,
|
|
38
42
|
IntegrationManagerActionId,
|
|
39
43
|
lendAndStakeSelector,
|
|
40
44
|
lendSelector,
|
|
41
45
|
redeemSelector,
|
|
42
46
|
stakeSelector,
|
|
43
|
-
StandardToken,
|
|
44
47
|
takeOrderSelector,
|
|
45
48
|
unstakeAndRedeemSelector,
|
|
46
49
|
unstakeSelector,
|
|
47
50
|
} from '@enzymefinance/protocol';
|
|
48
|
-
import {
|
|
51
|
+
import type { BigNumberish } from 'ethers';
|
|
52
|
+
import { BigNumber, constants, utils } from 'ethers';
|
|
49
53
|
|
|
50
54
|
export interface CurveLiquidityGaugeV2 extends Contract<CurveLiquidityGaugeV2> {
|
|
51
55
|
claim_rewards: Send<(_addr: AddressLike) => void>;
|
|
@@ -98,17 +102,17 @@ export async function curveTakeOrder({
|
|
|
98
102
|
minIncomingAssetAmount?: BigNumberish;
|
|
99
103
|
}) {
|
|
100
104
|
const takeOrderArgs = curveTakeOrderArgs({
|
|
105
|
+
incomingAsset,
|
|
106
|
+
minIncomingAssetAmount,
|
|
107
|
+
outgoingAsset,
|
|
108
|
+
outgoingAssetAmount,
|
|
101
109
|
pool,
|
|
102
|
-
outgoingAsset: outgoingAsset,
|
|
103
|
-
outgoingAssetAmount: outgoingAssetAmount,
|
|
104
|
-
incomingAsset: incomingAsset,
|
|
105
|
-
minIncomingAssetAmount: minIncomingAssetAmount,
|
|
106
110
|
});
|
|
107
111
|
|
|
108
112
|
const callArgs = callOnIntegrationArgs({
|
|
109
113
|
adapter: curveExchangeAdapter,
|
|
110
|
-
selector: takeOrderSelector,
|
|
111
114
|
encodedCallArgs: takeOrderArgs,
|
|
115
|
+
selector: takeOrderSelector,
|
|
112
116
|
});
|
|
113
117
|
|
|
114
118
|
return comptrollerProxy
|
|
@@ -131,8 +135,8 @@ export function curveAaveClaimRewards({
|
|
|
131
135
|
}) {
|
|
132
136
|
const callArgs = callOnIntegrationArgs({
|
|
133
137
|
adapter: curveLiquidityAaveAdapter,
|
|
134
|
-
selector: claimRewardsSelector,
|
|
135
138
|
encodedCallArgs: constants.HashZero,
|
|
139
|
+
selector: claimRewardsSelector,
|
|
136
140
|
});
|
|
137
141
|
|
|
138
142
|
return comptrollerProxy
|
|
@@ -163,14 +167,14 @@ export function curveAaveLend({
|
|
|
163
167
|
}) {
|
|
164
168
|
const callArgs = callOnIntegrationArgs({
|
|
165
169
|
adapter: curveLiquidityAaveAdapter,
|
|
166
|
-
selector: lendSelector,
|
|
167
170
|
encodedCallArgs: curveAaveLendArgs({
|
|
171
|
+
minIncomingLPTokenAmount,
|
|
168
172
|
outgoingAaveDaiAmount,
|
|
169
173
|
outgoingAaveUsdcAmount,
|
|
170
174
|
outgoingAaveUsdtAmount,
|
|
171
|
-
minIncomingLPTokenAmount,
|
|
172
175
|
useUnderlyings,
|
|
173
176
|
}),
|
|
177
|
+
selector: lendSelector,
|
|
174
178
|
});
|
|
175
179
|
|
|
176
180
|
return comptrollerProxy
|
|
@@ -201,14 +205,14 @@ export function curveAaveLendAndStake({
|
|
|
201
205
|
}) {
|
|
202
206
|
const callArgs = callOnIntegrationArgs({
|
|
203
207
|
adapter: curveLiquidityAaveAdapter,
|
|
204
|
-
selector: lendAndStakeSelector,
|
|
205
208
|
encodedCallArgs: curveAaveLendAndStakeArgs({
|
|
209
|
+
minIncomingLiquidityGaugeTokenAmount,
|
|
206
210
|
outgoingAaveDaiAmount,
|
|
207
211
|
outgoingAaveUsdcAmount,
|
|
208
212
|
outgoingAaveUsdtAmount,
|
|
209
|
-
minIncomingLiquidityGaugeTokenAmount,
|
|
210
213
|
useUnderlyings,
|
|
211
214
|
}),
|
|
215
|
+
selector: lendAndStakeSelector,
|
|
212
216
|
});
|
|
213
217
|
|
|
214
218
|
return comptrollerProxy
|
|
@@ -241,15 +245,15 @@ export function curveAaveRedeem({
|
|
|
241
245
|
}) {
|
|
242
246
|
const callArgs = callOnIntegrationArgs({
|
|
243
247
|
adapter: curveLiquidityAaveAdapter,
|
|
244
|
-
selector: redeemSelector,
|
|
245
248
|
encodedCallArgs: curveAaveRedeemArgs({
|
|
246
|
-
outgoingLPTokenAmount,
|
|
247
249
|
minIncomingAaveDaiAmount,
|
|
248
250
|
minIncomingAaveUsdcAmount,
|
|
249
251
|
minIncomingAaveUsdtAmount,
|
|
252
|
+
outgoingLPTokenAmount,
|
|
250
253
|
receiveSingleAsset,
|
|
251
254
|
useUnderlyings,
|
|
252
255
|
}),
|
|
256
|
+
selector: redeemSelector,
|
|
253
257
|
});
|
|
254
258
|
|
|
255
259
|
return comptrollerProxy
|
|
@@ -272,10 +276,10 @@ export function curveAaveStake({
|
|
|
272
276
|
}) {
|
|
273
277
|
const callArgs = callOnIntegrationArgs({
|
|
274
278
|
adapter: curveLiquidityAaveAdapter,
|
|
275
|
-
selector: stakeSelector,
|
|
276
279
|
encodedCallArgs: curveAaveStakeArgs({
|
|
277
280
|
outgoingLPTokenAmount,
|
|
278
281
|
}),
|
|
282
|
+
selector: stakeSelector,
|
|
279
283
|
});
|
|
280
284
|
|
|
281
285
|
return comptrollerProxy
|
|
@@ -308,15 +312,15 @@ export function curveAaveUnstakeAndRedeem({
|
|
|
308
312
|
}) {
|
|
309
313
|
const callArgs = callOnIntegrationArgs({
|
|
310
314
|
adapter: curveLiquidityAaveAdapter,
|
|
311
|
-
selector: unstakeAndRedeemSelector,
|
|
312
315
|
encodedCallArgs: curveAaveUnstakeAndRedeemArgs({
|
|
313
|
-
outgoingLiquidityGaugeTokenAmount,
|
|
314
316
|
minIncomingAaveDaiAmount,
|
|
315
317
|
minIncomingAaveUsdcAmount,
|
|
316
318
|
minIncomingAaveUsdtAmount,
|
|
319
|
+
outgoingLiquidityGaugeTokenAmount,
|
|
317
320
|
receiveSingleAsset,
|
|
318
321
|
useUnderlyings,
|
|
319
322
|
}),
|
|
323
|
+
selector: unstakeAndRedeemSelector,
|
|
320
324
|
});
|
|
321
325
|
|
|
322
326
|
return comptrollerProxy
|
|
@@ -339,10 +343,10 @@ export function curveAaveUnstake({
|
|
|
339
343
|
}) {
|
|
340
344
|
const callArgs = callOnIntegrationArgs({
|
|
341
345
|
adapter: curveLiquidityAaveAdapter,
|
|
342
|
-
selector: unstakeSelector,
|
|
343
346
|
encodedCallArgs: curveAaveUnstakeArgs({
|
|
344
347
|
outgoingLiquidityGaugeTokenAmount,
|
|
345
348
|
}),
|
|
349
|
+
selector: unstakeSelector,
|
|
346
350
|
});
|
|
347
351
|
|
|
348
352
|
return comptrollerProxy
|
|
@@ -365,8 +369,8 @@ export function curveEursClaimRewards({
|
|
|
365
369
|
}) {
|
|
366
370
|
const callArgs = callOnIntegrationArgs({
|
|
367
371
|
adapter: curveLiquidityEursAdapter,
|
|
368
|
-
selector: claimRewardsSelector,
|
|
369
372
|
encodedCallArgs: constants.HashZero,
|
|
373
|
+
selector: claimRewardsSelector,
|
|
370
374
|
});
|
|
371
375
|
|
|
372
376
|
return comptrollerProxy
|
|
@@ -393,12 +397,12 @@ export function curveEursLend({
|
|
|
393
397
|
}) {
|
|
394
398
|
const callArgs = callOnIntegrationArgs({
|
|
395
399
|
adapter: curveLiquidityEursAdapter,
|
|
396
|
-
selector: lendSelector,
|
|
397
400
|
encodedCallArgs: curveEursLendArgs({
|
|
401
|
+
minIncomingLPTokenAmount,
|
|
398
402
|
outgoingEursAmount,
|
|
399
403
|
outgoingSeurAmount,
|
|
400
|
-
minIncomingLPTokenAmount,
|
|
401
404
|
}),
|
|
405
|
+
selector: lendSelector,
|
|
402
406
|
});
|
|
403
407
|
|
|
404
408
|
return comptrollerProxy
|
|
@@ -425,12 +429,12 @@ export function curveEursLendAndStake({
|
|
|
425
429
|
}) {
|
|
426
430
|
const callArgs = callOnIntegrationArgs({
|
|
427
431
|
adapter: curveLiquidityEursAdapter,
|
|
428
|
-
selector: lendAndStakeSelector,
|
|
429
432
|
encodedCallArgs: curveEursLendAndStakeArgs({
|
|
433
|
+
minIncomingLiquidityGaugeTokenAmount,
|
|
430
434
|
outgoingEursAmount,
|
|
431
435
|
outgoingSeurAmount,
|
|
432
|
-
minIncomingLiquidityGaugeTokenAmount,
|
|
433
436
|
}),
|
|
437
|
+
selector: lendAndStakeSelector,
|
|
434
438
|
});
|
|
435
439
|
|
|
436
440
|
return comptrollerProxy
|
|
@@ -459,13 +463,13 @@ export function curveEursRedeem({
|
|
|
459
463
|
}) {
|
|
460
464
|
const callArgs = callOnIntegrationArgs({
|
|
461
465
|
adapter: curveLiquidityEursAdapter,
|
|
462
|
-
selector: redeemSelector,
|
|
463
466
|
encodedCallArgs: curveEursRedeemArgs({
|
|
464
|
-
outgoingLPTokenAmount,
|
|
465
467
|
minIncomingEursAmount,
|
|
466
468
|
minIncomingSeurAmount,
|
|
469
|
+
outgoingLPTokenAmount,
|
|
467
470
|
receiveSingleAsset,
|
|
468
471
|
}),
|
|
472
|
+
selector: redeemSelector,
|
|
469
473
|
});
|
|
470
474
|
|
|
471
475
|
return comptrollerProxy
|
|
@@ -488,10 +492,10 @@ export function curveEursStake({
|
|
|
488
492
|
}) {
|
|
489
493
|
const callArgs = callOnIntegrationArgs({
|
|
490
494
|
adapter: curveLiquidityEursAdapter,
|
|
491
|
-
selector: stakeSelector,
|
|
492
495
|
encodedCallArgs: curveEursStakeArgs({
|
|
493
496
|
outgoingLPTokenAmount,
|
|
494
497
|
}),
|
|
498
|
+
selector: stakeSelector,
|
|
495
499
|
});
|
|
496
500
|
|
|
497
501
|
return comptrollerProxy
|
|
@@ -520,13 +524,13 @@ export function curveEursUnstakeAndRedeem({
|
|
|
520
524
|
}) {
|
|
521
525
|
const callArgs = callOnIntegrationArgs({
|
|
522
526
|
adapter: curveLiquidityEursAdapter,
|
|
523
|
-
selector: unstakeAndRedeemSelector,
|
|
524
527
|
encodedCallArgs: curveEursUnstakeAndRedeemArgs({
|
|
525
|
-
outgoingLiquidityGaugeTokenAmount,
|
|
526
528
|
minIncomingEursAmount,
|
|
527
529
|
minIncomingSeurAmount,
|
|
530
|
+
outgoingLiquidityGaugeTokenAmount,
|
|
528
531
|
receiveSingleAsset,
|
|
529
532
|
}),
|
|
533
|
+
selector: unstakeAndRedeemSelector,
|
|
530
534
|
});
|
|
531
535
|
|
|
532
536
|
return comptrollerProxy
|
|
@@ -549,10 +553,10 @@ export function curveEursUnstake({
|
|
|
549
553
|
}) {
|
|
550
554
|
const callArgs = callOnIntegrationArgs({
|
|
551
555
|
adapter: curveLiquidityEursAdapter,
|
|
552
|
-
selector: unstakeSelector,
|
|
553
556
|
encodedCallArgs: curveEursUnstakeArgs({
|
|
554
557
|
outgoingLiquidityGaugeTokenAmount,
|
|
555
558
|
}),
|
|
559
|
+
selector: unstakeSelector,
|
|
556
560
|
});
|
|
557
561
|
|
|
558
562
|
return comptrollerProxy
|
|
@@ -575,8 +579,8 @@ export function curveSethClaimRewards({
|
|
|
575
579
|
}) {
|
|
576
580
|
const callArgs = callOnIntegrationArgs({
|
|
577
581
|
adapter: curveLiquiditySethAdapter,
|
|
578
|
-
selector: claimRewardsSelector,
|
|
579
582
|
encodedCallArgs: constants.HashZero,
|
|
583
|
+
selector: claimRewardsSelector,
|
|
580
584
|
});
|
|
581
585
|
|
|
582
586
|
return comptrollerProxy
|
|
@@ -603,12 +607,12 @@ export function curveSethLend({
|
|
|
603
607
|
}) {
|
|
604
608
|
const callArgs = callOnIntegrationArgs({
|
|
605
609
|
adapter: curveLiquiditySethAdapter,
|
|
606
|
-
selector: lendSelector,
|
|
607
610
|
encodedCallArgs: curveSethLendArgs({
|
|
608
|
-
outgoingWethAmount,
|
|
609
|
-
outgoingSethAmount,
|
|
610
611
|
minIncomingLPTokenAmount,
|
|
612
|
+
outgoingSethAmount,
|
|
613
|
+
outgoingWethAmount,
|
|
611
614
|
}),
|
|
615
|
+
selector: lendSelector,
|
|
612
616
|
});
|
|
613
617
|
|
|
614
618
|
return comptrollerProxy
|
|
@@ -635,12 +639,12 @@ export function curveSethLendAndStake({
|
|
|
635
639
|
}) {
|
|
636
640
|
const callArgs = callOnIntegrationArgs({
|
|
637
641
|
adapter: curveLiquiditySethAdapter,
|
|
638
|
-
selector: lendAndStakeSelector,
|
|
639
642
|
encodedCallArgs: curveSethLendAndStakeArgs({
|
|
640
|
-
outgoingWethAmount,
|
|
641
|
-
outgoingSethAmount,
|
|
642
643
|
minIncomingLiquidityGaugeTokenAmount,
|
|
644
|
+
outgoingSethAmount,
|
|
645
|
+
outgoingWethAmount,
|
|
643
646
|
}),
|
|
647
|
+
selector: lendAndStakeSelector,
|
|
644
648
|
});
|
|
645
649
|
|
|
646
650
|
return comptrollerProxy
|
|
@@ -669,13 +673,13 @@ export function curveSethRedeem({
|
|
|
669
673
|
}) {
|
|
670
674
|
const callArgs = callOnIntegrationArgs({
|
|
671
675
|
adapter: curveLiquiditySethAdapter,
|
|
672
|
-
selector: redeemSelector,
|
|
673
676
|
encodedCallArgs: curveSethRedeemArgs({
|
|
674
|
-
outgoingLPTokenAmount,
|
|
675
|
-
minIncomingWethAmount,
|
|
676
677
|
minIncomingSethAmount,
|
|
678
|
+
minIncomingWethAmount,
|
|
679
|
+
outgoingLPTokenAmount,
|
|
677
680
|
receiveSingleAsset,
|
|
678
681
|
}),
|
|
682
|
+
selector: redeemSelector,
|
|
679
683
|
});
|
|
680
684
|
|
|
681
685
|
return comptrollerProxy
|
|
@@ -698,10 +702,10 @@ export function curveSethStake({
|
|
|
698
702
|
}) {
|
|
699
703
|
const callArgs = callOnIntegrationArgs({
|
|
700
704
|
adapter: curveLiquiditySethAdapter,
|
|
701
|
-
selector: stakeSelector,
|
|
702
705
|
encodedCallArgs: curveSethStakeArgs({
|
|
703
706
|
outgoingLPTokenAmount,
|
|
704
707
|
}),
|
|
708
|
+
selector: stakeSelector,
|
|
705
709
|
});
|
|
706
710
|
|
|
707
711
|
return comptrollerProxy
|
|
@@ -730,13 +734,13 @@ export function curveSethUnstakeAndRedeem({
|
|
|
730
734
|
}) {
|
|
731
735
|
const callArgs = callOnIntegrationArgs({
|
|
732
736
|
adapter: curveLiquiditySethAdapter,
|
|
733
|
-
selector: unstakeAndRedeemSelector,
|
|
734
737
|
encodedCallArgs: curveSethUnstakeAndRedeemArgs({
|
|
735
|
-
outgoingLiquidityGaugeTokenAmount,
|
|
736
|
-
minIncomingWethAmount,
|
|
737
738
|
minIncomingSethAmount,
|
|
739
|
+
minIncomingWethAmount,
|
|
740
|
+
outgoingLiquidityGaugeTokenAmount,
|
|
738
741
|
receiveSingleAsset,
|
|
739
742
|
}),
|
|
743
|
+
selector: unstakeAndRedeemSelector,
|
|
740
744
|
});
|
|
741
745
|
|
|
742
746
|
return comptrollerProxy
|
|
@@ -759,10 +763,10 @@ export function curveSethUnstake({
|
|
|
759
763
|
}) {
|
|
760
764
|
const callArgs = callOnIntegrationArgs({
|
|
761
765
|
adapter: curveLiquiditySethAdapter,
|
|
762
|
-
selector: unstakeSelector,
|
|
763
766
|
encodedCallArgs: curveSethUnstakeArgs({
|
|
764
767
|
outgoingLiquidityGaugeTokenAmount,
|
|
765
768
|
}),
|
|
769
|
+
selector: unstakeSelector,
|
|
766
770
|
});
|
|
767
771
|
|
|
768
772
|
return comptrollerProxy
|
|
@@ -785,8 +789,8 @@ export function curveStethClaimRewards({
|
|
|
785
789
|
}) {
|
|
786
790
|
const callArgs = callOnIntegrationArgs({
|
|
787
791
|
adapter: curveLiquidityStethAdapter,
|
|
788
|
-
selector: claimRewardsSelector,
|
|
789
792
|
encodedCallArgs: constants.HashZero,
|
|
793
|
+
selector: claimRewardsSelector,
|
|
790
794
|
});
|
|
791
795
|
|
|
792
796
|
return comptrollerProxy
|
|
@@ -813,12 +817,12 @@ export function curveStethLend({
|
|
|
813
817
|
}) {
|
|
814
818
|
const callArgs = callOnIntegrationArgs({
|
|
815
819
|
adapter: curveLiquidityStethAdapter,
|
|
816
|
-
selector: lendSelector,
|
|
817
820
|
encodedCallArgs: curveStethLendArgs({
|
|
818
|
-
outgoingWethAmount,
|
|
819
|
-
outgoingStethAmount,
|
|
820
821
|
minIncomingLPTokenAmount,
|
|
822
|
+
outgoingStethAmount,
|
|
823
|
+
outgoingWethAmount,
|
|
821
824
|
}),
|
|
825
|
+
selector: lendSelector,
|
|
822
826
|
});
|
|
823
827
|
|
|
824
828
|
return comptrollerProxy
|
|
@@ -845,12 +849,12 @@ export function curveStethLendAndStake({
|
|
|
845
849
|
}) {
|
|
846
850
|
const callArgs = callOnIntegrationArgs({
|
|
847
851
|
adapter: curveLiquidityStethAdapter,
|
|
848
|
-
selector: lendAndStakeSelector,
|
|
849
852
|
encodedCallArgs: curveStethLendAndStakeArgs({
|
|
850
|
-
outgoingWethAmount,
|
|
851
|
-
outgoingStethAmount,
|
|
852
853
|
minIncomingLiquidityGaugeTokenAmount,
|
|
854
|
+
outgoingStethAmount,
|
|
855
|
+
outgoingWethAmount,
|
|
853
856
|
}),
|
|
857
|
+
selector: lendAndStakeSelector,
|
|
854
858
|
});
|
|
855
859
|
|
|
856
860
|
return comptrollerProxy
|
|
@@ -879,13 +883,13 @@ export function curveStethRedeem({
|
|
|
879
883
|
}) {
|
|
880
884
|
const callArgs = callOnIntegrationArgs({
|
|
881
885
|
adapter: curveLiquidityStethAdapter,
|
|
882
|
-
selector: redeemSelector,
|
|
883
886
|
encodedCallArgs: curveStethRedeemArgs({
|
|
884
|
-
outgoingLPTokenAmount,
|
|
885
|
-
minIncomingWethAmount,
|
|
886
887
|
minIncomingStethAmount,
|
|
888
|
+
minIncomingWethAmount,
|
|
889
|
+
outgoingLPTokenAmount,
|
|
887
890
|
receiveSingleAsset,
|
|
888
891
|
}),
|
|
892
|
+
selector: redeemSelector,
|
|
889
893
|
});
|
|
890
894
|
|
|
891
895
|
return comptrollerProxy
|
|
@@ -908,10 +912,10 @@ export function curveStethStake({
|
|
|
908
912
|
}) {
|
|
909
913
|
const callArgs = callOnIntegrationArgs({
|
|
910
914
|
adapter: curveLiquidityStethAdapter,
|
|
911
|
-
selector: stakeSelector,
|
|
912
915
|
encodedCallArgs: curveStethStakeArgs({
|
|
913
916
|
outgoingLPTokenAmount,
|
|
914
917
|
}),
|
|
918
|
+
selector: stakeSelector,
|
|
915
919
|
});
|
|
916
920
|
|
|
917
921
|
return comptrollerProxy
|
|
@@ -940,13 +944,13 @@ export function curveStethUnstakeAndRedeem({
|
|
|
940
944
|
}) {
|
|
941
945
|
const callArgs = callOnIntegrationArgs({
|
|
942
946
|
adapter: curveLiquidityStethAdapter,
|
|
943
|
-
selector: unstakeAndRedeemSelector,
|
|
944
947
|
encodedCallArgs: curveStethUnstakeAndRedeemArgs({
|
|
945
|
-
outgoingLiquidityGaugeTokenAmount,
|
|
946
|
-
minIncomingWethAmount,
|
|
947
948
|
minIncomingStethAmount,
|
|
949
|
+
minIncomingWethAmount,
|
|
950
|
+
outgoingLiquidityGaugeTokenAmount,
|
|
948
951
|
receiveSingleAsset,
|
|
949
952
|
}),
|
|
953
|
+
selector: unstakeAndRedeemSelector,
|
|
950
954
|
});
|
|
951
955
|
|
|
952
956
|
return comptrollerProxy
|
|
@@ -969,10 +973,10 @@ export function curveStethUnstake({
|
|
|
969
973
|
}) {
|
|
970
974
|
const callArgs = callOnIntegrationArgs({
|
|
971
975
|
adapter: curveLiquidityStethAdapter,
|
|
972
|
-
selector: unstakeSelector,
|
|
973
976
|
encodedCallArgs: curveStethUnstakeArgs({
|
|
974
977
|
outgoingLiquidityGaugeTokenAmount,
|
|
975
978
|
}),
|
|
979
|
+
selector: unstakeSelector,
|
|
976
980
|
});
|
|
977
981
|
|
|
978
982
|
return comptrollerProxy
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
1
|
+
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
2
|
+
import type { ComptrollerLib, IdleAdapter, IntegrationManager, StandardToken } from '@enzymefinance/protocol';
|
|
2
3
|
import {
|
|
3
4
|
callOnIntegrationArgs,
|
|
4
5
|
claimRewardsSelector,
|
|
5
|
-
ComptrollerLib,
|
|
6
|
-
IdleAdapter,
|
|
7
6
|
idleClaimRewardsArgs,
|
|
8
7
|
idleLendArgs,
|
|
9
8
|
idleRedeemArgs,
|
|
10
|
-
IntegrationManager,
|
|
11
9
|
IntegrationManagerActionId,
|
|
12
10
|
lendSelector,
|
|
13
11
|
redeemSelector,
|
|
14
|
-
StandardToken,
|
|
15
12
|
} from '@enzymefinance/protocol';
|
|
16
|
-
import {
|
|
13
|
+
import type { BigNumberish } from 'ethers';
|
|
14
|
+
import { BigNumber } from 'ethers';
|
|
17
15
|
|
|
18
16
|
export async function idleClaimRewards({
|
|
19
17
|
comptrollerProxy,
|
|
@@ -30,10 +28,10 @@ export async function idleClaimRewards({
|
|
|
30
28
|
}) {
|
|
31
29
|
const callArgs = callOnIntegrationArgs({
|
|
32
30
|
adapter: idleAdapter,
|
|
33
|
-
selector: claimRewardsSelector,
|
|
34
31
|
encodedCallArgs: idleClaimRewardsArgs({
|
|
35
32
|
idleToken,
|
|
36
33
|
}),
|
|
34
|
+
selector: claimRewardsSelector,
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
return comptrollerProxy
|
|
@@ -60,12 +58,12 @@ export async function idleLend({
|
|
|
60
58
|
}) {
|
|
61
59
|
const callArgs = callOnIntegrationArgs({
|
|
62
60
|
adapter: idleAdapter,
|
|
63
|
-
selector: lendSelector,
|
|
64
61
|
encodedCallArgs: idleLendArgs({
|
|
65
62
|
idleToken,
|
|
66
|
-
outgoingUnderlyingAmount,
|
|
67
63
|
minIncomingIdleTokenAmount,
|
|
64
|
+
outgoingUnderlyingAmount,
|
|
68
65
|
}),
|
|
66
|
+
selector: lendSelector,
|
|
69
67
|
});
|
|
70
68
|
|
|
71
69
|
return comptrollerProxy
|
|
@@ -92,12 +90,12 @@ export async function idleRedeem({
|
|
|
92
90
|
}) {
|
|
93
91
|
const callArgs = callOnIntegrationArgs({
|
|
94
92
|
adapter: idleAdapter,
|
|
95
|
-
selector: redeemSelector,
|
|
96
93
|
encodedCallArgs: idleRedeemArgs({
|
|
97
94
|
idleToken,
|
|
98
|
-
outgoingIdleTokenAmount,
|
|
99
95
|
minIncomingUnderlyingAmount,
|
|
96
|
+
outgoingIdleTokenAmount,
|
|
100
97
|
}),
|
|
98
|
+
selector: redeemSelector,
|
|
101
99
|
});
|
|
102
100
|
|
|
103
101
|
return comptrollerProxy
|
|
@@ -4,6 +4,8 @@ export * from './curve';
|
|
|
4
4
|
export * from './idle';
|
|
5
5
|
export * from './mock';
|
|
6
6
|
export * from './paraSwapV4';
|
|
7
|
+
export * from './paraSwapV5';
|
|
8
|
+
export * from './poolTogetherV4';
|
|
7
9
|
export * from './synthetix';
|
|
8
10
|
export * from './trackedAssets';
|
|
9
11
|
export * from './uniswapV2';
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
-
import { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
-
import {
|
|
1
|
+
import type { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
+
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
+
import type {
|
|
4
4
|
ComptrollerLib,
|
|
5
5
|
IntegrationManager,
|
|
6
|
-
VaultLib,
|
|
7
6
|
MockGenericAdapter,
|
|
8
7
|
StandardToken,
|
|
9
|
-
|
|
10
|
-
callOnIntegrationArgs,
|
|
11
|
-
encodeArgs,
|
|
12
|
-
IntegrationManagerActionId,
|
|
8
|
+
VaultLib,
|
|
13
9
|
} from '@enzymefinance/protocol';
|
|
14
|
-
import {
|
|
10
|
+
import { callOnIntegrationArgs, encodeArgs, IntegrationManagerActionId, sighash } from '@enzymefinance/protocol';
|
|
11
|
+
import type { BigNumberish, BytesLike } from 'ethers';
|
|
12
|
+
import { utils } from 'ethers';
|
|
15
13
|
|
|
16
14
|
export const mockGenericRemoveOnlySelector = sighash(
|
|
17
15
|
utils.FunctionFragment.fromString('removeOnly(address,bytes,bytes)'),
|
|
@@ -94,18 +92,18 @@ export async function mockGenericSwap({
|
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
const swapArgs = mockGenericSwapArgs({
|
|
97
|
-
|
|
98
|
-
maxSpendAssetAmounts,
|
|
95
|
+
actualIncomingAssetAmounts,
|
|
99
96
|
actualSpendAssetAmounts,
|
|
100
97
|
incomingAssets,
|
|
98
|
+
maxSpendAssetAmounts,
|
|
101
99
|
minIncomingAssetAmounts,
|
|
102
|
-
|
|
100
|
+
spendAssets,
|
|
103
101
|
});
|
|
104
102
|
|
|
105
103
|
const callArgs = callOnIntegrationArgs({
|
|
106
104
|
adapter: mockGenericAdapter,
|
|
107
|
-
selector,
|
|
108
105
|
encodedCallArgs: swapArgs,
|
|
106
|
+
selector,
|
|
109
107
|
});
|
|
110
108
|
|
|
111
109
|
const swapTx = comptrollerProxy
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
-
import { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
-
import {
|
|
4
|
-
callOnIntegrationArgs,
|
|
1
|
+
import type { AddressLike } from '@enzymefinance/ethers';
|
|
2
|
+
import type { SignerWithAddress } from '@enzymefinance/hardhat';
|
|
3
|
+
import type {
|
|
5
4
|
ComptrollerLib,
|
|
6
5
|
IntegrationManager,
|
|
7
|
-
IntegrationManagerActionId,
|
|
8
6
|
ParaSwapV4Adapter,
|
|
9
7
|
ParaSwapV4Path,
|
|
10
|
-
paraSwapV4TakeOrderArgs,
|
|
11
8
|
StandardToken,
|
|
9
|
+
} from '@enzymefinance/protocol';
|
|
10
|
+
import {
|
|
11
|
+
callOnIntegrationArgs,
|
|
12
|
+
IntegrationManagerActionId,
|
|
13
|
+
paraSwapV4TakeOrderArgs,
|
|
12
14
|
takeOrderSelector,
|
|
13
15
|
} from '@enzymefinance/protocol';
|
|
14
|
-
import { BigNumberish
|
|
16
|
+
import type { BigNumberish } from 'ethers';
|
|
17
|
+
import { utils } from 'ethers';
|
|
15
18
|
|
|
16
19
|
// ParaSwapV4Path
|
|
17
20
|
export function paraSwapV4GenerateDummyPaths({ toTokens }: { toTokens: AddressLike[] }) {
|
|
18
21
|
return toTokens.map((toToken) => {
|
|
19
22
|
return {
|
|
23
|
+
// Not supported in our protocol
|
|
24
|
+
routes: [],
|
|
25
|
+
|
|
20
26
|
to: toToken,
|
|
21
|
-
totalNetworkFee: 0, //
|
|
22
|
-
routes: [], // Can ignore this param in the dummy
|
|
27
|
+
totalNetworkFee: 0, // Can ignore this param in the dummy
|
|
23
28
|
};
|
|
24
29
|
});
|
|
25
30
|
}
|
|
@@ -46,8 +51,8 @@ export async function paraSwapV4TakeOrder({
|
|
|
46
51
|
paths: ParaSwapV4Path[];
|
|
47
52
|
}) {
|
|
48
53
|
const takeOrderArgs = paraSwapV4TakeOrderArgs({
|
|
49
|
-
minIncomingAssetAmount,
|
|
50
54
|
expectedIncomingAssetAmount,
|
|
55
|
+
minIncomingAssetAmount,
|
|
51
56
|
outgoingAsset,
|
|
52
57
|
outgoingAssetAmount,
|
|
53
58
|
paths,
|
|
@@ -55,8 +60,8 @@ export async function paraSwapV4TakeOrder({
|
|
|
55
60
|
|
|
56
61
|
const callArgs = callOnIntegrationArgs({
|
|
57
62
|
adapter: paraSwapV4Adapter,
|
|
58
|
-
selector: takeOrderSelector,
|
|
59
63
|
encodedCallArgs: takeOrderArgs,
|
|
64
|
+
selector: takeOrderSelector,
|
|
60
65
|
});
|
|
61
66
|
|
|
62
67
|
return comptrollerProxy
|