@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.
Files changed (81) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/declarations/src/assertions.d.ts +4 -4
  3. package/dist/declarations/src/deployment.d.ts +181 -82
  4. package/dist/declarations/src/gasRelayer.d.ts +56 -54
  5. package/dist/declarations/src/helpers.d.ts +16 -15
  6. package/dist/declarations/src/index.d.ts +6 -6
  7. package/dist/declarations/src/scaffolding/assets.d.ts +10 -10
  8. package/dist/declarations/src/scaffolding/chainlink.d.ts +3 -3
  9. package/dist/declarations/src/scaffolding/common.d.ts +7 -7
  10. package/dist/declarations/src/scaffolding/core.d.ts +17 -16
  11. package/dist/declarations/src/scaffolding/extensions/common.d.ts +11 -11
  12. package/dist/declarations/src/scaffolding/extensions/external-positions/actions.d.ts +35 -0
  13. package/dist/declarations/src/scaffolding/extensions/external-positions/compound.d.ts +56 -59
  14. package/dist/declarations/src/scaffolding/extensions/external-positions/index.d.ts +4 -2
  15. package/dist/declarations/src/scaffolding/extensions/external-positions/mocks.d.ts +53 -20
  16. package/dist/declarations/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.d.ts +99 -0
  17. package/dist/declarations/src/scaffolding/extensions/fees.d.ts +12 -12
  18. package/dist/declarations/src/scaffolding/extensions/index.d.ts +5 -5
  19. package/dist/declarations/src/scaffolding/extensions/integrations/aave.d.ts +20 -19
  20. package/dist/declarations/src/scaffolding/extensions/integrations/compound.d.ts +28 -28
  21. package/dist/declarations/src/scaffolding/extensions/integrations/curve.d.ts +272 -271
  22. package/dist/declarations/src/scaffolding/extensions/integrations/idle.d.ts +28 -28
  23. package/dist/declarations/src/scaffolding/extensions/integrations/index.d.ts +14 -12
  24. package/dist/declarations/src/scaffolding/extensions/integrations/mock.d.ts +32 -32
  25. package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV4.d.ts +23 -22
  26. package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV5.d.ts +23 -0
  27. package/dist/declarations/src/scaffolding/extensions/integrations/poolTogetherV4.d.ts +29 -0
  28. package/dist/declarations/src/scaffolding/extensions/integrations/synthetix.d.ts +33 -25
  29. package/dist/declarations/src/scaffolding/extensions/integrations/trackedAssets.d.ts +15 -15
  30. package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV2.d.ts +46 -46
  31. package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV3.d.ts +15 -15
  32. package/dist/declarations/src/scaffolding/extensions/integrations/yearn.d.ts +22 -22
  33. package/dist/declarations/src/scaffolding/extensions/integrations/zeroExV2.d.ts +12 -12
  34. package/dist/declarations/src/scaffolding/extensions/policies.d.ts +17 -17
  35. package/dist/declarations/src/scaffolding/index.d.ts +8 -8
  36. package/dist/declarations/src/scaffolding/setup.d.ts +77 -75
  37. package/dist/declarations/src/scaffolding/shares.d.ts +35 -35
  38. package/dist/declarations/src/scaffolding/vaultCalls.d.ts +32 -17
  39. package/dist/declarations/src/whales.d.ts +42 -44
  40. package/dist/enzymefinance-testutils.browser.cjs.js +1470 -697
  41. package/dist/enzymefinance-testutils.browser.esm.js +1257 -508
  42. package/dist/enzymefinance-testutils.cjs.dev.js +1470 -697
  43. package/dist/enzymefinance-testutils.cjs.prod.js +1470 -697
  44. package/dist/enzymefinance-testutils.esm.js +1257 -508
  45. package/package.json +6 -6
  46. package/src/assertions.ts +5 -2
  47. package/src/deployment.ts +202 -99
  48. package/src/gasRelayer.ts +17 -18
  49. package/src/helpers.ts +6 -4
  50. package/src/scaffolding/assets.ts +6 -5
  51. package/src/scaffolding/chainlink.ts +2 -2
  52. package/src/scaffolding/common.ts +1 -1
  53. package/src/scaffolding/core.ts +28 -12
  54. package/src/scaffolding/extensions/common.ts +4 -4
  55. package/src/scaffolding/extensions/external-positions/actions.ts +103 -0
  56. package/src/scaffolding/extensions/external-positions/compound.ts +69 -114
  57. package/src/scaffolding/extensions/external-positions/index.ts +2 -0
  58. package/src/scaffolding/extensions/external-positions/mocks.ts +132 -10
  59. package/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.ts +290 -0
  60. package/src/scaffolding/extensions/fees.ts +1 -1
  61. package/src/scaffolding/extensions/integrations/aave.ts +6 -8
  62. package/src/scaffolding/extensions/integrations/compound.ts +10 -11
  63. package/src/scaffolding/extensions/integrations/curve.ts +72 -68
  64. package/src/scaffolding/extensions/integrations/idle.ts +9 -11
  65. package/src/scaffolding/extensions/integrations/index.ts +2 -0
  66. package/src/scaffolding/extensions/integrations/mock.ts +11 -13
  67. package/src/scaffolding/extensions/integrations/paraSwapV4.ts +16 -11
  68. package/src/scaffolding/extensions/integrations/paraSwapV5.ts +73 -0
  69. package/src/scaffolding/extensions/integrations/poolTogetherV4.ts +117 -0
  70. package/src/scaffolding/extensions/integrations/synthetix.ts +45 -12
  71. package/src/scaffolding/extensions/integrations/trackedAssets.ts +3 -4
  72. package/src/scaffolding/extensions/integrations/uniswapV2.ts +31 -27
  73. package/src/scaffolding/extensions/integrations/uniswapV3.ts +9 -10
  74. package/src/scaffolding/extensions/integrations/yearn.ts +9 -11
  75. package/src/scaffolding/extensions/integrations/zeroExV2.ts +9 -7
  76. package/src/scaffolding/extensions/policies.ts +2 -1
  77. package/src/scaffolding/setup.ts +27 -19
  78. package/src/scaffolding/shares.ts +5 -4
  79. package/src/scaffolding/vaultCalls.ts +50 -3
  80. package/src/whales.ts +26 -17
  81. package/tsconfig.json +2 -1
@@ -0,0 +1,73 @@
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
+ import type {
4
+ ComptrollerLib,
5
+ IntegrationManager,
6
+ ParaSwapV5Adapter,
7
+ ParaSwapV5Path,
8
+ StandardToken,
9
+ } from '@enzymefinance/protocol';
10
+ import {
11
+ callOnIntegrationArgs,
12
+ IntegrationManagerActionId,
13
+ paraSwapV5TakeOrderArgs,
14
+ takeOrderSelector,
15
+ } from '@enzymefinance/protocol';
16
+ import type { BigNumberish, BytesLike } from 'ethers';
17
+ import { utils } from 'ethers';
18
+
19
+ // ParaSwapV5Path
20
+ export function paraSwapV5GenerateDummyPaths({ toTokens }: { toTokens: AddressLike[] }) {
21
+ return toTokens.map((toToken) => {
22
+ return {
23
+ // Not supported in our protocol
24
+ adapters: [],
25
+
26
+ to: toToken,
27
+ totalNetworkFee: 0, // Can ignore this param in the dummy
28
+ };
29
+ });
30
+ }
31
+
32
+ export async function paraSwapV5TakeOrder({
33
+ comptrollerProxy,
34
+ integrationManager,
35
+ fundOwner,
36
+ paraSwapV5Adapter,
37
+ outgoingAsset,
38
+ outgoingAssetAmount,
39
+ minIncomingAssetAmount = 1,
40
+ expectedIncomingAssetAmount = minIncomingAssetAmount,
41
+ uuid = utils.randomBytes(16),
42
+ paths,
43
+ }: {
44
+ comptrollerProxy: ComptrollerLib;
45
+ integrationManager: IntegrationManager;
46
+ fundOwner: SignerWithAddress;
47
+ paraSwapV5Adapter: ParaSwapV5Adapter;
48
+ outgoingAsset: StandardToken;
49
+ outgoingAssetAmount: BigNumberish;
50
+ minIncomingAssetAmount?: BigNumberish;
51
+ expectedIncomingAssetAmount?: BigNumberish;
52
+ uuid?: BytesLike;
53
+ paths: ParaSwapV5Path[];
54
+ }) {
55
+ const takeOrderArgs = paraSwapV5TakeOrderArgs({
56
+ expectedIncomingAssetAmount,
57
+ minIncomingAssetAmount,
58
+ outgoingAsset,
59
+ outgoingAssetAmount,
60
+ paths,
61
+ uuid,
62
+ });
63
+
64
+ const callArgs = callOnIntegrationArgs({
65
+ adapter: paraSwapV5Adapter,
66
+ encodedCallArgs: takeOrderArgs,
67
+ selector: takeOrderSelector,
68
+ });
69
+
70
+ return comptrollerProxy
71
+ .connect(fundOwner)
72
+ .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
73
+ }
@@ -0,0 +1,117 @@
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
+ import type { ComptrollerLib, IntegrationManager, PoolTogetherV4Adapter, StandardToken } from '@enzymefinance/protocol';
4
+ import {
5
+ callOnIntegrationArgs,
6
+ claimRewardsSelector,
7
+ IntegrationManagerActionId,
8
+ lendSelector,
9
+ poolTogetherV4ClaimRewardsArgs,
10
+ poolTogetherV4LendArgs,
11
+ poolTogetherV4RedeemArgs,
12
+ redeemSelector,
13
+ } from '@enzymefinance/protocol';
14
+ import type { BigNumberish, BytesLike } from 'ethers';
15
+ import { utils } from 'ethers';
16
+
17
+ export async function poolTogetherV4Lend({
18
+ comptrollerProxy,
19
+ integrationManager,
20
+ fundOwner,
21
+ poolTogetherV4Adapter,
22
+ ptToken,
23
+ amount = utils.parseEther('1'),
24
+ }: {
25
+ comptrollerProxy: ComptrollerLib;
26
+ integrationManager: IntegrationManager;
27
+ fundOwner: SignerWithAddress;
28
+ poolTogetherV4Adapter: PoolTogetherV4Adapter;
29
+ ptToken: StandardToken;
30
+ amount?: BigNumberish;
31
+ }) {
32
+ const lendArgs = poolTogetherV4LendArgs({
33
+ amount,
34
+ ptToken,
35
+ });
36
+
37
+ const callArgs = callOnIntegrationArgs({
38
+ adapter: poolTogetherV4Adapter,
39
+ encodedCallArgs: lendArgs,
40
+ selector: lendSelector,
41
+ });
42
+
43
+ const lendTx = comptrollerProxy
44
+ .connect(fundOwner)
45
+ .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
46
+
47
+ return lendTx;
48
+ }
49
+
50
+ export async function poolTogetherV4Redeem({
51
+ comptrollerProxy,
52
+ integrationManager,
53
+ fundOwner,
54
+ poolTogetherV4Adapter,
55
+ ptToken,
56
+ amount = utils.parseEther('1'),
57
+ }: {
58
+ comptrollerProxy: ComptrollerLib;
59
+ integrationManager: IntegrationManager;
60
+ fundOwner: SignerWithAddress;
61
+ poolTogetherV4Adapter: PoolTogetherV4Adapter;
62
+ ptToken: StandardToken;
63
+ amount?: BigNumberish;
64
+ }) {
65
+ const redeemArgs = poolTogetherV4RedeemArgs({
66
+ amount,
67
+ ptToken,
68
+ });
69
+
70
+ const callArgs = callOnIntegrationArgs({
71
+ adapter: poolTogetherV4Adapter,
72
+ encodedCallArgs: redeemArgs,
73
+ selector: redeemSelector,
74
+ });
75
+
76
+ const redeemTx = comptrollerProxy
77
+ .connect(fundOwner)
78
+ .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
79
+
80
+ return redeemTx;
81
+ }
82
+
83
+ export async function poolTogetherV4ClaimRewards({
84
+ comptrollerProxy,
85
+ integrationManager,
86
+ fundOwner,
87
+ poolTogetherV4Adapter,
88
+ prizeDistributor,
89
+ drawIds,
90
+ winningPicks,
91
+ }: {
92
+ comptrollerProxy: ComptrollerLib;
93
+ integrationManager: IntegrationManager;
94
+ fundOwner: SignerWithAddress;
95
+ poolTogetherV4Adapter: PoolTogetherV4Adapter;
96
+ prizeDistributor: AddressLike;
97
+ drawIds: BigNumberish[];
98
+ winningPicks: BytesLike;
99
+ }) {
100
+ const claimRewardsArgs = poolTogetherV4ClaimRewardsArgs({
101
+ drawIds,
102
+ prizeDistributor,
103
+ winningPicks,
104
+ });
105
+
106
+ const callArgs = callOnIntegrationArgs({
107
+ adapter: poolTogetherV4Adapter,
108
+ encodedCallArgs: claimRewardsArgs,
109
+ selector: claimRewardsSelector,
110
+ });
111
+
112
+ const claimTx = comptrollerProxy
113
+ .connect(fundOwner)
114
+ .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
115
+
116
+ return claimTx;
117
+ }
@@ -1,19 +1,24 @@
1
- import { AddressLike } from '@enzymefinance/ethers';
2
- import {
3
- callOnIntegrationArgs,
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type {
4
3
  ComptrollerLib,
5
- encodeArgs,
6
4
  IntegrationManager,
7
- IntegrationManagerActionId,
8
5
  ISynthetixAddressResolver,
9
6
  StandardToken,
10
7
  SynthetixAdapter,
8
+ VaultLib,
9
+ } from '@enzymefinance/protocol';
10
+ import {
11
+ callOnIntegrationArgs,
12
+ encodeArgs,
13
+ IntegrationManagerActionId,
14
+ redeemSelector,
11
15
  synthetixAssignExchangeDelegateSelector,
16
+ synthetixRedeemArgs,
12
17
  synthetixTakeOrderArgs,
13
18
  takeOrderSelector,
14
- VaultLib,
15
19
  } from '@enzymefinance/protocol';
16
- import { BigNumberish, Signer, utils } from 'ethers';
20
+ import type { BigNumberish, Signer } from 'ethers';
21
+ import { utils } from 'ethers';
17
22
 
18
23
  export async function synthetixAssignExchangeDelegate({
19
24
  comptrollerProxy,
@@ -50,6 +55,34 @@ export async function synthetixResolveAddress({
50
55
  return addressResolver.requireAndGetAddress(utils.formatBytes32String(name), `Missing ${name}`);
51
56
  }
52
57
 
58
+ export async function synthetixRedeem({
59
+ comptrollerProxy,
60
+ integrationManager,
61
+ signer,
62
+ synthetixAdapter,
63
+ synths,
64
+ }: {
65
+ comptrollerProxy: ComptrollerLib;
66
+ integrationManager: IntegrationManager;
67
+ signer: Signer;
68
+ synthetixAdapter: SynthetixAdapter;
69
+ synths: AddressLike[];
70
+ }) {
71
+ const redeemArgs = synthetixRedeemArgs({
72
+ synths,
73
+ });
74
+
75
+ const callArgs = callOnIntegrationArgs({
76
+ adapter: synthetixAdapter,
77
+ encodedCallArgs: redeemArgs,
78
+ selector: redeemSelector,
79
+ });
80
+
81
+ return comptrollerProxy
82
+ .connect(signer)
83
+ .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
84
+ }
85
+
53
86
  export async function synthetixTakeOrder({
54
87
  comptrollerProxy,
55
88
  vaultProxy,
@@ -79,16 +112,16 @@ export async function synthetixTakeOrder({
79
112
  }
80
113
 
81
114
  const takeOrderArgs = synthetixTakeOrderArgs({
82
- incomingAsset: incomingAsset,
83
- minIncomingAssetAmount: minIncomingAssetAmount,
84
- outgoingAsset: outgoingAsset,
85
- outgoingAssetAmount: outgoingAssetAmount,
115
+ incomingAsset,
116
+ minIncomingAssetAmount,
117
+ outgoingAsset,
118
+ outgoingAssetAmount,
86
119
  });
87
120
 
88
121
  const callArgs = await callOnIntegrationArgs({
89
122
  adapter: synthetixAdapter,
90
- selector: takeOrderSelector,
91
123
  encodedCallArgs: takeOrderArgs,
124
+ selector: takeOrderSelector,
92
125
  });
93
126
 
94
127
  return comptrollerProxy
@@ -1,9 +1,8 @@
1
- import { AddressLike } from '@enzymefinance/ethers';
2
- import { SignerWithAddress } from '@enzymefinance/hardhat';
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
+ import type { ComptrollerLib, IntegrationManager } from '@enzymefinance/protocol';
3
4
  import {
4
5
  addTrackedAssetsToVaultArgs,
5
- ComptrollerLib,
6
- IntegrationManager,
7
6
  IntegrationManagerActionId,
8
7
  removeTrackedAssetsFromVaultArgs,
9
8
  } from '@enzymefinance/protocol';
@@ -1,21 +1,25 @@
1
- import { AddressLike, Call, Contract, contract, Send } from '@enzymefinance/ethers';
2
- import { SignerWithAddress } from '@enzymefinance/hardhat';
3
- import {
4
- callOnIntegrationArgs,
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
5
  ComptrollerLib,
6
6
  IntegrationManager,
7
+ StandardToken,
8
+ UniswapV2ExchangeAdapter,
9
+ UniswapV2LiquidityAdapter,
10
+ VaultLib,
11
+ } from '@enzymefinance/protocol';
12
+ import {
13
+ callOnIntegrationArgs,
7
14
  IntegrationManagerActionId,
8
15
  lendSelector,
9
16
  redeemSelector,
10
- StandardToken,
11
17
  takeOrderSelector,
12
- UniswapV2Adapter,
13
18
  uniswapV2LendArgs,
14
19
  uniswapV2RedeemArgs,
15
20
  uniswapV2TakeOrderArgs,
16
- VaultLib,
17
21
  } from '@enzymefinance/protocol';
18
- import { BigNumberish } from 'ethers';
22
+ import type { BigNumberish } from 'ethers';
19
23
 
20
24
  export interface UniswapV2Factory extends Contract<UniswapV2Factory> {
21
25
  createPair: Send<(_token0: AddressLike, _token1: AddressLike) => AddressLike>;
@@ -32,7 +36,7 @@ export async function uniswapV2Lend({
32
36
  vaultProxy,
33
37
  integrationManager,
34
38
  fundOwner,
35
- uniswapV2Adapter,
39
+ uniswapV2LiquidityAdapter,
36
40
  tokenA,
37
41
  tokenB,
38
42
  amountADesired,
@@ -46,7 +50,7 @@ export async function uniswapV2Lend({
46
50
  vaultProxy: VaultLib;
47
51
  integrationManager: IntegrationManager;
48
52
  fundOwner: SignerWithAddress;
49
- uniswapV2Adapter: UniswapV2Adapter;
53
+ uniswapV2LiquidityAdapter: UniswapV2LiquidityAdapter;
50
54
  tokenA: StandardToken;
51
55
  tokenB: StandardToken;
52
56
  amountADesired: BigNumberish;
@@ -63,19 +67,19 @@ export async function uniswapV2Lend({
63
67
  }
64
68
 
65
69
  const lendArgs = uniswapV2LendArgs({
66
- tokenA,
67
- tokenB,
68
70
  amountADesired,
69
- amountBDesired,
70
71
  amountAMin,
72
+ amountBDesired,
71
73
  amountBMin,
72
74
  minPoolTokenAmount,
75
+ tokenA,
76
+ tokenB,
73
77
  });
74
78
 
75
79
  const callArgs = callOnIntegrationArgs({
76
- adapter: uniswapV2Adapter,
77
- selector: lendSelector,
80
+ adapter: uniswapV2LiquidityAdapter,
78
81
  encodedCallArgs: lendArgs,
82
+ selector: lendSelector,
79
83
  });
80
84
 
81
85
  const lendTx = comptrollerProxy
@@ -90,7 +94,7 @@ export async function uniswapV2Redeem({
90
94
  comptrollerProxy,
91
95
  integrationManager,
92
96
  fundOwner,
93
- uniswapV2Adapter,
97
+ uniswapV2LiquidityAdapter,
94
98
  poolTokenAmount,
95
99
  tokenA,
96
100
  tokenB,
@@ -100,7 +104,7 @@ export async function uniswapV2Redeem({
100
104
  comptrollerProxy: ComptrollerLib;
101
105
  integrationManager: IntegrationManager;
102
106
  fundOwner: SignerWithAddress;
103
- uniswapV2Adapter: UniswapV2Adapter;
107
+ uniswapV2LiquidityAdapter: UniswapV2LiquidityAdapter;
104
108
  poolTokenAmount: BigNumberish;
105
109
  tokenA: AddressLike;
106
110
  tokenB: AddressLike;
@@ -108,16 +112,16 @@ export async function uniswapV2Redeem({
108
112
  amountBMin: BigNumberish;
109
113
  }) {
110
114
  const redeemArgs = uniswapV2RedeemArgs({
115
+ amountAMin,
116
+ amountBMin,
111
117
  poolTokenAmount,
112
118
  tokenA,
113
119
  tokenB,
114
- amountAMin,
115
- amountBMin,
116
120
  });
117
121
  const callArgs = callOnIntegrationArgs({
118
- adapter: uniswapV2Adapter,
119
- selector: redeemSelector,
122
+ adapter: uniswapV2LiquidityAdapter,
120
123
  encodedCallArgs: redeemArgs,
124
+ selector: redeemSelector,
121
125
  });
122
126
 
123
127
  const redeemTx = comptrollerProxy
@@ -133,7 +137,7 @@ export async function uniswapV2TakeOrder({
133
137
  vaultProxy,
134
138
  integrationManager,
135
139
  fundOwner,
136
- uniswapV2Adapter,
140
+ uniswapV2ExchangeAdapter,
137
141
  path,
138
142
  outgoingAssetAmount,
139
143
  minIncomingAssetAmount,
@@ -143,7 +147,7 @@ export async function uniswapV2TakeOrder({
143
147
  vaultProxy: VaultLib;
144
148
  integrationManager: IntegrationManager;
145
149
  fundOwner: SignerWithAddress;
146
- uniswapV2Adapter: UniswapV2Adapter;
150
+ uniswapV2ExchangeAdapter: UniswapV2ExchangeAdapter;
147
151
  path: StandardToken[];
148
152
  outgoingAssetAmount: BigNumberish;
149
153
  minIncomingAssetAmount: BigNumberish;
@@ -155,14 +159,14 @@ export async function uniswapV2TakeOrder({
155
159
  }
156
160
 
157
161
  const takeOrderArgs = uniswapV2TakeOrderArgs({
158
- path,
159
- outgoingAssetAmount,
160
162
  minIncomingAssetAmount,
163
+ outgoingAssetAmount,
164
+ path,
161
165
  });
162
166
  const callArgs = callOnIntegrationArgs({
163
- adapter: uniswapV2Adapter,
164
- selector: takeOrderSelector,
167
+ adapter: uniswapV2ExchangeAdapter,
165
168
  encodedCallArgs: takeOrderArgs,
169
+ selector: takeOrderSelector,
166
170
  });
167
171
 
168
172
  return comptrollerProxy
@@ -1,15 +1,13 @@
1
- import { AddressLike } from '@enzymefinance/ethers';
2
- import { SignerWithAddress } from '@enzymefinance/hardhat';
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
+ import type { ComptrollerLib, IntegrationManager, StandardToken } from '@enzymefinance/protocol';
3
4
  import {
4
5
  callOnIntegrationArgs,
5
- ComptrollerLib,
6
- IntegrationManager,
7
6
  IntegrationManagerActionId,
8
- StandardToken,
9
7
  takeOrderSelector,
10
8
  uniswapV3TakeOrderArgs,
11
9
  } from '@enzymefinance/protocol';
12
- import { BigNumber, BigNumberish } from 'ethers';
10
+ import type { BigNumber, BigNumberish } from 'ethers';
13
11
 
14
12
  export async function uniswapV3TakeOrder({
15
13
  comptrollerProxy,
@@ -34,20 +32,21 @@ export async function uniswapV3TakeOrder({
34
32
  }) {
35
33
  if (seedFund) {
36
34
  // Seed the VaultProxy with enough outgoingAsset for the tx
37
- await pathAddresses[0].transfer(await comptrollerProxy.getVaultProxy(), outgoingAssetAmount);
35
+ const vaultProxy = await comptrollerProxy.getVaultProxy();
36
+ await pathAddresses[0].transfer(vaultProxy, outgoingAssetAmount);
38
37
  }
39
38
 
40
39
  const takeOrderArgs = uniswapV3TakeOrderArgs({
40
+ minIncomingAssetAmount,
41
+ outgoingAssetAmount,
41
42
  pathAddresses,
42
43
  pathFees,
43
- outgoingAssetAmount,
44
- minIncomingAssetAmount,
45
44
  });
46
45
 
47
46
  const callArgs = callOnIntegrationArgs({
48
47
  adapter: uniswapV3Adapter,
49
- selector: takeOrderSelector,
50
48
  encodedCallArgs: takeOrderArgs,
49
+ selector: takeOrderSelector,
51
50
  });
52
51
 
53
52
  return comptrollerProxy
@@ -1,17 +1,15 @@
1
- import { SignerWithAddress } from '@enzymefinance/hardhat';
1
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
2
+ import type { ComptrollerLib, IntegrationManager, StandardToken, YearnVaultV2Adapter } from '@enzymefinance/protocol';
2
3
  import {
3
4
  callOnIntegrationArgs,
4
- ComptrollerLib,
5
- IntegrationManager,
6
5
  IntegrationManagerActionId,
7
6
  lendSelector,
8
7
  redeemSelector,
9
- StandardToken,
10
- YearnVaultV2Adapter,
11
8
  yearnVaultV2LendArgs,
12
9
  yearnVaultV2RedeemArgs,
13
10
  } from '@enzymefinance/protocol';
14
- import { BigNumber, BigNumberish } from 'ethers';
11
+ import type { BigNumberish } from 'ethers';
12
+ import { BigNumber } from 'ethers';
15
13
 
16
14
  export async function yearnVaultV2Lend({
17
15
  signer,
@@ -32,12 +30,12 @@ export async function yearnVaultV2Lend({
32
30
  }) {
33
31
  const callArgs = callOnIntegrationArgs({
34
32
  adapter: yearnVaultV2Adapter,
35
- selector: lendSelector,
36
33
  encodedCallArgs: yearnVaultV2LendArgs({
37
- yVault,
38
- outgoingUnderlyingAmount,
39
34
  minIncomingYVaultSharesAmount,
35
+ outgoingUnderlyingAmount,
36
+ yVault,
40
37
  }),
38
+ selector: lendSelector,
41
39
  });
42
40
 
43
41
  return comptrollerProxy
@@ -66,13 +64,13 @@ export async function yearnVaultV2Redeem({
66
64
  }) {
67
65
  const callArgs = callOnIntegrationArgs({
68
66
  adapter: yearnVaultV2Adapter,
69
- selector: redeemSelector,
70
67
  encodedCallArgs: yearnVaultV2RedeemArgs({
71
- yVault,
72
68
  maxOutgoingYVaultSharesAmount,
73
69
  minIncomingUnderlyingAmount,
74
70
  slippageToleranceBps,
71
+ yVault,
75
72
  }),
73
+ selector: redeemSelector,
76
74
  });
77
75
 
78
76
  return comptrollerProxy
@@ -1,16 +1,18 @@
1
- import { SignerWithAddress } from '@enzymefinance/hardhat';
2
- import {
1
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
2
+ import type {
3
3
  ComptrollerLib,
4
4
  IntegrationManager,
5
- ZeroExV2Adapter,
6
- VaultLib,
7
5
  SignedZeroExV2Order,
6
+ VaultLib,
7
+ ZeroExV2Adapter,
8
+ } from '@enzymefinance/protocol';
9
+ import {
8
10
  callOnIntegrationArgs,
11
+ IntegrationManagerActionId,
9
12
  takeOrderSelector,
10
13
  zeroExV2TakeOrderArgs,
11
- IntegrationManagerActionId,
12
14
  } from '@enzymefinance/protocol';
13
- import { BigNumberish } from 'ethers';
15
+ import type { BigNumberish } from 'ethers';
14
16
 
15
17
  export async function zeroExV2TakeOrder({
16
18
  comptrollerProxy,
@@ -35,8 +37,8 @@ export async function zeroExV2TakeOrder({
35
37
 
36
38
  const callArgs = callOnIntegrationArgs({
37
39
  adapter: zeroExV2Adapter,
38
- selector: takeOrderSelector,
39
40
  encodedCallArgs: takeOrderArgs,
41
+ selector: takeOrderSelector,
40
42
  });
41
43
 
42
44
  return comptrollerProxy
@@ -1,5 +1,6 @@
1
1
  import { IPolicy, PolicyHook, policyManagerConfigArgs } from '@enzymefinance/protocol';
2
- import { constants, Signer, utils } from 'ethers';
2
+ import type { Signer } from 'ethers';
3
+ import { constants, utils } from 'ethers';
3
4
 
4
5
  // Policy Manager
5
6