@enzymefinance/testutils 4.0.0-next.7 → 4.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enzymefinance/testutils",
3
- "version": "4.0.0-next.7",
3
+ "version": "4.0.0",
4
4
  "main": "dist/enzymefinance-testutils.cjs.js",
5
5
  "module": "dist/enzymefinance-testutils.esm.js",
6
6
  "browser": {
@@ -11,7 +11,7 @@
11
11
  "@babel/runtime": "^7.16.7",
12
12
  "@enzymefinance/ethers": "^1.0.16",
13
13
  "@enzymefinance/hardhat": "^1.0.16",
14
- "@enzymefinance/protocol": "^4.0.0-next.7",
14
+ "@enzymefinance/protocol": "^4.0.0",
15
15
  "ethers": "^5.5.4"
16
16
  }
17
17
  }
package/src/deployment.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import {
2
2
  AaveAdapter,
3
+ AaveDebtPositionLib,
4
+ AaveDebtPositionParser,
3
5
  AavePriceFeed,
4
6
  AddressListRegistry,
5
7
  AllowedAdapterIncomingAssetsPolicy,
@@ -18,10 +20,7 @@ import {
18
20
  ConvexCurveLpStakingWrapperPriceFeed,
19
21
  CumulativeSlippageTolerancePolicy,
20
22
  CurveExchangeAdapter,
21
- CurveLiquidityAaveAdapter,
22
23
  CurveLiquidityAdapter,
23
- CurveLiquiditySethAdapter,
24
- CurveLiquidityStethAdapter,
25
24
  CurvePriceFeed,
26
25
  DepositWrapper,
27
26
  Dispatcher,
@@ -49,7 +48,6 @@ import {
49
48
  OlympusV2Adapter,
50
49
  OnlyRemoveDustExternalPositionPolicy,
51
50
  OnlyUntrackDustOrPricelessAssetsPolicy,
52
- ParaSwapV4Adapter,
53
51
  ParaSwapV5Adapter,
54
52
  PerformanceFee,
55
53
  PolicyManager,
@@ -58,13 +56,13 @@ import {
58
56
  ProtocolFeeReserveLib,
59
57
  ProtocolFeeTracker,
60
58
  RevertingPriceFeed,
61
- StakehoundEthPriceFeed,
62
59
  SynthetixAdapter,
63
60
  UniswapV2ExchangeAdapter,
64
61
  UniswapV2LiquidityAdapter,
65
62
  UniswapV2PoolPriceFeed,
66
63
  UniswapV3Adapter,
67
64
  UnpermissionedActionsWrapper,
65
+ UsdEthSimulatedAggregator,
68
66
  ValueInterpreter,
69
67
  VaultLib,
70
68
  YearnVaultV2Adapter,
@@ -96,6 +94,8 @@ export async function deployProtocolFixture() {
96
94
  // prettier-ignore
97
95
  const deployment = {
98
96
  aaveAdapter: new AaveAdapter(fixture['AaveAdapter'].address, deployer),
97
+ aaveDebtPositionLib: new AaveDebtPositionLib(fixture['AaveDebtPositionLib'].address, deployer),
98
+ aaveDebtPositionParser: new AaveDebtPositionParser(fixture['AaveDebtPositionParser'].address, deployer),
99
99
  aavePriceFeed: new AavePriceFeed(fixture['AavePriceFeed'].address, deployer),
100
100
  addressListRegistry: new AddressListRegistry(fixture['AddressListRegistry'].address, deployer),
101
101
  allowedAdapterIncomingAssetsPolicy: new AllowedAdapterIncomingAssetsPolicy(fixture['AllowedAdapterIncomingAssetsPolicy'].address, deployer),
@@ -114,10 +114,7 @@ export async function deployProtocolFixture() {
114
114
  convexCurveLpStakingWrapperPriceFeed: new ConvexCurveLpStakingWrapperPriceFeed(fixture['ConvexCurveLpStakingWrapperPriceFeed'].address, deployer),
115
115
  cumulativeSlippageTolerancePolicy: new CumulativeSlippageTolerancePolicy(fixture['CumulativeSlippageTolerancePolicy'].address, deployer),
116
116
  curveExchangeAdapter: new CurveExchangeAdapter(fixture['CurveExchangeAdapter'].address, deployer),
117
- curveLiquidityAaveAdapter: new CurveLiquidityAaveAdapter(fixture['CurveLiquidityAaveAdapter'].address, deployer),
118
117
  curveLiquidityAdapter: new CurveLiquidityAdapter(fixture['CurveLiquidityAdapter'].address, deployer),
119
- curveLiquiditySethAdapter: new CurveLiquiditySethAdapter(fixture['CurveLiquiditySethAdapter'].address, deployer),
120
- curveLiquidityStethAdapter: new CurveLiquidityStethAdapter(fixture['CurveLiquidityStethAdapter'].address, deployer),
121
118
  curvePriceFeed: new CurvePriceFeed(fixture['CurvePriceFeed'].address, deployer),
122
119
  depositWrapper: new DepositWrapper(fixture['DepositWrapper'].address, deployer),
123
120
  dispatcher: new Dispatcher(fixture['Dispatcher'].address, deployer),
@@ -145,7 +142,6 @@ export async function deployProtocolFixture() {
145
142
  olympusV2Adapter: new OlympusV2Adapter(fixture['OlympusV2Adapter'].address, deployer),
146
143
  onlyRemoveDustExternalPositionPolicy: new OnlyRemoveDustExternalPositionPolicy(fixture['OnlyRemoveDustExternalPositionPolicy'].address, deployer),
147
144
  onlyUntrackDustOrPricelessAssetsPolicy: new OnlyUntrackDustOrPricelessAssetsPolicy(fixture['OnlyUntrackDustOrPricelessAssetsPolicy'].address, deployer),
148
- paraSwapV4Adapter: new ParaSwapV4Adapter(fixture['ParaSwapV4Adapter'].address, deployer),
149
145
  paraSwapV5Adapter: new ParaSwapV5Adapter(fixture['ParaSwapV5Adapter'].address, deployer),
150
146
  performanceFee: new PerformanceFee(fixture['PerformanceFee'].address, deployer),
151
147
  policyManager: new PolicyManager(fixture['PolicyManager'].address, deployer),
@@ -155,13 +151,13 @@ export async function deployProtocolFixture() {
155
151
  protocolFeeReserveProxy: new ProtocolFeeReserveLib(fixture['ProtocolFeeReserveProxy'].address, deployer),
156
152
  protocolFeeTracker: new ProtocolFeeTracker(fixture['ProtocolFeeTracker'].address, deployer),
157
153
  revertingPriceFeed: new RevertingPriceFeed(fixture['RevertingPriceFeed'].address, deployer),
158
- stakehoundEthPriceFeed: new StakehoundEthPriceFeed(fixture['StakehoundEthPriceFeed'].address, deployer),
159
154
  synthetixAdapter: new SynthetixAdapter(fixture['SynthetixAdapter'].address, deployer),
160
155
  uniswapV2ExchangeAdapter: new UniswapV2ExchangeAdapter(fixture['UniswapV2ExchangeAdapter'].address, deployer),
161
156
  uniswapV2LiquidityAdapter: new UniswapV2LiquidityAdapter(fixture['UniswapV2LiquidityAdapter'].address, deployer),
162
157
  uniswapV2PoolPriceFeed: new UniswapV2PoolPriceFeed(fixture['UniswapV2PoolPriceFeed'].address, deployer),
163
158
  uniswapV3Adapter: new UniswapV3Adapter(fixture['UniswapV3Adapter'].address, deployer),
164
159
  unpermissionedActionsWrapper: new UnpermissionedActionsWrapper(fixture['UnpermissionedActionsWrapper'].address, deployer),
160
+ usdEthSimulatedAggregator: new UsdEthSimulatedAggregator(fixture['UsdEthSimulatedAggregator'].address, deployer),
165
161
  valueInterpreter: new ValueInterpreter(fixture['ValueInterpreter'].address, deployer),
166
162
  vaultLib: new VaultLib(fixture['VaultLib'].address, deployer),
167
163
  yearnVaultV2Adapter: new YearnVaultV2Adapter(fixture['YearnVaultV2Adapter'].address, deployer),
@@ -184,6 +180,7 @@ export type ProtocolDeployment = Resolve<typeof deployProtocolFixture>;
184
180
  import type { ChainlinkRateAsset } from '@enzymefinance/protocol';
185
181
 
186
182
  export interface DeploymentConfig {
183
+ feeBps: number;
187
184
  feeToken: string;
188
185
  feeTokenBurn: {
189
186
  burnFromVault: boolean;
@@ -221,6 +218,7 @@ export interface DeploymentConfig {
221
218
  pools: Record<string, { pool: string; lpToken: string; liquidityGaugeToken: string; invariantProxyAsset: string }>;
222
219
  };
223
220
  aave: {
221
+ incentivesController: string;
224
222
  lendingPoolAddressProvider: string;
225
223
  protocolDataProvider: string;
226
224
  atokens: Record<string, [string, string]>;
@@ -251,10 +249,6 @@ export interface DeploymentConfig {
251
249
  olympusV2: {
252
250
  stakingContract: string;
253
251
  };
254
- paraSwapV4: {
255
- augustusSwapper: string;
256
- tokenTransferProxy: string;
257
- };
258
252
  paraSwapV5: {
259
253
  augustusSwapper: string;
260
254
  tokenTransferProxy: string;
@@ -263,9 +257,6 @@ export interface DeploymentConfig {
263
257
  ptTokens: Record<string, [string, string]>;
264
258
  };
265
259
  positionsLimit: number;
266
- stakehound: {
267
- steth: string;
268
- };
269
260
  unsupportedAssets: Record<string, string>;
270
261
  uniswap: {
271
262
  factory: string;
@@ -0,0 +1,179 @@
1
+ import type { AddressLike } from '@enzymefinance/ethers';
2
+ import type { SignerWithAddress } from '@enzymefinance/hardhat';
3
+ import type { ComptrollerLib, ExternalPositionManager } from '@enzymefinance/protocol';
4
+ import {
5
+ AaveDebtPositionActionId,
6
+ aaveDebtPositionAddCollateralArgs,
7
+ aaveDebtPositionBorrowArgs,
8
+ aaveDebtPositionClaimRewardsArgs,
9
+ aaveDebtPositionRemoveCollateralArgs,
10
+ aaveDebtPositionRepayBorrowArgs,
11
+ ExternalPositionType,
12
+ } from '@enzymefinance/protocol';
13
+ import type { BigNumberish } from 'ethers';
14
+
15
+ import { callOnExternalPosition, createExternalPosition } from './actions';
16
+
17
+ export async function aaveDebtPositionAddCollateral({
18
+ comptrollerProxy,
19
+ externalPositionManager,
20
+ signer,
21
+ aTokens,
22
+ amounts,
23
+ externalPositionProxy,
24
+ }: {
25
+ comptrollerProxy: ComptrollerLib;
26
+ externalPositionManager: ExternalPositionManager;
27
+ signer: SignerWithAddress;
28
+ aTokens: AddressLike[];
29
+ amounts: BigNumberish[];
30
+ externalPositionProxy: AddressLike;
31
+ }) {
32
+ const actionArgs = aaveDebtPositionAddCollateralArgs({
33
+ aTokens,
34
+ amounts,
35
+ });
36
+
37
+ return callOnExternalPosition({
38
+ actionArgs,
39
+ actionId: AaveDebtPositionActionId.AddCollateralAssets,
40
+ comptrollerProxy,
41
+ externalPositionManager,
42
+ externalPositionProxy,
43
+ signer,
44
+ });
45
+ }
46
+
47
+ export async function aaveDebtPositionBorrow({
48
+ comptrollerProxy,
49
+ externalPositionManager,
50
+ signer,
51
+ tokens,
52
+ amounts,
53
+ externalPositionProxy,
54
+ }: {
55
+ comptrollerProxy: ComptrollerLib;
56
+ externalPositionManager: ExternalPositionManager;
57
+ signer: SignerWithAddress;
58
+ tokens: AddressLike[];
59
+ amounts: BigNumberish[];
60
+ externalPositionProxy: AddressLike;
61
+ }) {
62
+ const actionArgs = aaveDebtPositionBorrowArgs({
63
+ amounts,
64
+ tokens,
65
+ });
66
+
67
+ return callOnExternalPosition({
68
+ actionArgs,
69
+ actionId: AaveDebtPositionActionId.BorrowAsset,
70
+ comptrollerProxy,
71
+ externalPositionManager,
72
+ externalPositionProxy,
73
+ signer,
74
+ });
75
+ }
76
+
77
+ export async function aaveDebtPositionClaimRewards({
78
+ comptrollerProxy,
79
+ externalPositionManager,
80
+ signer,
81
+ assets,
82
+ externalPositionProxy,
83
+ }: {
84
+ comptrollerProxy: ComptrollerLib;
85
+ externalPositionManager: ExternalPositionManager;
86
+ signer: SignerWithAddress;
87
+ assets: AddressLike[];
88
+ externalPositionProxy: AddressLike;
89
+ }) {
90
+ const actionArgs = aaveDebtPositionClaimRewardsArgs({
91
+ assets,
92
+ });
93
+
94
+ return callOnExternalPosition({
95
+ actionArgs,
96
+ actionId: AaveDebtPositionActionId.ClaimRewards,
97
+ comptrollerProxy,
98
+ externalPositionManager,
99
+ externalPositionProxy,
100
+ signer,
101
+ });
102
+ }
103
+
104
+ export async function aaveDebtPositionRemoveCollateral({
105
+ comptrollerProxy,
106
+ externalPositionManager,
107
+ signer,
108
+ aTokens,
109
+ amounts,
110
+ externalPositionProxy,
111
+ }: {
112
+ comptrollerProxy: ComptrollerLib;
113
+ externalPositionManager: ExternalPositionManager;
114
+ signer: SignerWithAddress;
115
+ aTokens: AddressLike[];
116
+ amounts: BigNumberish[];
117
+ externalPositionProxy: AddressLike;
118
+ }) {
119
+ const actionArgs = aaveDebtPositionRemoveCollateralArgs({
120
+ aTokens,
121
+ amounts,
122
+ });
123
+
124
+ return callOnExternalPosition({
125
+ actionArgs,
126
+ actionId: AaveDebtPositionActionId.RemoveCollateralAssets,
127
+ comptrollerProxy,
128
+ externalPositionManager,
129
+ externalPositionProxy,
130
+ signer,
131
+ });
132
+ }
133
+
134
+ export async function aaveDebtPositionRepayBorrow({
135
+ comptrollerProxy,
136
+ externalPositionManager,
137
+ signer,
138
+ tokens,
139
+ amounts,
140
+ externalPositionProxy,
141
+ }: {
142
+ comptrollerProxy: ComptrollerLib;
143
+ externalPositionManager: ExternalPositionManager;
144
+ signer: SignerWithAddress;
145
+ tokens: AddressLike[];
146
+ amounts: BigNumberish[];
147
+ externalPositionProxy: AddressLike;
148
+ }) {
149
+ const actionArgs = aaveDebtPositionRepayBorrowArgs({
150
+ amounts,
151
+ tokens,
152
+ });
153
+
154
+ return callOnExternalPosition({
155
+ actionArgs,
156
+ actionId: AaveDebtPositionActionId.RepayBorrowedAssets,
157
+ comptrollerProxy,
158
+ externalPositionManager,
159
+ externalPositionProxy,
160
+ signer,
161
+ });
162
+ }
163
+
164
+ export async function createAaveDebtPosition({
165
+ signer,
166
+ comptrollerProxy,
167
+ externalPositionManager,
168
+ }: {
169
+ signer: SignerWithAddress;
170
+ comptrollerProxy: ComptrollerLib;
171
+ externalPositionManager: ExternalPositionManager;
172
+ }) {
173
+ return createExternalPosition({
174
+ comptrollerProxy,
175
+ externalPositionManager,
176
+ externalPositionTypeId: ExternalPositionType.AaveDebtPosition,
177
+ signer,
178
+ });
179
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './actions';
2
2
  export * from './compound';
3
3
  export * from './mocks';
4
+ export * from './aave-debt';
4
5
  export * from './uniswap-v3-liquidity';