@gearbox-protocol/sdk 2.1.24 → 2.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/tokens/token.js +1 -1
- package/package.json +1 -1
- package/contracts/AdapterData.sol +0 -322
- package/contracts/AdapterType.sol +0 -29
- package/contracts/ContractType.sol +0 -68
- package/contracts/NetworkDetector.sol +0 -61
- package/contracts/PriceFeedDataLive.sol +0 -1227
- package/contracts/PriceFeedType.sol +0 -26
- package/contracts/SupportedContracts.sol +0 -423
- package/contracts/Tokens.sol +0 -135
- package/contracts/TokensData.sol +0 -1076
- package/contracts/TokensLib.sol +0 -34
- package/lib/oracles/priceFeeds.d.ts +0 -4
- package/lib/oracles/priceFeeds.js +0 -828
- package/lib/oracles/priceFeeds.spec.d.ts +0 -1
- package/lib/oracles/priceFeeds.spec.js +0 -134
- package/lib/oracles/pricefeedType.d.ts +0 -95
- package/lib/oracles/pricefeedType.js +0 -27
package/lib/index.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ export * from "./core/strategy";
|
|
|
17
17
|
export * from "./core/tokenDistributor";
|
|
18
18
|
export * from "./core/trade";
|
|
19
19
|
export * from "./core/transactions";
|
|
20
|
-
export * from "./oracles/priceFeeds";
|
|
21
|
-
export * from "./oracles/pricefeedType";
|
|
22
20
|
export * from "./payload/creditAccount";
|
|
23
21
|
export * from "./payload/creditManager";
|
|
24
22
|
export * from "./payload/creditSession";
|
package/lib/index.js
CHANGED
|
@@ -34,8 +34,6 @@ __exportStar(require("./core/strategy"), exports);
|
|
|
34
34
|
__exportStar(require("./core/tokenDistributor"), exports);
|
|
35
35
|
__exportStar(require("./core/trade"), exports);
|
|
36
36
|
__exportStar(require("./core/transactions"), exports);
|
|
37
|
-
__exportStar(require("./oracles/priceFeeds"), exports);
|
|
38
|
-
__exportStar(require("./oracles/pricefeedType"), exports);
|
|
39
37
|
__exportStar(require("./payload/creditAccount"), exports);
|
|
40
38
|
__exportStar(require("./payload/creditManager"), exports);
|
|
41
39
|
__exportStar(require("./payload/creditSession"), exports);
|
package/lib/tokens/token.js
CHANGED
|
@@ -81,7 +81,7 @@ exports.tokenDataByNetwork = {
|
|
|
81
81
|
crvCVXETH: "0x3A283D9c08E8b55966afb64C515f5143cf907611",
|
|
82
82
|
crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4",
|
|
83
83
|
LDOETH: "0xb79565c01b7Ae53618d9B847b9443aAf4f9011e7",
|
|
84
|
-
crvUSD: "
|
|
84
|
+
crvUSD: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
|
|
85
85
|
crvUSDUSDC: "0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E",
|
|
86
86
|
crvUSDUSDT: "0x390f3595bCa2Df7d23783dFd126427CCeb997BF4",
|
|
87
87
|
crvUSDFRAX: "0x0CD6f267b2086bea681E922E19D40512511BE538",
|
package/package.json
CHANGED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
-
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
|
|
3
|
-
// (c) Gearbox Foundation, 2023
|
|
4
|
-
pragma solidity ^0.8.17;
|
|
5
|
-
|
|
6
|
-
import {Tokens} from "./Tokens.sol";
|
|
7
|
-
import {Contracts} from "./SupportedContracts.sol";
|
|
8
|
-
import {AdapterType} from "./AdapterType.sol";
|
|
9
|
-
|
|
10
|
-
struct SimpleAdapter {
|
|
11
|
-
Contracts targetContract;
|
|
12
|
-
AdapterType adapterType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
struct CurveAdapter {
|
|
16
|
-
Contracts targetContract;
|
|
17
|
-
AdapterType adapterType;
|
|
18
|
-
Tokens lpToken;
|
|
19
|
-
Contracts basePool;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
struct CurveStETHAdapter {
|
|
23
|
-
Contracts curveETHGateway;
|
|
24
|
-
AdapterType adapterType;
|
|
25
|
-
Tokens lpToken;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
struct CurveWrapper {
|
|
29
|
-
Contracts targetContract;
|
|
30
|
-
AdapterType adapterType;
|
|
31
|
-
Tokens lpToken;
|
|
32
|
-
uint256 nCoins;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
struct ConvexBasePoolAdapter {
|
|
36
|
-
Contracts targetContract;
|
|
37
|
-
AdapterType adapterType;
|
|
38
|
-
Tokens stakedToken;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
contract AdapterData {
|
|
42
|
-
SimpleAdapter[] simpleAdapters;
|
|
43
|
-
CurveAdapter[] curveAdapters;
|
|
44
|
-
CurveStETHAdapter curveStEthAdapter;
|
|
45
|
-
CurveWrapper[] curveWrappers;
|
|
46
|
-
ConvexBasePoolAdapter[] convexBasePoolAdapters;
|
|
47
|
-
|
|
48
|
-
constructor() {
|
|
49
|
-
simpleAdapters.push(
|
|
50
|
-
SimpleAdapter({targetContract: Contracts.UNISWAP_V2_ROUTER, adapterType: AdapterType.UNISWAP_V2_ROUTER})
|
|
51
|
-
);
|
|
52
|
-
simpleAdapters.push(
|
|
53
|
-
SimpleAdapter({targetContract: Contracts.UNISWAP_V3_ROUTER, adapterType: AdapterType.UNISWAP_V3_ROUTER})
|
|
54
|
-
);
|
|
55
|
-
simpleAdapters.push(
|
|
56
|
-
SimpleAdapter({targetContract: Contracts.SUSHISWAP_ROUTER, adapterType: AdapterType.UNISWAP_V2_ROUTER})
|
|
57
|
-
);
|
|
58
|
-
simpleAdapters.push(
|
|
59
|
-
SimpleAdapter({targetContract: Contracts.YEARN_DAI_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
60
|
-
);
|
|
61
|
-
simpleAdapters.push(
|
|
62
|
-
SimpleAdapter({targetContract: Contracts.YEARN_USDC_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
63
|
-
);
|
|
64
|
-
simpleAdapters.push(
|
|
65
|
-
SimpleAdapter({targetContract: Contracts.YEARN_WETH_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
66
|
-
);
|
|
67
|
-
simpleAdapters.push(
|
|
68
|
-
SimpleAdapter({targetContract: Contracts.YEARN_WBTC_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
69
|
-
);
|
|
70
|
-
simpleAdapters.push(
|
|
71
|
-
SimpleAdapter({targetContract: Contracts.YEARN_CURVE_FRAX_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
72
|
-
);
|
|
73
|
-
simpleAdapters.push(
|
|
74
|
-
SimpleAdapter({targetContract: Contracts.YEARN_CURVE_STETH_VAULT, adapterType: AdapterType.YEARN_V2})
|
|
75
|
-
);
|
|
76
|
-
simpleAdapters.push(
|
|
77
|
-
SimpleAdapter({targetContract: Contracts.CONVEX_BOOSTER, adapterType: AdapterType.CONVEX_V1_BOOSTER})
|
|
78
|
-
);
|
|
79
|
-
simpleAdapters.push(
|
|
80
|
-
SimpleAdapter({targetContract: Contracts.LIDO_STETH_GATEWAY, adapterType: AdapterType.LIDO_V1})
|
|
81
|
-
);
|
|
82
|
-
simpleAdapters.push(
|
|
83
|
-
SimpleAdapter({targetContract: Contracts.LIDO_WSTETH, adapterType: AdapterType.LIDO_WSTETH_V1})
|
|
84
|
-
);
|
|
85
|
-
simpleAdapters.push(
|
|
86
|
-
SimpleAdapter({targetContract: Contracts.UNIVERSAL_ADAPTER, adapterType: AdapterType.UNIVERSAL})
|
|
87
|
-
);
|
|
88
|
-
curveAdapters.push(
|
|
89
|
-
CurveAdapter({
|
|
90
|
-
targetContract: Contracts.CURVE_3CRV_POOL,
|
|
91
|
-
adapterType: AdapterType.CURVE_V1_3ASSETS,
|
|
92
|
-
lpToken: Tokens._3Crv,
|
|
93
|
-
basePool: Contracts.NO_CONTRACT
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
curveAdapters.push(
|
|
97
|
-
CurveAdapter({
|
|
98
|
-
targetContract: Contracts.CURVE_FRAX_USDC_POOL,
|
|
99
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
100
|
-
lpToken: Tokens.crvFRAX,
|
|
101
|
-
basePool: Contracts.NO_CONTRACT
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
curveAdapters.push(
|
|
106
|
-
CurveAdapter({
|
|
107
|
-
targetContract: Contracts.CURVE_FRAX_POOL,
|
|
108
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
109
|
-
lpToken: Tokens.FRAX3CRV,
|
|
110
|
-
basePool: Contracts.CURVE_3CRV_POOL
|
|
111
|
-
})
|
|
112
|
-
);
|
|
113
|
-
curveAdapters.push(
|
|
114
|
-
CurveAdapter({
|
|
115
|
-
targetContract: Contracts.CURVE_LUSD_POOL,
|
|
116
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
117
|
-
lpToken: Tokens.LUSD3CRV,
|
|
118
|
-
basePool: Contracts.CURVE_3CRV_POOL
|
|
119
|
-
})
|
|
120
|
-
);
|
|
121
|
-
curveAdapters.push(
|
|
122
|
-
CurveAdapter({
|
|
123
|
-
targetContract: Contracts.CURVE_SUSD_POOL,
|
|
124
|
-
adapterType: AdapterType.CURVE_V1_4ASSETS,
|
|
125
|
-
lpToken: Tokens.crvPlain3andSUSD,
|
|
126
|
-
basePool: Contracts.NO_CONTRACT
|
|
127
|
-
})
|
|
128
|
-
);
|
|
129
|
-
curveAdapters.push(
|
|
130
|
-
CurveAdapter({
|
|
131
|
-
targetContract: Contracts.CURVE_GUSD_POOL,
|
|
132
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
133
|
-
lpToken: Tokens.gusd3CRV,
|
|
134
|
-
basePool: Contracts.CURVE_3CRV_POOL
|
|
135
|
-
})
|
|
136
|
-
);
|
|
137
|
-
curveAdapters.push(
|
|
138
|
-
CurveAdapter({
|
|
139
|
-
targetContract: Contracts.CURVE_MIM_POOL,
|
|
140
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
141
|
-
lpToken: Tokens.MIM_3LP3CRV,
|
|
142
|
-
basePool: Contracts.CURVE_3CRV_POOL
|
|
143
|
-
})
|
|
144
|
-
);
|
|
145
|
-
curveAdapters.push(
|
|
146
|
-
CurveAdapter({
|
|
147
|
-
targetContract: Contracts.CURVE_OHMFRAXBP_POOL,
|
|
148
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
149
|
-
lpToken: Tokens.OHMFRAXBP,
|
|
150
|
-
basePool: Contracts.NO_CONTRACT
|
|
151
|
-
})
|
|
152
|
-
);
|
|
153
|
-
curveAdapters.push(
|
|
154
|
-
CurveAdapter({
|
|
155
|
-
targetContract: Contracts.CURVE_CRVETH_POOL,
|
|
156
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
157
|
-
lpToken: Tokens.crvCRVETH,
|
|
158
|
-
basePool: Contracts.NO_CONTRACT
|
|
159
|
-
})
|
|
160
|
-
);
|
|
161
|
-
curveAdapters.push(
|
|
162
|
-
CurveAdapter({
|
|
163
|
-
targetContract: Contracts.CURVE_CVXETH_POOL,
|
|
164
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
165
|
-
lpToken: Tokens.crvCVXETH,
|
|
166
|
-
basePool: Contracts.NO_CONTRACT
|
|
167
|
-
})
|
|
168
|
-
);
|
|
169
|
-
curveAdapters.push(
|
|
170
|
-
CurveAdapter({
|
|
171
|
-
targetContract: Contracts.CURVE_3CRYPTO_POOL,
|
|
172
|
-
adapterType: AdapterType.CURVE_V1_3ASSETS,
|
|
173
|
-
lpToken: Tokens.crvUSDTWBTCWETH,
|
|
174
|
-
basePool: Contracts.NO_CONTRACT
|
|
175
|
-
})
|
|
176
|
-
);
|
|
177
|
-
curveAdapters.push(
|
|
178
|
-
CurveAdapter({
|
|
179
|
-
targetContract: Contracts.CURVE_LDOETH_POOL,
|
|
180
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
181
|
-
lpToken: Tokens.LDOETH,
|
|
182
|
-
basePool: Contracts.NO_CONTRACT
|
|
183
|
-
})
|
|
184
|
-
);
|
|
185
|
-
curveAdapters.push(
|
|
186
|
-
CurveAdapter({
|
|
187
|
-
targetContract: Contracts.CURVE_CRVUSD_USDC_POOL,
|
|
188
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
189
|
-
lpToken: Tokens.crvUSDUSDC,
|
|
190
|
-
basePool: Contracts.NO_CONTRACT
|
|
191
|
-
})
|
|
192
|
-
);
|
|
193
|
-
curveAdapters.push(
|
|
194
|
-
CurveAdapter({
|
|
195
|
-
targetContract: Contracts.CURVE_CRVUSD_USDT_POOL,
|
|
196
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
197
|
-
lpToken: Tokens.crvUSDUSDT,
|
|
198
|
-
basePool: Contracts.NO_CONTRACT
|
|
199
|
-
})
|
|
200
|
-
);
|
|
201
|
-
curveAdapters.push(
|
|
202
|
-
CurveAdapter({
|
|
203
|
-
targetContract: Contracts.CURVE_CRVUSD_FRAX_POOL,
|
|
204
|
-
adapterType: AdapterType.CURVE_V1_2ASSETS,
|
|
205
|
-
lpToken: Tokens.crvUSDFRAX,
|
|
206
|
-
basePool: Contracts.NO_CONTRACT
|
|
207
|
-
})
|
|
208
|
-
);
|
|
209
|
-
curveAdapters.push(
|
|
210
|
-
CurveAdapter({
|
|
211
|
-
targetContract: Contracts.CURVE_TRI_CRV_POOL,
|
|
212
|
-
adapterType: AdapterType.CURVE_V1_3ASSETS,
|
|
213
|
-
lpToken: Tokens.crvUSDETHCRV,
|
|
214
|
-
basePool: Contracts.NO_CONTRACT
|
|
215
|
-
})
|
|
216
|
-
);
|
|
217
|
-
curveStEthAdapter = CurveStETHAdapter({
|
|
218
|
-
curveETHGateway: Contracts.CURVE_STETH_GATEWAY,
|
|
219
|
-
adapterType: AdapterType.CURVE_V1_STECRV_POOL,
|
|
220
|
-
lpToken: Tokens.steCRV
|
|
221
|
-
});
|
|
222
|
-
curveWrappers.push(
|
|
223
|
-
CurveWrapper({
|
|
224
|
-
targetContract: Contracts.CURVE_SUSD_DEPOSIT,
|
|
225
|
-
adapterType: AdapterType.CURVE_V1_WRAPPER,
|
|
226
|
-
lpToken: Tokens.crvPlain3andSUSD,
|
|
227
|
-
nCoins: 4
|
|
228
|
-
})
|
|
229
|
-
);
|
|
230
|
-
convexBasePoolAdapters.push(
|
|
231
|
-
ConvexBasePoolAdapter({
|
|
232
|
-
targetContract: Contracts.CONVEX_3CRV_POOL,
|
|
233
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
234
|
-
stakedToken: Tokens.stkcvx3Crv
|
|
235
|
-
})
|
|
236
|
-
);
|
|
237
|
-
convexBasePoolAdapters.push(
|
|
238
|
-
ConvexBasePoolAdapter({
|
|
239
|
-
targetContract: Contracts.CONVEX_FRAX_USDC_POOL,
|
|
240
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
241
|
-
stakedToken: Tokens.stkcvxcrvFRAX
|
|
242
|
-
})
|
|
243
|
-
);
|
|
244
|
-
convexBasePoolAdapters.push(
|
|
245
|
-
ConvexBasePoolAdapter({
|
|
246
|
-
targetContract: Contracts.CONVEX_GUSD_POOL,
|
|
247
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
248
|
-
stakedToken: Tokens.stkcvxgusd3CRV
|
|
249
|
-
})
|
|
250
|
-
);
|
|
251
|
-
convexBasePoolAdapters.push(
|
|
252
|
-
ConvexBasePoolAdapter({
|
|
253
|
-
targetContract: Contracts.CONVEX_SUSD_POOL,
|
|
254
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
255
|
-
stakedToken: Tokens.stkcvxcrvPlain3andSUSD
|
|
256
|
-
})
|
|
257
|
-
);
|
|
258
|
-
convexBasePoolAdapters.push(
|
|
259
|
-
ConvexBasePoolAdapter({
|
|
260
|
-
targetContract: Contracts.CONVEX_STECRV_POOL,
|
|
261
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
262
|
-
stakedToken: Tokens.stkcvxsteCRV
|
|
263
|
-
})
|
|
264
|
-
);
|
|
265
|
-
convexBasePoolAdapters.push(
|
|
266
|
-
ConvexBasePoolAdapter({
|
|
267
|
-
targetContract: Contracts.CONVEX_FRAX3CRV_POOL,
|
|
268
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
269
|
-
stakedToken: Tokens.stkcvxFRAX3CRV
|
|
270
|
-
})
|
|
271
|
-
);
|
|
272
|
-
convexBasePoolAdapters.push(
|
|
273
|
-
ConvexBasePoolAdapter({
|
|
274
|
-
targetContract: Contracts.CONVEX_LUSD3CRV_POOL,
|
|
275
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
276
|
-
stakedToken: Tokens.stkcvxLUSD3CRV
|
|
277
|
-
})
|
|
278
|
-
);
|
|
279
|
-
convexBasePoolAdapters.push(
|
|
280
|
-
ConvexBasePoolAdapter({
|
|
281
|
-
targetContract: Contracts.CONVEX_MIM3CRV_POOL,
|
|
282
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
283
|
-
stakedToken: Tokens.stkcvxMIM_3LP3CRV
|
|
284
|
-
})
|
|
285
|
-
);
|
|
286
|
-
convexBasePoolAdapters.push(
|
|
287
|
-
ConvexBasePoolAdapter({
|
|
288
|
-
targetContract: Contracts.CONVEX_OHMFRAXBP_POOL,
|
|
289
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
290
|
-
stakedToken: Tokens.stkcvxOHMFRAXBP
|
|
291
|
-
})
|
|
292
|
-
);
|
|
293
|
-
convexBasePoolAdapters.push(
|
|
294
|
-
ConvexBasePoolAdapter({
|
|
295
|
-
targetContract: Contracts.CONVEX_CRVETH_POOL,
|
|
296
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
297
|
-
stakedToken: Tokens.stkcvxcrvCRVETH
|
|
298
|
-
})
|
|
299
|
-
);
|
|
300
|
-
convexBasePoolAdapters.push(
|
|
301
|
-
ConvexBasePoolAdapter({
|
|
302
|
-
targetContract: Contracts.CONVEX_CVXETH_POOL,
|
|
303
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
304
|
-
stakedToken: Tokens.stkcvxcrvCVXETH
|
|
305
|
-
})
|
|
306
|
-
);
|
|
307
|
-
convexBasePoolAdapters.push(
|
|
308
|
-
ConvexBasePoolAdapter({
|
|
309
|
-
targetContract: Contracts.CONVEX_3CRYPTO_POOL,
|
|
310
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
311
|
-
stakedToken: Tokens.stkcvxcrvUSDTWBTCWETH
|
|
312
|
-
})
|
|
313
|
-
);
|
|
314
|
-
convexBasePoolAdapters.push(
|
|
315
|
-
ConvexBasePoolAdapter({
|
|
316
|
-
targetContract: Contracts.CONVEX_LDOETH_POOL,
|
|
317
|
-
adapterType: AdapterType.CONVEX_V1_BASE_REWARD_POOL,
|
|
318
|
-
stakedToken: Tokens.stkcvxLDOETH
|
|
319
|
-
})
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
-
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
|
|
3
|
-
// (c) Gearbox Foundation, 2023
|
|
4
|
-
pragma solidity ^0.8.17;
|
|
5
|
-
|
|
6
|
-
enum AdapterType {
|
|
7
|
-
ABSTRACT,
|
|
8
|
-
UNISWAP_V2_ROUTER,
|
|
9
|
-
UNISWAP_V3_ROUTER,
|
|
10
|
-
CURVE_V1_EXCHANGE_ONLY,
|
|
11
|
-
YEARN_V2,
|
|
12
|
-
CURVE_V1_2ASSETS,
|
|
13
|
-
CURVE_V1_3ASSETS,
|
|
14
|
-
CURVE_V1_4ASSETS,
|
|
15
|
-
CURVE_V1_STECRV_POOL,
|
|
16
|
-
CURVE_V1_WRAPPER,
|
|
17
|
-
CONVEX_V1_BASE_REWARD_POOL,
|
|
18
|
-
CONVEX_V1_BOOSTER,
|
|
19
|
-
CONVEX_V1_CLAIM_ZAP,
|
|
20
|
-
LIDO_V1,
|
|
21
|
-
UNIVERSAL,
|
|
22
|
-
LIDO_WSTETH_V1,
|
|
23
|
-
BALANCER_VAULT,
|
|
24
|
-
AAVE_V2_LENDING_POOL,
|
|
25
|
-
AAVE_V2_WRAPPED_ATOKEN,
|
|
26
|
-
COMPOUND_V2_CERC20,
|
|
27
|
-
COMPOUND_V2_CETHER,
|
|
28
|
-
ERC4626_VAULT
|
|
29
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
-
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
|
|
3
|
-
// (c) Gearbox Foundation, 2023
|
|
4
|
-
pragma solidity ^0.8.17;
|
|
5
|
-
|
|
6
|
-
enum Contracts {
|
|
7
|
-
NO_CONTRACT,
|
|
8
|
-
UNISWAP_V2_ROUTER,
|
|
9
|
-
UNISWAP_V3_ROUTER,
|
|
10
|
-
SUSHISWAP_ROUTER,
|
|
11
|
-
CURVE_3CRV_POOL,
|
|
12
|
-
CURVE_FRAX_USDC_POOL,
|
|
13
|
-
CURVE_STETH_GATEWAY,
|
|
14
|
-
CURVE_FRAX_POOL,
|
|
15
|
-
CURVE_LUSD_POOL,
|
|
16
|
-
CURVE_SUSD_POOL,
|
|
17
|
-
CURVE_SUSD_DEPOSIT,
|
|
18
|
-
CURVE_GUSD_POOL,
|
|
19
|
-
CURVE_MIM_POOL,
|
|
20
|
-
CURVE_OHMFRAXBP_POOL,
|
|
21
|
-
CURVE_CRVETH_POOL,
|
|
22
|
-
CURVE_CVXETH_POOL,
|
|
23
|
-
CURVE_3CRYPTO_POOL,
|
|
24
|
-
CURVE_LDOETH_POOL,
|
|
25
|
-
CURVE_GEAR_POOL,
|
|
26
|
-
CURVE_CRVUSD_USDC_POOL,
|
|
27
|
-
CURVE_CRVUSD_USDT_POOL,
|
|
28
|
-
CURVE_CRVUSD_FRAX_POOL,
|
|
29
|
-
CURVE_TRI_CRV_POOL,
|
|
30
|
-
YEARN_DAI_VAULT,
|
|
31
|
-
YEARN_USDC_VAULT,
|
|
32
|
-
YEARN_WETH_VAULT,
|
|
33
|
-
YEARN_WBTC_VAULT,
|
|
34
|
-
YEARN_CURVE_FRAX_VAULT,
|
|
35
|
-
YEARN_CURVE_STETH_VAULT,
|
|
36
|
-
CONVEX_BOOSTER,
|
|
37
|
-
CONVEX_3CRV_POOL,
|
|
38
|
-
CONVEX_FRAX_USDC_POOL,
|
|
39
|
-
CONVEX_GUSD_POOL,
|
|
40
|
-
CONVEX_SUSD_POOL,
|
|
41
|
-
CONVEX_STECRV_POOL,
|
|
42
|
-
CONVEX_FRAX3CRV_POOL,
|
|
43
|
-
CONVEX_LUSD3CRV_POOL,
|
|
44
|
-
CONVEX_CLAIM_ZAP,
|
|
45
|
-
CONVEX_OHMFRAXBP_POOL,
|
|
46
|
-
CONVEX_MIM3CRV_POOL,
|
|
47
|
-
CONVEX_CRVETH_POOL,
|
|
48
|
-
CONVEX_CVXETH_POOL,
|
|
49
|
-
CONVEX_3CRYPTO_POOL,
|
|
50
|
-
CONVEX_LDOETH_POOL,
|
|
51
|
-
LIDO_STETH_GATEWAY,
|
|
52
|
-
LIDO_WSTETH,
|
|
53
|
-
BALANCER_VAULT,
|
|
54
|
-
UNIVERSAL_ADAPTER,
|
|
55
|
-
AAVE_V2_DAI_POOL,
|
|
56
|
-
AAVE_V2_USDC_POOL,
|
|
57
|
-
AAVE_V2_USDT_POOL,
|
|
58
|
-
AAVE_V2_WETH_POOL,
|
|
59
|
-
AAVE_V2_DAI_TOKEN_WRAPPER,
|
|
60
|
-
AAVE_V2_USDC_TOKEN_WRAPPER,
|
|
61
|
-
AAVE_V2_USDT_TOKEN_WRAPPER,
|
|
62
|
-
AAVE_V2_WETH_TOKEN_WRAPPER,
|
|
63
|
-
COMPOUND_V2_DAI_POOL,
|
|
64
|
-
COMPOUND_V2_USDC_POOL,
|
|
65
|
-
COMPOUND_V2_USDT_POOL,
|
|
66
|
-
COMPOUND_V2_LINK_POOL,
|
|
67
|
-
COMPOUND_V2_WETH_POOL
|
|
68
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
-
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
|
|
3
|
-
// (c) Gearbox Foundation, 2023
|
|
4
|
-
pragma solidity ^0.8.17;
|
|
5
|
-
|
|
6
|
-
import {Test} from "forge-std/Test.sol";
|
|
7
|
-
|
|
8
|
-
interface IERC20Check {
|
|
9
|
-
function totalSupply() external view returns (uint256);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
contract NetworkDetector is Test {
|
|
13
|
-
mapping(uint256 => address) usdcByNetwork;
|
|
14
|
-
|
|
15
|
-
uint16[] public connectedNetworks;
|
|
16
|
-
|
|
17
|
-
uint256 public immutable chainId;
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
// ---------------- Networks ---------------------
|
|
21
|
-
connectedNetworks.push(1);
|
|
22
|
-
connectedNetworks.push(42161);
|
|
23
|
-
usdcByNetwork[1] = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
|
24
|
-
usdcByNetwork[42161] = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;
|
|
25
|
-
|
|
26
|
-
chainId = getNetworkId();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getNetworkId() internal view returns (uint256) {
|
|
30
|
-
if (block.chainid == 1337 || block.chainid == 31337) {
|
|
31
|
-
uint256 len = connectedNetworks.length;
|
|
32
|
-
for (uint256 i = 0; i < len; i++) {
|
|
33
|
-
if (checkNetworkId(connectedNetworks[i])) {
|
|
34
|
-
return connectedNetworks[i];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return block.chainid;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function checkNetworkId(uint16 _networkId) internal view returns (bool) {
|
|
42
|
-
address tokenToCheck = usdcByNetwork[_networkId];
|
|
43
|
-
|
|
44
|
-
if (!isContract(tokenToCheck)) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try IERC20Check(tokenToCheck).totalSupply() returns (uint256) {
|
|
49
|
-
return true;
|
|
50
|
-
} catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// This method relies on extcodesize/address.code.length, which returns 0
|
|
56
|
-
// for contracts in construction, since the code is only stored at the end
|
|
57
|
-
// of the constructor execution.
|
|
58
|
-
function isContract(address account) internal view returns (bool) {
|
|
59
|
-
return account.code.length > 0;
|
|
60
|
-
}
|
|
61
|
-
}
|