@enzymefinance/testutils 4.0.0 → 4.0.1

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 (92) hide show
  1. package/dist/index.d.ts +1548 -0
  2. package/dist/index.js +3352 -0
  3. package/dist/index.mjs +3352 -0
  4. package/package.json +74 -11
  5. package/CHANGELOG.md +0 -84
  6. package/dist/declarations/src/assertions.d.ts +0 -4
  7. package/dist/declarations/src/deployment.d.ts +0 -188
  8. package/dist/declarations/src/gasRelayer.d.ts +0 -56
  9. package/dist/declarations/src/helpers.d.ts +0 -16
  10. package/dist/declarations/src/index.d.ts +0 -6
  11. package/dist/declarations/src/scaffolding/assets.d.ts +0 -10
  12. package/dist/declarations/src/scaffolding/chainlink.d.ts +0 -3
  13. package/dist/declarations/src/scaffolding/common.d.ts +0 -7
  14. package/dist/declarations/src/scaffolding/core.d.ts +0 -16
  15. package/dist/declarations/src/scaffolding/extensions/common.d.ts +0 -11
  16. package/dist/declarations/src/scaffolding/extensions/external-positions/aave-debt.d.ts +0 -51
  17. package/dist/declarations/src/scaffolding/extensions/external-positions/actions.d.ts +0 -36
  18. package/dist/declarations/src/scaffolding/extensions/external-positions/compound.d.ts +0 -56
  19. package/dist/declarations/src/scaffolding/extensions/external-positions/index.d.ts +0 -5
  20. package/dist/declarations/src/scaffolding/extensions/external-positions/mocks.d.ts +0 -56
  21. package/dist/declarations/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.d.ts +0 -100
  22. package/dist/declarations/src/scaffolding/extensions/fees.d.ts +0 -12
  23. package/dist/declarations/src/scaffolding/extensions/index.d.ts +0 -5
  24. package/dist/declarations/src/scaffolding/extensions/integrations/aave.d.ts +0 -20
  25. package/dist/declarations/src/scaffolding/extensions/integrations/compound.d.ts +0 -56
  26. package/dist/declarations/src/scaffolding/extensions/integrations/curve.d.ts +0 -106
  27. package/dist/declarations/src/scaffolding/extensions/integrations/idle.d.ts +0 -28
  28. package/dist/declarations/src/scaffolding/extensions/integrations/index.d.ts +0 -14
  29. package/dist/declarations/src/scaffolding/extensions/integrations/mock.d.ts +0 -32
  30. package/dist/declarations/src/scaffolding/extensions/integrations/olympusV2.d.ts +0 -17
  31. package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV5.d.ts +0 -23
  32. package/dist/declarations/src/scaffolding/extensions/integrations/poolTogetherV4.d.ts +0 -29
  33. package/dist/declarations/src/scaffolding/extensions/integrations/synthetix.d.ts +0 -28
  34. package/dist/declarations/src/scaffolding/extensions/integrations/trackedAssets.d.ts +0 -15
  35. package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV2.d.ts +0 -46
  36. package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV3.d.ts +0 -15
  37. package/dist/declarations/src/scaffolding/extensions/integrations/yearn.d.ts +0 -22
  38. package/dist/declarations/src/scaffolding/extensions/integrations/zeroExV2.d.ts +0 -12
  39. package/dist/declarations/src/scaffolding/extensions/policies.d.ts +0 -17
  40. package/dist/declarations/src/scaffolding/index.d.ts +0 -8
  41. package/dist/declarations/src/scaffolding/setup.d.ts +0 -77
  42. package/dist/declarations/src/scaffolding/shares.d.ts +0 -35
  43. package/dist/declarations/src/scaffolding/vaultCalls.d.ts +0 -32
  44. package/dist/declarations/src/whales.d.ts +0 -49
  45. package/dist/enzymefinance-testutils.browser.cjs.js +0 -4158
  46. package/dist/enzymefinance-testutils.browser.esm.js +0 -4028
  47. package/dist/enzymefinance-testutils.cjs.d.ts +0 -1
  48. package/dist/enzymefinance-testutils.cjs.dev.js +0 -4158
  49. package/dist/enzymefinance-testutils.cjs.js +0 -7
  50. package/dist/enzymefinance-testutils.cjs.prod.js +0 -4158
  51. package/dist/enzymefinance-testutils.esm.js +0 -4028
  52. package/src/assertions.ts +0 -23
  53. package/src/deployment.ts +0 -280
  54. package/src/gasRelayer.ts +0 -95
  55. package/src/helpers.ts +0 -39
  56. package/src/index.ts +0 -6
  57. package/src/scaffolding/assets.ts +0 -37
  58. package/src/scaffolding/chainlink.ts +0 -8
  59. package/src/scaffolding/common.ts +0 -11
  60. package/src/scaffolding/core.ts +0 -103
  61. package/src/scaffolding/extensions/common.ts +0 -30
  62. package/src/scaffolding/extensions/external-positions/aave-debt.ts +0 -179
  63. package/src/scaffolding/extensions/external-positions/actions.ts +0 -108
  64. package/src/scaffolding/extensions/external-positions/compound.ts +0 -190
  65. package/src/scaffolding/extensions/external-positions/index.ts +0 -5
  66. package/src/scaffolding/extensions/external-positions/mocks.ts +0 -191
  67. package/src/scaffolding/extensions/external-positions/uniswap-v3-liquidity.ts +0 -284
  68. package/src/scaffolding/extensions/fees.ts +0 -70
  69. package/src/scaffolding/extensions/index.ts +0 -5
  70. package/src/scaffolding/extensions/integrations/aave.ts +0 -78
  71. package/src/scaffolding/extensions/integrations/compound.ts +0 -255
  72. package/src/scaffolding/extensions/integrations/curve.ts +0 -354
  73. package/src/scaffolding/extensions/integrations/idle.ts +0 -104
  74. package/src/scaffolding/extensions/integrations/index.ts +0 -14
  75. package/src/scaffolding/extensions/integrations/mock.ts +0 -116
  76. package/src/scaffolding/extensions/integrations/olympusV2.ts +0 -71
  77. package/src/scaffolding/extensions/integrations/paraSwapV5.ts +0 -73
  78. package/src/scaffolding/extensions/integrations/poolTogetherV4.ts +0 -117
  79. package/src/scaffolding/extensions/integrations/synthetix.ts +0 -111
  80. package/src/scaffolding/extensions/integrations/trackedAssets.ts +0 -48
  81. package/src/scaffolding/extensions/integrations/uniswapV2.ts +0 -175
  82. package/src/scaffolding/extensions/integrations/uniswapV3.ts +0 -55
  83. package/src/scaffolding/extensions/integrations/yearn.ts +0 -79
  84. package/src/scaffolding/extensions/integrations/zeroExV2.ts +0 -47
  85. package/src/scaffolding/extensions/policies.ts +0 -112
  86. package/src/scaffolding/index.ts +0 -8
  87. package/src/scaffolding/setup.ts +0 -243
  88. package/src/scaffolding/shares.ts +0 -80
  89. package/src/scaffolding/vaultCalls.ts +0 -105
  90. package/src/types.d.ts +0 -2
  91. package/src/whales.ts +0 -82
  92. package/tsconfig.json +0 -5
@@ -1,354 +0,0 @@
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
- CurveLiquidityAdapter,
8
- CurveRedeemType,
9
- IntegrationManager,
10
- StandardToken,
11
- } from '@enzymefinance/protocol';
12
- import {
13
- callOnIntegrationArgs,
14
- claimRewardsSelector,
15
- curveClaimRewardsArgs,
16
- curveLendAndStakeArgs,
17
- curveLendArgs,
18
- curveRedeemArgs,
19
- curveStakeArgs,
20
- curveTakeOrderArgs,
21
- curveUnstakeAndRedeemArgs,
22
- curveUnstakeArgs,
23
- IntegrationManagerActionId,
24
- lendAndStakeSelector,
25
- lendSelector,
26
- redeemSelector,
27
- stakeSelector,
28
- takeOrderSelector,
29
- unstakeAndRedeemSelector,
30
- unstakeSelector,
31
- } from '@enzymefinance/protocol';
32
- import type { BigNumberish, BytesLike } from 'ethers';
33
- import { BigNumber, utils } from 'ethers';
34
-
35
- export interface CurveLiquidityGaugeV2 extends Contract<CurveLiquidityGaugeV2> {
36
- claim_rewards: Send<(_addr: AddressLike) => void>;
37
- integrate_fraction: Call<(_for: AddressLike) => BigNumber, Contract<any>>;
38
- }
39
-
40
- export const CurveLiquidityGaugeV2 = contract<CurveLiquidityGaugeV2>()`
41
- function claim_rewards(address)
42
- function integrate_fraction(address) view returns (uint256)
43
- `;
44
-
45
- export interface CurveRegistry extends Contract<CurveRegistry> {
46
- get_coins: Call<(_pool: AddressLike) => AddressLike[], Contract<any>>;
47
- get_lp_token: Call<(_pool: AddressLike) => AddressLike, Contract<any>>;
48
- }
49
-
50
- export const CurveRegistry = contract<CurveRegistry>()`
51
- function get_coins(address) view returns (address[8])
52
- function get_lp_token(address) view returns (address)
53
- `;
54
-
55
- // prettier-ignore
56
- export interface CurveSwaps extends Contract<CurveSwaps> {
57
- get_best_rate: Call<(_from: AddressLike, to: AddressLike, amount: BigNumberish) => { bestPool: AddressLike, amountReceived: BigNumber }, CurveSwaps>
58
- }
59
-
60
- export const CurveSwaps = contract<CurveSwaps>()`
61
- function get_best_rate(address _from, address to, uint256 amount) view returns (address bestPool, uint256 amountReceived)
62
- `;
63
-
64
- export interface CurveMinter extends Contract<CurveMinter> {
65
- mint_for: Send<(_gauge_address: AddressLike, _for: AddressLike) => void>;
66
- }
67
-
68
- export const CurveMinter = contract<CurveMinter>()`
69
- function mint_for(address,address)
70
- `;
71
-
72
- // exchanges
73
-
74
- export async function curveTakeOrder({
75
- comptrollerProxy,
76
- integrationManager,
77
- fundOwner,
78
- curveExchangeAdapter,
79
- pool,
80
- outgoingAsset,
81
- outgoingAssetAmount = utils.parseEther('1'),
82
- incomingAsset,
83
- minIncomingAssetAmount = utils.parseEther('1'),
84
- }: {
85
- comptrollerProxy: ComptrollerLib;
86
- integrationManager: IntegrationManager;
87
- fundOwner: SignerWithAddress;
88
- curveExchangeAdapter: CurveExchangeAdapter;
89
- pool: AddressLike;
90
- outgoingAsset: StandardToken;
91
- outgoingAssetAmount?: BigNumberish;
92
- incomingAsset: StandardToken;
93
- minIncomingAssetAmount?: BigNumberish;
94
- }) {
95
- const takeOrderArgs = curveTakeOrderArgs({
96
- incomingAsset,
97
- minIncomingAssetAmount,
98
- outgoingAsset,
99
- outgoingAssetAmount,
100
- pool,
101
- });
102
-
103
- const callArgs = callOnIntegrationArgs({
104
- adapter: curveExchangeAdapter,
105
- encodedCallArgs: takeOrderArgs,
106
- selector: takeOrderSelector,
107
- });
108
-
109
- return comptrollerProxy
110
- .connect(fundOwner)
111
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
112
- }
113
-
114
- // combined liquidity
115
-
116
- export function curveClaimRewards({
117
- comptrollerProxy,
118
- integrationManager,
119
- fundOwner,
120
- curveLiquidityAdapter,
121
- stakingToken,
122
- }: {
123
- comptrollerProxy: ComptrollerLib;
124
- integrationManager: IntegrationManager;
125
- fundOwner: SignerWithAddress;
126
- curveLiquidityAdapter: CurveLiquidityAdapter;
127
- stakingToken: AddressLike;
128
- }) {
129
- const callArgs = callOnIntegrationArgs({
130
- adapter: curveLiquidityAdapter,
131
- encodedCallArgs: curveClaimRewardsArgs({ stakingToken }),
132
- selector: claimRewardsSelector,
133
- });
134
-
135
- return comptrollerProxy
136
- .connect(fundOwner)
137
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
138
- }
139
-
140
- export async function curveLend({
141
- comptrollerProxy,
142
- integrationManager,
143
- signer,
144
- curveLiquidityAdapter,
145
- pool,
146
- orderedOutgoingAssetAmounts,
147
- minIncomingLpTokenAmount = BigNumber.from(1),
148
- useUnderlyings,
149
- }: {
150
- comptrollerProxy: ComptrollerLib;
151
- integrationManager: IntegrationManager;
152
- signer: SignerWithAddress;
153
- curveLiquidityAdapter: CurveLiquidityAdapter;
154
- pool: AddressLike;
155
- orderedOutgoingAssetAmounts: BigNumberish[];
156
- minIncomingLpTokenAmount?: BigNumberish;
157
- useUnderlyings: boolean;
158
- }) {
159
- const callArgs = callOnIntegrationArgs({
160
- adapter: curveLiquidityAdapter,
161
- encodedCallArgs: curveLendArgs({
162
- minIncomingLpTokenAmount,
163
- orderedOutgoingAssetAmounts,
164
- pool,
165
- useUnderlyings,
166
- }),
167
- selector: lendSelector,
168
- });
169
-
170
- return comptrollerProxy
171
- .connect(signer)
172
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
173
- }
174
-
175
- export async function curveLendAndStake({
176
- comptrollerProxy,
177
- integrationManager,
178
- signer,
179
- curveLiquidityAdapter,
180
- pool,
181
- orderedOutgoingAssetAmounts,
182
- incomingStakingToken,
183
- minIncomingStakingTokenAmount = BigNumber.from(1),
184
- useUnderlyings,
185
- }: {
186
- comptrollerProxy: ComptrollerLib;
187
- integrationManager: IntegrationManager;
188
- signer: SignerWithAddress;
189
- curveLiquidityAdapter: CurveLiquidityAdapter;
190
- pool: AddressLike;
191
- orderedOutgoingAssetAmounts: BigNumberish[];
192
- incomingStakingToken: AddressLike;
193
- minIncomingStakingTokenAmount?: BigNumberish;
194
- useUnderlyings: boolean;
195
- }) {
196
- const callArgs = callOnIntegrationArgs({
197
- adapter: curveLiquidityAdapter,
198
- encodedCallArgs: curveLendAndStakeArgs({
199
- incomingStakingToken,
200
- minIncomingStakingTokenAmount,
201
- orderedOutgoingAssetAmounts,
202
- pool,
203
- useUnderlyings,
204
- }),
205
- selector: lendAndStakeSelector,
206
- });
207
-
208
- return comptrollerProxy
209
- .connect(signer)
210
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
211
- }
212
-
213
- export async function curveRedeem({
214
- comptrollerProxy,
215
- integrationManager,
216
- signer,
217
- curveLiquidityAdapter,
218
- pool,
219
- outgoingLpTokenAmount,
220
- useUnderlyings,
221
- redeemType,
222
- incomingAssetData,
223
- }: {
224
- comptrollerProxy: ComptrollerLib;
225
- integrationManager: IntegrationManager;
226
- signer: SignerWithAddress;
227
- curveLiquidityAdapter: CurveLiquidityAdapter;
228
- pool: AddressLike;
229
- outgoingLpTokenAmount: BigNumberish;
230
- useUnderlyings: boolean;
231
- redeemType: CurveRedeemType;
232
- incomingAssetData: BytesLike;
233
- }) {
234
- const callArgs = callOnIntegrationArgs({
235
- adapter: curveLiquidityAdapter,
236
- encodedCallArgs: curveRedeemArgs({
237
- incomingAssetData,
238
- outgoingLpTokenAmount,
239
- pool,
240
- redeemType,
241
- useUnderlyings,
242
- }),
243
- selector: redeemSelector,
244
- });
245
-
246
- return comptrollerProxy
247
- .connect(signer)
248
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
249
- }
250
-
251
- export async function curveStake({
252
- comptrollerProxy,
253
- integrationManager,
254
- signer,
255
- curveLiquidityAdapter,
256
- pool,
257
- incomingStakingToken,
258
- amount,
259
- }: {
260
- comptrollerProxy: ComptrollerLib;
261
- integrationManager: IntegrationManager;
262
- signer: SignerWithAddress;
263
- curveLiquidityAdapter: CurveLiquidityAdapter;
264
- pool: AddressLike;
265
- incomingStakingToken: AddressLike;
266
- amount: BigNumberish;
267
- }) {
268
- const callArgs = callOnIntegrationArgs({
269
- adapter: curveLiquidityAdapter,
270
- encodedCallArgs: curveStakeArgs({
271
- amount,
272
- incomingStakingToken,
273
- pool,
274
- }),
275
- selector: stakeSelector,
276
- });
277
-
278
- return comptrollerProxy
279
- .connect(signer)
280
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
281
- }
282
-
283
- export async function curveUnstake({
284
- comptrollerProxy,
285
- integrationManager,
286
- signer,
287
- curveLiquidityAdapter,
288
- pool,
289
- outgoingStakingToken,
290
- amount,
291
- }: {
292
- comptrollerProxy: ComptrollerLib;
293
- integrationManager: IntegrationManager;
294
- signer: SignerWithAddress;
295
- curveLiquidityAdapter: CurveLiquidityAdapter;
296
- pool: AddressLike;
297
- outgoingStakingToken: AddressLike;
298
- amount: BigNumberish;
299
- }) {
300
- const callArgs = callOnIntegrationArgs({
301
- adapter: curveLiquidityAdapter,
302
- encodedCallArgs: curveUnstakeArgs({
303
- amount,
304
- outgoingStakingToken,
305
- pool,
306
- }),
307
- selector: unstakeSelector,
308
- });
309
-
310
- return comptrollerProxy
311
- .connect(signer)
312
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
313
- }
314
-
315
- export async function curveUnstakeAndRedeem({
316
- comptrollerProxy,
317
- integrationManager,
318
- signer,
319
- curveLiquidityAdapter,
320
- pool,
321
- outgoingStakingToken,
322
- outgoingStakingTokenAmount,
323
- useUnderlyings,
324
- redeemType,
325
- incomingAssetData,
326
- }: {
327
- comptrollerProxy: ComptrollerLib;
328
- integrationManager: IntegrationManager;
329
- signer: SignerWithAddress;
330
- curveLiquidityAdapter: CurveLiquidityAdapter;
331
- pool: AddressLike;
332
- outgoingStakingToken: StandardToken;
333
- outgoingStakingTokenAmount: BigNumberish;
334
- useUnderlyings: boolean;
335
- redeemType: CurveRedeemType;
336
- incomingAssetData: BytesLike;
337
- }) {
338
- const callArgs = callOnIntegrationArgs({
339
- adapter: curveLiquidityAdapter,
340
- encodedCallArgs: curveUnstakeAndRedeemArgs({
341
- incomingAssetData,
342
- outgoingStakingToken,
343
- outgoingStakingTokenAmount,
344
- pool,
345
- redeemType,
346
- useUnderlyings,
347
- }),
348
- selector: unstakeAndRedeemSelector,
349
- });
350
-
351
- return comptrollerProxy
352
- .connect(signer)
353
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
354
- }
@@ -1,104 +0,0 @@
1
- import type { SignerWithAddress } from '@enzymefinance/hardhat';
2
- import type { ComptrollerLib, IdleAdapter, IntegrationManager, StandardToken } from '@enzymefinance/protocol';
3
- import {
4
- callOnIntegrationArgs,
5
- claimRewardsSelector,
6
- idleClaimRewardsArgs,
7
- idleLendArgs,
8
- idleRedeemArgs,
9
- IntegrationManagerActionId,
10
- lendSelector,
11
- redeemSelector,
12
- } from '@enzymefinance/protocol';
13
- import type { BigNumberish } from 'ethers';
14
- import { BigNumber } from 'ethers';
15
-
16
- export async function idleClaimRewards({
17
- comptrollerProxy,
18
- integrationManager,
19
- fundOwner,
20
- idleAdapter,
21
- idleToken,
22
- }: {
23
- comptrollerProxy: ComptrollerLib;
24
- integrationManager: IntegrationManager;
25
- fundOwner: SignerWithAddress;
26
- idleAdapter: IdleAdapter;
27
- idleToken: StandardToken;
28
- }) {
29
- const callArgs = callOnIntegrationArgs({
30
- adapter: idleAdapter,
31
- encodedCallArgs: idleClaimRewardsArgs({
32
- idleToken,
33
- }),
34
- selector: claimRewardsSelector,
35
- });
36
-
37
- return comptrollerProxy
38
- .connect(fundOwner)
39
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
40
- }
41
-
42
- export async function idleLend({
43
- comptrollerProxy,
44
- integrationManager,
45
- fundOwner,
46
- idleAdapter,
47
- idleToken,
48
- outgoingUnderlyingAmount,
49
- minIncomingIdleTokenAmount = BigNumber.from(1),
50
- }: {
51
- comptrollerProxy: ComptrollerLib;
52
- integrationManager: IntegrationManager;
53
- fundOwner: SignerWithAddress;
54
- idleAdapter: IdleAdapter;
55
- idleToken: StandardToken;
56
- outgoingUnderlyingAmount: BigNumberish;
57
- minIncomingIdleTokenAmount?: BigNumberish;
58
- }) {
59
- const callArgs = callOnIntegrationArgs({
60
- adapter: idleAdapter,
61
- encodedCallArgs: idleLendArgs({
62
- idleToken,
63
- minIncomingIdleTokenAmount,
64
- outgoingUnderlyingAmount,
65
- }),
66
- selector: lendSelector,
67
- });
68
-
69
- return comptrollerProxy
70
- .connect(fundOwner)
71
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
72
- }
73
-
74
- export async function idleRedeem({
75
- comptrollerProxy,
76
- integrationManager,
77
- fundOwner,
78
- idleAdapter,
79
- idleToken,
80
- outgoingIdleTokenAmount,
81
- minIncomingUnderlyingAmount = BigNumber.from(1),
82
- }: {
83
- comptrollerProxy: ComptrollerLib;
84
- integrationManager: IntegrationManager;
85
- fundOwner: SignerWithAddress;
86
- idleAdapter: IdleAdapter;
87
- idleToken: StandardToken;
88
- outgoingIdleTokenAmount: BigNumberish;
89
- minIncomingUnderlyingAmount?: BigNumberish;
90
- }) {
91
- const callArgs = callOnIntegrationArgs({
92
- adapter: idleAdapter,
93
- encodedCallArgs: idleRedeemArgs({
94
- idleToken,
95
- minIncomingUnderlyingAmount,
96
- outgoingIdleTokenAmount,
97
- }),
98
- selector: redeemSelector,
99
- });
100
-
101
- return comptrollerProxy
102
- .connect(fundOwner)
103
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
104
- }
@@ -1,14 +0,0 @@
1
- export * from './aave';
2
- export * from './compound';
3
- export * from './curve';
4
- export * from './idle';
5
- export * from './mock';
6
- export * from './olympusV2';
7
- export * from './paraSwapV5';
8
- export * from './poolTogetherV4';
9
- export * from './synthetix';
10
- export * from './trackedAssets';
11
- export * from './uniswapV2';
12
- export * from './uniswapV3';
13
- export * from './yearn';
14
- export * from './zeroExV2';
@@ -1,116 +0,0 @@
1
- import type { AddressLike } from '@enzymefinance/ethers';
2
- import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
- import type {
4
- ComptrollerLib,
5
- IntegrationManager,
6
- MockGenericAdapter,
7
- StandardToken,
8
- VaultLib,
9
- } from '@enzymefinance/protocol';
10
- import { callOnIntegrationArgs, encodeArgs, IntegrationManagerActionId, sighash } from '@enzymefinance/protocol';
11
- import type { BigNumberish, BytesLike } from 'ethers';
12
- import { utils } from 'ethers';
13
-
14
- export const mockGenericRemoveOnlySelector = sighash(
15
- utils.FunctionFragment.fromString('removeOnly(address,bytes,bytes)'),
16
- );
17
-
18
- export const mockGenericSwapASelector = sighash(utils.FunctionFragment.fromString('swapA(address,bytes,bytes)'));
19
-
20
- export const mockGenericSwapBSelector = sighash(utils.FunctionFragment.fromString('swapB(address,bytes,bytes)'));
21
-
22
- export const mockGenericSwapDirectFromVaultSelector = sighash(
23
- utils.FunctionFragment.fromString('swapDirectFromVault(address,bytes,bytes)'),
24
- );
25
-
26
- export const mockGenericSwapViaApprovalSelector = sighash(
27
- utils.FunctionFragment.fromString('swapViaApproval(address,bytes,bytes)'),
28
- );
29
-
30
- export function mockGenericSwapArgs({
31
- spendAssets = [],
32
- actualSpendAssetAmounts = [],
33
- maxSpendAssetAmounts = actualSpendAssetAmounts,
34
- incomingAssets = [],
35
- actualIncomingAssetAmounts = [],
36
- minIncomingAssetAmounts = actualIncomingAssetAmounts,
37
- }: {
38
- spendAssets?: AddressLike[];
39
- maxSpendAssetAmounts?: BigNumberish[];
40
- actualSpendAssetAmounts?: BigNumberish[];
41
- incomingAssets?: AddressLike[];
42
- minIncomingAssetAmounts?: BigNumberish[];
43
- actualIncomingAssetAmounts?: BigNumberish[];
44
- }) {
45
- return encodeArgs(
46
- ['address[]', 'uint256[]', 'uint256[]', 'address[]', 'uint256[]', 'uint256[]'],
47
- [
48
- spendAssets,
49
- maxSpendAssetAmounts,
50
- actualSpendAssetAmounts,
51
- incomingAssets,
52
- minIncomingAssetAmounts,
53
- actualIncomingAssetAmounts,
54
- ],
55
- );
56
- }
57
-
58
- export async function mockGenericSwap({
59
- comptrollerProxy,
60
- vaultProxy,
61
- integrationManager,
62
- fundOwner,
63
- mockGenericAdapter,
64
- selector = mockGenericSwapASelector,
65
- spendAssets = [],
66
- actualSpendAssetAmounts = [],
67
- maxSpendAssetAmounts = actualSpendAssetAmounts,
68
- incomingAssets = [],
69
- actualIncomingAssetAmounts = [],
70
- minIncomingAssetAmounts = actualIncomingAssetAmounts,
71
- seedFund = false,
72
- }: {
73
- comptrollerProxy: ComptrollerLib;
74
- vaultProxy: VaultLib;
75
- integrationManager: IntegrationManager;
76
- fundOwner: SignerWithAddress;
77
- mockGenericAdapter: MockGenericAdapter;
78
- selector?: BytesLike;
79
- spendAssets?: StandardToken[];
80
- maxSpendAssetAmounts?: BigNumberish[];
81
- actualSpendAssetAmounts?: BigNumberish[];
82
- incomingAssets?: StandardToken[];
83
- minIncomingAssetAmounts?: BigNumberish[];
84
- actualIncomingAssetAmounts?: BigNumberish[];
85
- seedFund?: boolean;
86
- }) {
87
- // Seed the VaultProxy with enough spendAssets for the tx
88
- if (seedFund) {
89
- for (const key in spendAssets) {
90
- await spendAssets[key].transfer(vaultProxy, maxSpendAssetAmounts[key]);
91
- }
92
- }
93
-
94
- const swapArgs = mockGenericSwapArgs({
95
- actualIncomingAssetAmounts,
96
- actualSpendAssetAmounts,
97
- incomingAssets,
98
- maxSpendAssetAmounts,
99
- minIncomingAssetAmounts,
100
- spendAssets,
101
- });
102
-
103
- const callArgs = callOnIntegrationArgs({
104
- adapter: mockGenericAdapter,
105
- encodedCallArgs: swapArgs,
106
- selector,
107
- });
108
-
109
- const swapTx = comptrollerProxy
110
- .connect(fundOwner)
111
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
112
-
113
- await expect(swapTx).resolves.toBeReceipt();
114
-
115
- return swapTx;
116
- }
@@ -1,71 +0,0 @@
1
- import type { SignerWithAddress } from '@enzymefinance/hardhat';
2
- import type { ComptrollerLib, IntegrationManager, OlympusV2Adapter } from '@enzymefinance/protocol';
3
- import {
4
- callOnIntegrationArgs,
5
- IntegrationManagerActionId,
6
- olympusV2StakeArgs,
7
- olympusV2UnstakeArgs,
8
- stakeSelector,
9
- unstakeSelector,
10
- } from '@enzymefinance/protocol';
11
- import type { BigNumberish } from 'ethers';
12
-
13
- export async function olympusV2Stake({
14
- comptrollerProxy,
15
- integrationManager,
16
- signer,
17
- olympusV2Adapter,
18
- amount,
19
- }: {
20
- comptrollerProxy: ComptrollerLib;
21
- integrationManager: IntegrationManager;
22
- signer: SignerWithAddress;
23
- olympusV2Adapter: OlympusV2Adapter;
24
- amount: BigNumberish;
25
- }) {
26
- const stakeArgs = olympusV2StakeArgs({
27
- amount,
28
- });
29
-
30
- const callArgs = callOnIntegrationArgs({
31
- adapter: olympusV2Adapter,
32
- encodedCallArgs: stakeArgs,
33
- selector: stakeSelector,
34
- });
35
-
36
- const stakeTx = comptrollerProxy
37
- .connect(signer)
38
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
39
-
40
- return stakeTx;
41
- }
42
-
43
- export async function olympusV2Unstake({
44
- comptrollerProxy,
45
- integrationManager,
46
- signer,
47
- olympusV2Adapter,
48
- amount,
49
- }: {
50
- comptrollerProxy: ComptrollerLib;
51
- integrationManager: IntegrationManager;
52
- signer: SignerWithAddress;
53
- olympusV2Adapter: OlympusV2Adapter;
54
- amount: BigNumberish;
55
- }) {
56
- const unstakeArgs = olympusV2UnstakeArgs({
57
- amount,
58
- });
59
-
60
- const callArgs = callOnIntegrationArgs({
61
- adapter: olympusV2Adapter,
62
- encodedCallArgs: unstakeArgs,
63
- selector: unstakeSelector,
64
- });
65
-
66
- const unstakeTx = comptrollerProxy
67
- .connect(signer)
68
- .callOnExtension(integrationManager, IntegrationManagerActionId.CallOnIntegration, callArgs);
69
-
70
- return unstakeTx;
71
- }