@gearbox-protocol/sdk 0.0.98 → 0.0.101

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 (86) hide show
  1. package/lib/apy/convexAPY.d.ts +8 -0
  2. package/lib/apy/convexAPY.js +202 -0
  3. package/lib/apy/lidoAPY.d.ts +4 -0
  4. package/lib/apy/lidoAPY.js +97 -0
  5. package/lib/config.d.ts +1 -0
  6. package/lib/config.js +2 -1
  7. package/lib/contracts/contracts.d.ts +6 -1
  8. package/lib/contracts/contracts.js +52 -14
  9. package/lib/contracts/contractsRegister.js +3 -3
  10. package/lib/core/constants.d.ts +4 -0
  11. package/lib/core/constants.js +8 -4
  12. package/lib/core/creditAccount.d.ts +2 -0
  13. package/lib/core/creditAccount.js +31 -30
  14. package/lib/core/creditManager.d.ts +13 -2
  15. package/lib/core/creditManager.js +79 -29
  16. package/lib/core/errors.d.ts +10 -0
  17. package/lib/core/errors.js +16 -1
  18. package/lib/core/events.js +9 -9
  19. package/lib/core/multicall.d.ts +1 -1
  20. package/lib/core/pool.d.ts +1 -1
  21. package/lib/core/pool.js +7 -5
  22. package/lib/core/price.d.ts +4 -0
  23. package/lib/core/price.js +12 -0
  24. package/lib/core/strategy.d.ts +34 -0
  25. package/lib/core/strategy.js +57 -0
  26. package/lib/index.d.ts +7 -1
  27. package/lib/index.js +8 -3
  28. package/lib/pathfinder/path.js +1 -1
  29. package/lib/pathfinder/yVault.js +7 -4
  30. package/lib/payload/creditAccount.d.ts +4 -26
  31. package/lib/payload/creditManager.d.ts +12 -24
  32. package/lib/payload/pool.d.ts +2 -17
  33. package/lib/payload/pool.js +0 -1
  34. package/lib/tokens/token.js +4 -4
  35. package/lib/utils/formatter.d.ts +1 -0
  36. package/lib/utils/formatter.js +6 -1
  37. package/lib/utils/mappers.d.ts +2 -1
  38. package/lib/utils/mappers.js +13 -5
  39. package/lib/utils/multicall.js +4 -3
  40. package/lib/utils/types.d.ts +1 -0
  41. package/package.json +1 -1
  42. package/src/apy/convexAPY.ts +249 -0
  43. package/src/apy/lidoAPY.ts +81 -0
  44. package/src/config.ts +2 -1
  45. package/src/contracts/contracts.ts +69 -16
  46. package/src/contracts/contractsRegister.ts +3 -3
  47. package/src/core/constants.ts +7 -3
  48. package/src/core/creditAccount.ts +39 -33
  49. package/src/core/creditManager.ts +230 -148
  50. package/src/core/errors.ts +24 -0
  51. package/src/core/events.ts +921 -915
  52. package/src/core/multicall.ts +1 -1
  53. package/src/core/pool.ts +56 -51
  54. package/src/core/price.ts +16 -0
  55. package/src/core/strategy.ts +123 -0
  56. package/src/index.ts +8 -1
  57. package/src/pathfinder/path.ts +154 -154
  58. package/src/pathfinder/yVault.ts +57 -56
  59. package/src/payload/creditAccount.ts +4 -26
  60. package/src/payload/creditManager.ts +13 -25
  61. package/src/payload/pool.ts +2 -19
  62. package/src/tokens/token.ts +10 -5
  63. package/src/utils/formatter.ts +5 -1
  64. package/src/utils/mappers.ts +12 -5
  65. package/src/utils/multicall.ts +4 -9
  66. package/src/utils/types.ts +6 -2
  67. package/lib/core/adapters.d.ts +0 -15
  68. package/lib/core/adapters.js +0 -19
  69. package/lib/core/contracts.d.ts +0 -67
  70. package/lib/core/contracts.js +0 -254
  71. package/lib/core/contractsRegister.d.ts +0 -2
  72. package/lib/core/contractsRegister.js +0 -58
  73. package/lib/core/creditCard.d.ts +0 -13
  74. package/lib/core/creditCard.js +0 -2
  75. package/lib/core/oracles.d.ts +0 -38
  76. package/lib/core/oracles.js +0 -12
  77. package/lib/core/priceFeeds.d.ts +0 -3
  78. package/lib/core/priceFeeds.js +0 -492
  79. package/lib/core/protocols.d.ts +0 -13
  80. package/lib/core/protocols.js +0 -39
  81. package/lib/core/swap.d.ts +0 -4
  82. package/lib/core/swap.js +0 -8
  83. package/lib/core/trade.d.ts +0 -35
  84. package/lib/core/trade.js +0 -62
  85. package/lib/core/tradeTypes.d.ts +0 -79
  86. package/lib/core/tradeTypes.js +0 -21
@@ -1,492 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.priceFeedsByNetwork = void 0;
4
- var oracles_1 = require("../core/oracles");
5
- exports.priceFeedsByNetwork = {
6
- "1INCH": {
7
- priceFeedETH: {
8
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
9
- address: "0x72AFAECF99C9d9C8215fF44C77B94B99C28741e8",
10
- kovan: "0x5b65757C2d37c4FDc3c029ECb8F2C7AD3FD361C9"
11
- },
12
- priceFeedUSD: {
13
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
14
- address: "0xc929ad75B72593967DE83E7F7Cda0493458261D9",
15
- kovan: "0xb32946c38C4F2e3e44Ce2aB059BfFec163816A4E"
16
- }
17
- },
18
- AAVE: {
19
- priceFeedETH: {
20
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
21
- address: "0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012",
22
- kovan: "0x3e12e9aE09F4ce9D5809E4b863bF4eef16f9949C"
23
- },
24
- priceFeedUSD: {
25
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
26
- address: "0x547a514d5e3769680Ce22B2361c10Ea13619e8a9",
27
- kovan: "0xF1594a023a3e061765c11af09EC6B7c63e2e9Ab5"
28
- }
29
- },
30
- COMP: {
31
- priceFeedETH: {
32
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
33
- address: "0x1B39Ee86Ec5979ba5C322b826B3ECb8C79991699",
34
- kovan: "0x2d2fAc1CBf67b24d3643ce084f3758115b1dCFe0"
35
- },
36
- priceFeedUSD: {
37
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
38
- address: "0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5",
39
- kovan: "0xECF93D14d25E02bA2C13698eeDca9aA98348EFb6"
40
- }
41
- },
42
- CRV: {
43
- priceFeedETH: {
44
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
45
- address: "0x8a12Be339B0cD1829b91Adc01977caa5E9ac121e",
46
- kovan: "0x57F80b54722B294F0C1942AA70468Bb46437AD19"
47
- },
48
- priceFeedUSD: {
49
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
50
- address: "0xcd627aa160a6fa45eb793d19ef54f5062f20f33f",
51
- kovan: "0x55fe324Ece17b6902c2b3776c1baB1095Eb5deB0"
52
- }
53
- },
54
- DAI: {
55
- priceFeedETH: {
56
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
57
- address: "0x773616E4d11A78F511299002da57A0a94577F1f4",
58
- kovan: "0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541"
59
- },
60
- priceFeedUSD: {
61
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
62
- address: "0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9",
63
- kovan: "0x777A68032a88E5A84678A77Af2CD65A7b3c0775a"
64
- }
65
- },
66
- DPI: {
67
- priceFeedETH: {
68
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
69
- address: "0x029849bbc0b1d93b85a8b6190e979fd38F5760E2",
70
- kovan: "0x4c1b676445935dA58a48b6dA8B2564684d80fAEE"
71
- },
72
- priceFeedUSD: {
73
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
74
- address: "0xD2A593BF7594aCE1faD597adb697b5645d5edDB2",
75
- kovan: "0x39EcBDd1069C795e65Aa3355cC42F3acD29797d8"
76
- }
77
- },
78
- FEI: {
79
- priceFeedETH: {
80
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
81
- address: "0x7f0d2c2838c6ac24443d13e23d99490017bde370",
82
- kovan: "0x1E13BFc6e358410f4F94EAC84C1008A138FB115B"
83
- },
84
- priceFeedUSD: {
85
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
86
- address: "0x31e0a88fecb6ec0a411dbe0e9e76391498296ee9",
87
- kovan: "0x9FE550626246234EF48a1176e8e2452A14CbbA24"
88
- }
89
- },
90
- GUSD: {
91
- priceFeedUSD: {
92
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
93
- address: "0xa89f5d2365ce98B3cD68012b6f503ab1416245Fc",
94
- kovan: "0x36AD5755A58c5faB253D5e40e7F0f86293d6A5f9"
95
- }
96
- },
97
- LINK: {
98
- priceFeedETH: {
99
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
100
- address: "0xDC530D9457755926550b59e8ECcdaE7624181557",
101
- kovan: "0x3Af8C569ab77af5230596Acf0E8c2F9351d24C38"
102
- },
103
- priceFeedUSD: {
104
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
105
- address: "0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c",
106
- kovan: "0x396c5E36DD0a0F5a5D33dae44368D4193f69a1F0"
107
- }
108
- },
109
- SNX: {
110
- priceFeedETH: {
111
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
112
- address: "0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c",
113
- kovan: "0xF9A76ae7a1075Fe7d646b06fF05Bd48b9FA5582e"
114
- },
115
- priceFeedUSD: {
116
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
117
- address: "0xDC3EA94CD0AC27d9A86C180091e7f78C683d3699",
118
- kovan: "0x31f93DA9823d737b7E44bdee0DF389Fe62Fd1AcD"
119
- }
120
- },
121
- SUSHI: {
122
- priceFeedETH: {
123
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
124
- address: "0xe572CeF69f43c2E488b33924AF04BDacE19079cf",
125
- kovan: "0x6A8b2Aae8bf973EdA172C1f0e450c9D4e3C2E360"
126
- },
127
- priceFeedUSD: {
128
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
129
- address: "0xcc70f09a6cc17553b2e31954cd36e4a2d89501f7",
130
- kovan: "0x40D447115370C4B65A0d8C63275033C54A3ed61F"
131
- }
132
- },
133
- UNI: {
134
- priceFeedETH: {
135
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
136
- address: "0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e",
137
- kovan: "0x006A9A6c0A6b5230d89f05eb1e4603AA6B1508BE"
138
- },
139
- priceFeedUSD: {
140
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
141
- address: "0x553303d460EE0afB37EdFf9bE42922D8FF63220e",
142
- kovan: "0xDA5904BdBfB4EF12a3955aEcA103F51dc87c7C39"
143
- }
144
- },
145
- USDC: {
146
- priceFeedETH: {
147
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
148
- address: "0x986b5E1e1755e3C2440e960477f25201B0a8bbD4",
149
- kovan: "0x64EaC61A2DFda2c3Fa04eED49AA33D021AeC8838"
150
- },
151
- priceFeedUSD: {
152
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
153
- address: "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6",
154
- kovan: "0x9211c6b3BF41A10F78539810Cf5c64e1BB78Ec60"
155
- }
156
- },
157
- USDT: {
158
- priceFeedETH: {
159
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
160
- address: "0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46",
161
- kovan: "0x0bF499444525a23E7Bb61997539725cA2e928138"
162
- },
163
- priceFeedUSD: {
164
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
165
- address: "0x3e7d1eab13ad0104d2750b8863b489d65364e32d",
166
- kovan: "0x2ca5A90D34cA333661083F89D831f757A9A50148"
167
- }
168
- },
169
- WBTC: {
170
- priceFeedETH: {
171
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
172
- address: "0xdeb288F737066589598e9214E782fa5A8eD689e8",
173
- kovan: "0xB4F231198CAA3446fd4623e59f2EF27e7A58A54b"
174
- },
175
- priceFeedUSD: {
176
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
177
- address: "0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c",
178
- kovan: "0x6135b13325bfC4B00278B4abC5e20bbce2D6580e"
179
- }
180
- },
181
- WETH: {
182
- priceFeedUSD: {
183
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
184
- address: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
185
- kovan: "0x9326BFA02ADD2366b30bacB125260Af641031331"
186
- }
187
- },
188
- YFI: {
189
- priceFeedETH: {
190
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
191
- address: "0x7c5d4F8345e66f68099581Db340cd65B078C41f4",
192
- kovan: "0x29d651D233ffFdec4Df5244a9cE842FB253fAA09"
193
- },
194
- priceFeedUSD: {
195
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
196
- address: "0xA027702dbb89fbd58938e4324ac03B58d812b0E1",
197
- kovan: "0x7f6a535B75E2c815f8865CF39Ad847971AcCC3bE"
198
- }
199
- },
200
- /// UPDATE
201
- STETH: {
202
- priceFeedETH: {
203
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
204
- address: "0xcfe54b5cd566ab89272946f602d76ea879cab4a8",
205
- kovan: "0x087154969f935218e10f621D81e523C8f46C6dF9"
206
- },
207
- priceFeedUSD: {
208
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
209
- address: "0xCfE54B5cD566aB89272946F602D76Ea879CAb4a8",
210
- kovan: "0x94dd77F85E0B1e6942B044E604EBA4869369453c"
211
- }
212
- },
213
- FTM: {
214
- priceFeedETH: {
215
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
216
- address: "0x2de7e4a9488488e0058b95854cc2f7955b35dc9b",
217
- kovan: "0xdCd1eB60388F340d7bF6584aa4295D95b355686c"
218
- }
219
- },
220
- CVX: {
221
- priceFeedUSD: {
222
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
223
- address: "0xd962fc30a72a84ce50161031391756bf2876af5d",
224
- kovan: "0xa6CeAbA9326C3a7Ed6A03A1cb0809A397ed286ae"
225
- }
226
- },
227
- FRAX: {
228
- priceFeedUSD: {
229
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
230
- address: "0xb9e1e3a9feff48998e45fa90847ed4d467e8bcfd",
231
- kovan: "0xD696fF0750F753A605236Ab499E5432e0FdeCd72"
232
- }
233
- },
234
- LUSD: {
235
- priceFeedUSD: {
236
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
237
- address: "0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0",
238
- kovan: "0xc17F8AE0c6C060F76303Be13f5f059144b38e75e"
239
- }
240
- },
241
- sUSD: {
242
- priceFeedUSD: {
243
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
244
- address: "0xad35bd71b9afe6e4bdc266b345c198eadef9ad94",
245
- kovan: "0xe45b2D1e60d94209ef36e2E66a232daefc418de2"
246
- }
247
- },
248
- FXS: {
249
- priceFeedUSD: {
250
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
251
- address: "0x6ebc52c8c1089be9eb3945c4350b68b8e4c2233f",
252
- kovan: "0xC6f5343637279AF7e2a4e12066Fb5ae567275E5F"
253
- }
254
- },
255
- LDO: {
256
- priceFeedETH: {
257
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
258
- address: "0x4e844125952d32acdf339be976c98e22f6f318db",
259
- kovan: "0x6204148EF888786A2988E7b09c8e0A67e32cb387"
260
- },
261
- priceFeedUSD: {
262
- type: oracles_1.OracleType.ZERO_ORACLE
263
- }
264
- // ADD ETH-> DAI Oracle!
265
- },
266
- LQTY: {
267
- priceFeedUSD: {
268
- type: oracles_1.OracleType.ZERO_ORACLE
269
- }
270
- },
271
- SPELL: {
272
- priceFeedUSD: {
273
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
274
- address: "0x8c110b94c5f1d347facf5e1e938ab2db60e3c9a8",
275
- kovan: "0x68da666AcD151A3edB62c1ad1b748cCcFca026d7"
276
- }
277
- },
278
- LUNA: {
279
- priceFeedETH: {
280
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
281
- address: "0x91e9331556ed76c9393055719986409e11b56f73",
282
- kovan: "0xEfAe1275132C3D2EE009148748e3e3e384095E5f"
283
- }
284
- },
285
- yvDAI: {
286
- priceFeedETH: {
287
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
288
- token: "DAI",
289
- deployedKovan: ""
290
- },
291
- priceFeedUSD: {
292
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
293
- token: "DAI"
294
- }
295
- },
296
- yvUSDC: {
297
- priceFeedETH: {
298
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
299
- token: "USDC",
300
- deployedKovan: ""
301
- },
302
- priceFeedUSD: {
303
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
304
- token: "USDC"
305
- }
306
- },
307
- yvWETH: {
308
- priceFeedUSD: {
309
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
310
- token: "WETH"
311
- }
312
- },
313
- yvWBTC: {
314
- priceFeedUSD: {
315
- type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
316
- token: "WBTC"
317
- }
318
- },
319
- // CURVE LP TOKENS
320
- "3Crv": {
321
- priceFeedUSD: {
322
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
323
- assets: ["DAI", "USDC", "USDT"]
324
- }
325
- },
326
- steCRV: {
327
- priceFeedUSD: {
328
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
329
- assets: ["STETH", "WETH"]
330
- }
331
- },
332
- FRAX3CRV: {
333
- priceFeedUSD: {
334
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
335
- assets: ["FRAX", "DAI", "USDC", "USDT"]
336
- }
337
- },
338
- LUSD3CRV: {
339
- priceFeedUSD: {
340
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
341
- assets: ["LUSD", "DAI", "USDC", "USDT"]
342
- }
343
- },
344
- crvPlain3andSUSD: {
345
- priceFeedUSD: {
346
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
347
- assets: ["DAI", "USDC", "USDT", "sUSD"]
348
- }
349
- },
350
- gusd3CRV: {
351
- priceFeedUSD: {
352
- type: oracles_1.OracleType.CURVE_LP_ORACLE,
353
- assets: ["GUSD", "DAI", "USDC", "USDT"]
354
- }
355
- },
356
- // YEARN- CURVE TOKENS
357
- yvCurve_stETH: {
358
- priceFeedUSD: {
359
- type: oracles_1.OracleType.YEARN_CURVE_LP_ORACLE,
360
- curveSymbol: "steCRV"
361
- }
362
- },
363
- yvCURVE_FRAX_POOL: {
364
- priceFeedUSD: {
365
- type: oracles_1.OracleType.YEARN_CURVE_LP_ORACLE,
366
- curveSymbol: "FRAX3CRV"
367
- }
368
- },
369
- // CVX tokens
370
- cvx3Crv: {
371
- priceFeedUSD: {
372
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
373
- curveSymbol: "3Crv"
374
- }
375
- },
376
- cvxsteCRV: {
377
- priceFeedUSD: {
378
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
379
- curveSymbol: "steCRV"
380
- }
381
- },
382
- cvxFRAX3CRV: {
383
- priceFeedUSD: {
384
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
385
- curveSymbol: "FRAX3CRV"
386
- }
387
- },
388
- cvxcrvPlain3andSUSD: {
389
- priceFeedUSD: {
390
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
391
- curveSymbol: "crvPlain3andSUSD"
392
- }
393
- },
394
- cvxgusd3CRV: {
395
- priceFeedUSD: {
396
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
397
- curveSymbol: "gusd3CRV"
398
- }
399
- },
400
- // CVX tokens
401
- stkcvx3Crv: {
402
- priceFeedUSD: {
403
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
404
- curveSymbol: "3Crv"
405
- }
406
- },
407
- stkcvxsteCRV: {
408
- priceFeedUSD: {
409
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
410
- curveSymbol: "steCRV"
411
- }
412
- },
413
- stkcvxFRAX3CRV: {
414
- priceFeedUSD: {
415
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
416
- curveSymbol: "FRAX3CRV"
417
- }
418
- },
419
- stkcvxcrvPlain3andSUSD: {
420
- priceFeedUSD: {
421
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
422
- curveSymbol: "crvPlain3andSUSD"
423
- }
424
- },
425
- stkcvxgusd3CRV: {
426
- priceFeedUSD: {
427
- type: oracles_1.OracleType.LIKE_CURVE_LP_ORACLE,
428
- curveSymbol: "gusd3CRV"
429
- }
430
- },
431
- //GEARBOX
432
- dDAI: {
433
- priceFeedETH: {
434
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
435
- address: "",
436
- kovan: ""
437
- },
438
- priceFeedUSD: {
439
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
440
- address: "",
441
- kovan: ""
442
- }
443
- },
444
- dUSDC: {
445
- priceFeedETH: {
446
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
447
- address: "",
448
- kovan: ""
449
- },
450
- priceFeedUSD: {
451
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
452
- address: "",
453
- kovan: ""
454
- }
455
- },
456
- dWBTC: {
457
- priceFeedETH: {
458
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
459
- address: "",
460
- kovan: ""
461
- },
462
- priceFeedUSD: {
463
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
464
- address: "",
465
- kovan: ""
466
- }
467
- },
468
- dWETH: {
469
- priceFeedETH: {
470
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
471
- address: "",
472
- kovan: ""
473
- },
474
- priceFeedUSD: {
475
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
476
- address: "",
477
- kovan: ""
478
- }
479
- },
480
- GEAR: {
481
- priceFeedETH: {
482
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
483
- address: "",
484
- kovan: ""
485
- },
486
- priceFeedUSD: {
487
- type: oracles_1.OracleType.CHAINLINK_ORACLE,
488
- address: "",
489
- kovan: ""
490
- }
491
- }
492
- };
@@ -1,13 +0,0 @@
1
- export declare enum Protocols {
2
- Uniswap = 0,
3
- Sushiswap = 1,
4
- Curve = 2,
5
- Yearn = 3,
6
- Convex = 4,
7
- Lido = 5
8
- }
9
- export interface ProtocolData {
10
- name: string;
11
- icon: string;
12
- }
13
- export declare const protocolData: Record<Protocols, ProtocolData>;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.protocolData = exports.Protocols = void 0;
5
- var Protocols;
6
- (function (Protocols) {
7
- Protocols[Protocols["Uniswap"] = 0] = "Uniswap";
8
- Protocols[Protocols["Sushiswap"] = 1] = "Sushiswap";
9
- Protocols[Protocols["Curve"] = 2] = "Curve";
10
- Protocols[Protocols["Yearn"] = 3] = "Yearn";
11
- Protocols[Protocols["Convex"] = 4] = "Convex";
12
- Protocols[Protocols["Lido"] = 5] = "Lido";
13
- })(Protocols = exports.Protocols || (exports.Protocols = {}));
14
- exports.protocolData = (_a = {},
15
- _a[Protocols.Uniswap] = {
16
- name: "Uniswap",
17
- icon: "/protocols/uniswap.png"
18
- },
19
- _a[Protocols.Sushiswap] = {
20
- name: "Sushiswap",
21
- icon: "/protocols/sushi.svg"
22
- },
23
- _a[Protocols.Curve] = {
24
- name: "Curve",
25
- icon: "/protocols/curve.svg"
26
- },
27
- _a[Protocols.Yearn] = {
28
- name: "Yearn",
29
- icon: "/protocols/yearn.svg"
30
- },
31
- _a[Protocols.Convex] = {
32
- name: "Convex",
33
- icon: "/protocols/convex.svg"
34
- },
35
- _a[Protocols.Lido] = {
36
- name: "Lido",
37
- icon: "/protocols/lido.svg"
38
- },
39
- _a);
@@ -1,4 +0,0 @@
1
- export declare enum SwapType {
2
- ExactInput = 1,
3
- ExactOutput = 2
4
- }
package/lib/core/swap.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapType = void 0;
4
- var SwapType;
5
- (function (SwapType) {
6
- SwapType[SwapType["ExactInput"] = 1] = "ExactInput";
7
- SwapType[SwapType["ExactOutput"] = 2] = "ExactOutput";
8
- })(SwapType = exports.SwapType || (exports.SwapType = {}));
@@ -1,35 +0,0 @@
1
- import { BigNumber } from "ethers";
2
- import { SwapType } from "./swap";
3
- import { BytesLike } from "@ethersproject/bytes";
4
- export interface CloseTradePath {
5
- path: Array<string>;
6
- amountOutMin: BigNumber;
7
- }
8
- export declare class TradePath {
9
- readonly swapType: SwapType;
10
- readonly amount: BigNumber;
11
- readonly rate: BigNumber;
12
- readonly path: Array<string>;
13
- readonly expectedAmount: BigNumber;
14
- readonly pathUniV3: BytesLike | undefined;
15
- readonly i: number | undefined;
16
- readonly j: number | undefined;
17
- readonly operationName: string | undefined;
18
- constructor(params: {
19
- swapType: SwapType;
20
- amount: BigNumber;
21
- path: Array<string>;
22
- expectedAmount: BigNumber;
23
- pathUniV3?: BytesLike;
24
- i?: number;
25
- j?: number;
26
- operationName?: string;
27
- });
28
- getExpectedAmountWithSlippage(slippage: number): BigNumber;
29
- getAmountInMax(slippage: number): BigNumber;
30
- getAmountOutMin(slippage: number): BigNumber;
31
- get from(): string;
32
- get to(): string;
33
- getFromAmount(slippage: number): BigNumber;
34
- getToAmount(slippage: number): BigNumber;
35
- }
package/lib/core/trade.js DELETED
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TradePath = void 0;
4
- var swap_1 = require("./swap");
5
- var constants_1 = require("./constants");
6
- var TradePath = /** @class */ (function () {
7
- function TradePath(params) {
8
- this.swapType = params.swapType;
9
- this.amount = params.amount;
10
- this.path = params.path;
11
- this.expectedAmount = params.expectedAmount;
12
- this.pathUniV3 = params.pathUniV3;
13
- this.rate =
14
- params.swapType !== swap_1.SwapType.ExactInput
15
- ? params.expectedAmount.mul(constants_1.WAD).div(params.amount)
16
- : constants_1.WAD.mul(params.amount).div(params.expectedAmount);
17
- this.i = params.i;
18
- this.j = params.j;
19
- this.operationName = params.operationName;
20
- }
21
- TradePath.prototype.getExpectedAmountWithSlippage = function (slippage) {
22
- return this.swapType === swap_1.SwapType.ExactInput
23
- ? this.getAmountOutMin(slippage)
24
- : this.getAmountInMax(slippage);
25
- };
26
- TradePath.prototype.getAmountInMax = function (slippage) {
27
- return this.expectedAmount
28
- .mul(constants_1.PERCENTAGE_FACTOR + slippage)
29
- .div(constants_1.PERCENTAGE_FACTOR);
30
- };
31
- TradePath.prototype.getAmountOutMin = function (slippage) {
32
- return this.expectedAmount
33
- .mul(constants_1.PERCENTAGE_FACTOR)
34
- .div(constants_1.PERCENTAGE_FACTOR + slippage);
35
- };
36
- Object.defineProperty(TradePath.prototype, "from", {
37
- get: function () {
38
- return this.path[0];
39
- },
40
- enumerable: false,
41
- configurable: true
42
- });
43
- Object.defineProperty(TradePath.prototype, "to", {
44
- get: function () {
45
- return this.path[this.path.length - 1];
46
- },
47
- enumerable: false,
48
- configurable: true
49
- });
50
- TradePath.prototype.getFromAmount = function (slippage) {
51
- return this.swapType === swap_1.SwapType.ExactInput
52
- ? this.amount
53
- : this.getExpectedAmountWithSlippage(slippage);
54
- };
55
- TradePath.prototype.getToAmount = function (slippage) {
56
- return this.swapType === swap_1.SwapType.ExactOutput
57
- ? this.amount
58
- : this.getExpectedAmountWithSlippage(slippage);
59
- };
60
- return TradePath;
61
- }());
62
- exports.TradePath = TradePath;