@curvefi/api 2.34.3 → 2.36.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/README.md +38 -1
- package/lib/constants/aliases.js +11 -11
- package/lib/constants/coins/ethereum.js +1 -1
- package/lib/constants/pools/ethereum.js +3 -3
- package/lib/curve.d.ts +5 -1
- package/lib/curve.js +62 -34
- package/lib/external-api.d.ts +1 -1
- package/lib/factory/constants.js +2 -1
- package/lib/factory/deploy.d.ts +2 -2
- package/lib/factory/deploy.js +8 -2
- package/lib/factory/factory-api.d.ts +1 -1
- package/lib/factory/factory-api.js +3 -3
- package/lib/factory/factory-crypto.js +1 -0
- package/lib/index.d.ts +7 -2
- package/lib/index.js +5 -0
- package/lib/pools/PoolTemplate.js +1 -1
- package/lib/pools/utils.js +3 -12
- package/lib/router.js +2 -2
- package/lib/utils.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ import curve from "@curvefi/api";
|
|
|
24
24
|
|
|
25
25
|
// Fetch factory pools
|
|
26
26
|
await curve.factory.fetchPools();
|
|
27
|
+
await curve.crvUSDFactory.fetchPools();
|
|
27
28
|
await curve.cryptoFactory.fetchPools();
|
|
28
29
|
})()
|
|
29
30
|
```
|
|
@@ -185,9 +186,10 @@ import curve from "@curvefi/api";
|
|
|
185
186
|
(async () => {
|
|
186
187
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
187
188
|
await curve.factory.fetchPools();
|
|
189
|
+
await curve.crvUSDFactory.fetchPools();
|
|
188
190
|
await curve.cryptoFactory.fetchPools();
|
|
189
191
|
|
|
190
|
-
curve.
|
|
192
|
+
curve.getMainPoolList();
|
|
191
193
|
// [
|
|
192
194
|
// 'compound', 'usdt', 'y', 'busd',
|
|
193
195
|
// 'susd', 'pax', 'ren', 'sbtc',
|
|
@@ -233,6 +235,9 @@ import curve from "@curvefi/api";
|
|
|
233
235
|
// 'factory-v2-101', 'factory-v2-102', 'factory-v2-103', 'factory-v2-104',
|
|
234
236
|
// ... 27 more items
|
|
235
237
|
// ]
|
|
238
|
+
|
|
239
|
+
curve.crvUSDFactory.getPoolList();
|
|
240
|
+
// ['factory-crvusd-0', 'factory-crvusd-1', 'factory-crvusd-2', 'factory-crvusd-3']
|
|
236
241
|
|
|
237
242
|
curve.cryptoFactory.getPoolList();
|
|
238
243
|
// [
|
|
@@ -258,6 +263,36 @@ import curve from "@curvefi/api";
|
|
|
258
263
|
// 'factory-crypto-57', 'factory-crypto-58', 'factory-crypto-59',
|
|
259
264
|
// 'factory-crypto-60', 'factory-crypto-61', 'factory-crypto-62'
|
|
260
265
|
// ]
|
|
266
|
+
|
|
267
|
+
curve.getPoolList();
|
|
268
|
+
// [
|
|
269
|
+
// 'compound', 'usdt', 'y', 'busd',
|
|
270
|
+
// 'susd', 'pax', 'ren', 'sbtc',
|
|
271
|
+
// 'hbtc', '3pool', 'gusd', 'husd',
|
|
272
|
+
// 'usdk', 'usdn', 'musd', 'rsv',
|
|
273
|
+
// 'tbtc', 'dusd', 'pbtc', 'bbtc',
|
|
274
|
+
// 'obtc', 'seth', 'eurs', 'ust',
|
|
275
|
+
// 'aave', 'steth', 'saave', 'ankreth',
|
|
276
|
+
// 'usdp', 'ib', 'link', 'tusd',
|
|
277
|
+
// 'frax', 'lusd', 'busdv2', 'reth',
|
|
278
|
+
// 'alusd', 'mim', 'tricrypto2', 'eurt',
|
|
279
|
+
// 'eurtusd', 'eursusd', 'crveth', 'rai',
|
|
280
|
+
// 'cvxeth', 'xautusd', 'spelleth', 'teth',
|
|
281
|
+
// '2pool', '4pool', 'fraxusdc', 'euroc',
|
|
282
|
+
// 'frxeth', 'sbtc2', 'fraxusdp', 'wbeth',
|
|
283
|
+
// 'factory-v2-2', 'factory-v2-3', 'factory-v2-5', 'factory-v2-7',
|
|
284
|
+
// 'factory-v2-9', 'factory-v2-10', 'factory-v2-11', 'factory-v2-14',
|
|
285
|
+
// 'factory-v2-21', 'factory-v2-22', 'factory-v2-23', 'factory-v2-24',
|
|
286
|
+
// 'factory-v2-25', 'factory-v2-27', 'factory-v2-28', 'factory-v2-29',
|
|
287
|
+
// 'factory-v2-30', 'factory-v2-31', 'factory-v2-32', 'factory-v2-33',
|
|
288
|
+
// 'factory-v2-34', 'factory-v2-35', 'factory-v2-37', 'factory-v2-38',
|
|
289
|
+
// 'factory-v2-41', 'factory-v2-42', 'factory-v2-43', 'factory-v2-44',
|
|
290
|
+
// 'factory-v2-45', 'factory-v2-47', 'factory-v2-48', 'factory-v2-49',
|
|
291
|
+
// 'factory-v2-50', 'factory-v2-51', 'factory-v2-52', 'factory-v2-53',
|
|
292
|
+
// 'factory-v2-55', 'factory-v2-56', 'factory-v2-57', 'factory-v2-58',
|
|
293
|
+
// 'factory-v2-59', 'factory-v2-60', 'factory-v2-61', 'factory-v2-62',
|
|
294
|
+
// ... 493 more items
|
|
295
|
+
// ]
|
|
261
296
|
})()
|
|
262
297
|
````
|
|
263
298
|
|
|
@@ -268,6 +303,7 @@ import curve from "@curvefi/api";
|
|
|
268
303
|
(async () => {
|
|
269
304
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
270
305
|
await curve.factory.fetchPools();
|
|
306
|
+
await curve.crvUSDFactory.fetchPools();
|
|
271
307
|
await curve.cryptoFactory.fetchPools();
|
|
272
308
|
|
|
273
309
|
const pool = curve.getPool('factory-v2-11');
|
|
@@ -973,6 +1009,7 @@ import curve from "@curvefi/api";
|
|
|
973
1009
|
(async () => {
|
|
974
1010
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
975
1011
|
await curve.factory.fetchPools();
|
|
1012
|
+
await curve.crvUSDFactory.fetchPools();
|
|
976
1013
|
await curve.cryptoFactory.fetchPools();
|
|
977
1014
|
|
|
978
1015
|
await curve.getBalances(['DAI', 'CRV']);
|
package/lib/constants/aliases.js
CHANGED
|
@@ -10,7 +10,7 @@ export var ALIASES_ETHEREUM = lowerCaseValues({
|
|
|
10
10
|
"deposit_and_stake": "0x271fbE8aB7f1fB262f81C77Ea5303F03DA9d3d6A",
|
|
11
11
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
12
12
|
"factory": '0xb9fc157394af804a3578134a6585c0dc9cc990d4',
|
|
13
|
-
"crvusd_factory": '
|
|
13
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
14
14
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
15
15
|
"registry_exchange": "",
|
|
16
16
|
});
|
|
@@ -25,7 +25,7 @@ export var ALIASES_POLYGON = lowerCaseValues({
|
|
|
25
25
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
26
26
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
27
27
|
"factory": '0x722272d36ef0da72ff51c5a65db7b870e2e8d4ee',
|
|
28
|
-
"crvusd_factory": '
|
|
28
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
29
29
|
"crypto_factory": "0xE5De15A9C9bBedb4F5EC13B131E61245f2983A69",
|
|
30
30
|
"registry_exchange": "",
|
|
31
31
|
});
|
|
@@ -40,7 +40,7 @@ export var ALIASES_FANTOM = lowerCaseValues({
|
|
|
40
40
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
41
41
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
42
42
|
"factory": "0x686d67265703d1f124c45e33d47d794c566889ba",
|
|
43
|
-
"crvusd_factory": '
|
|
43
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
44
44
|
"crypto_factory": "0xE5De15A9C9bBedb4F5EC13B131E61245f2983A69",
|
|
45
45
|
"registry_exchange": "",
|
|
46
46
|
});
|
|
@@ -55,7 +55,7 @@ export var ALIASES_AVALANCHE = lowerCaseValues({
|
|
|
55
55
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
56
56
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
57
57
|
"factory": '0xb17b674D9c5CB2e441F8e196a2f048A81355d031',
|
|
58
|
-
"crvusd_factory": '
|
|
58
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
59
59
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
60
60
|
"registry_exchange": "",
|
|
61
61
|
});
|
|
@@ -70,7 +70,7 @@ export var ALIASES_ARBITRUM = lowerCaseValues({
|
|
|
70
70
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
71
71
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
72
72
|
"factory": '0xb17b674D9c5CB2e441F8e196a2f048A81355d031',
|
|
73
|
-
"crvusd_factory": '
|
|
73
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
74
74
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
75
75
|
"registry_exchange": "",
|
|
76
76
|
});
|
|
@@ -85,7 +85,7 @@ export var ALIASES_OPTIMISM = lowerCaseValues({
|
|
|
85
85
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
86
86
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
87
87
|
"factory": '0x2db0E83599a91b508Ac268a6197b8B14F5e72840',
|
|
88
|
-
"crvusd_factory": '
|
|
88
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
89
89
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
90
90
|
"registry_exchange": "",
|
|
91
91
|
});
|
|
@@ -100,7 +100,7 @@ export var ALIASES_XDAI = lowerCaseValues({
|
|
|
100
100
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
101
101
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
102
102
|
"factory": '0xD19Baeadc667Cf2015e395f2B08668Ef120f41F5',
|
|
103
|
-
"crvusd_factory": '
|
|
103
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
104
104
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
105
105
|
"registry_exchange": "",
|
|
106
106
|
});
|
|
@@ -115,7 +115,7 @@ export var ALIASES_MOONBEAM = lowerCaseValues({
|
|
|
115
115
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
116
116
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
117
117
|
"factory": '0x4244eB811D6e0Ef302326675207A95113dB4E1F8',
|
|
118
|
-
"crvusd_factory": '
|
|
118
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
119
119
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
120
120
|
"registry_exchange": "",
|
|
121
121
|
});
|
|
@@ -130,7 +130,7 @@ export var ALIASES_AURORA = lowerCaseValues({
|
|
|
130
130
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
131
131
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
132
132
|
"factory": '0xb9fc157394af804a3578134a6585c0dc9cc990d4',
|
|
133
|
-
"crvusd_factory": '
|
|
133
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
134
134
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
135
135
|
"registry_exchange": "",
|
|
136
136
|
});
|
|
@@ -145,7 +145,7 @@ export var ALIASES_KAVA = lowerCaseValues({
|
|
|
145
145
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
146
146
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
147
147
|
"factory": '0x40bc62805471eF53DdD5C5cF99ed3d9e5aa81b48',
|
|
148
|
-
"crvusd_factory": '
|
|
148
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
149
149
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
150
150
|
"registry_exchange": "",
|
|
151
151
|
});
|
|
@@ -160,7 +160,7 @@ export var ALIASES_CELO = lowerCaseValues({
|
|
|
160
160
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
161
161
|
"stable_calc": "0x5552b631e2aD801fAa129Aacf4B701071cC9D1f7",
|
|
162
162
|
"factory": '0x5277A0226d10392295E8D383E9724D6E416d6e6C',
|
|
163
|
-
"crvusd_factory": '
|
|
163
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
164
164
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
165
165
|
"registry_exchange": "",
|
|
166
166
|
});
|
|
@@ -2,7 +2,7 @@ import { lowerCaseValues } from "../utils.js";
|
|
|
2
2
|
export var COINS_ETHEREUM = lowerCaseValues({
|
|
3
3
|
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
4
4
|
// --- USD ---
|
|
5
|
-
'crvusd': "
|
|
5
|
+
'crvusd': "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
|
|
6
6
|
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
7
7
|
ycdai: "0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc",
|
|
8
8
|
ycusdc: "0x9777d7E2b60bB01759D0E2f8be2095df444cb07E",
|
|
@@ -1650,7 +1650,7 @@ export var LLAMMAS_DATA_ETHEREUM = lowerCasePoolDataAddresses({
|
|
|
1650
1650
|
full_name: "sfrxeth",
|
|
1651
1651
|
symbol: "sfrxeth",
|
|
1652
1652
|
reference_asset: 'CRYPTO',
|
|
1653
|
-
swap_address: '
|
|
1653
|
+
swap_address: '0x136e783846ef68C8Bd00a3369F787dF8d683a696',
|
|
1654
1654
|
token_address: '0x0000000000000000000000000000000000000000',
|
|
1655
1655
|
gauge_address: '0x0000000000000000000000000000000000000000',
|
|
1656
1656
|
is_crypto: true,
|
|
@@ -1659,11 +1659,11 @@ export var LLAMMAS_DATA_ETHEREUM = lowerCasePoolDataAddresses({
|
|
|
1659
1659
|
underlying_coins: ['crvUSD', 'sfrxETH'],
|
|
1660
1660
|
wrapped_coins: ['crvUSD', 'sfrxETH'],
|
|
1661
1661
|
underlying_coin_addresses: [
|
|
1662
|
-
'
|
|
1662
|
+
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
1663
1663
|
'0xac3E018457B222d93114458476f3E3416Abbe38F',
|
|
1664
1664
|
],
|
|
1665
1665
|
wrapped_coin_addresses: [
|
|
1666
|
-
'
|
|
1666
|
+
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
1667
1667
|
'0xac3E018457B222d93114458476f3E3416Abbe38F',
|
|
1668
1668
|
],
|
|
1669
1669
|
underlying_decimals: [18, 18],
|
package/lib/curve.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare class Curve implements ICurve {
|
|
|
48
48
|
ALIASES: IDict<string>;
|
|
49
49
|
POOLS_DATA: IDict<IPoolData>;
|
|
50
50
|
FACTORY_POOLS_DATA: IDict<IPoolData>;
|
|
51
|
+
CRVUSD_FACTORY_POOLS_DATA: IDict<IPoolData>;
|
|
51
52
|
CRYPTO_FACTORY_POOLS_DATA: IDict<IPoolData>;
|
|
52
53
|
LLAMMAS_DATA: IDict<IPoolData>;
|
|
53
54
|
COINS: IDict<string>;
|
|
@@ -74,14 +75,17 @@ declare class Curve implements ICurve {
|
|
|
74
75
|
_filterHiddenPools(pools: IDict<IPoolData>): Promise<IDict<IPoolData>>;
|
|
75
76
|
_updateDecimalsAndGauges(pools: IDict<IPoolData>): void;
|
|
76
77
|
fetchFactoryPools: (useApi?: boolean) => Promise<void>;
|
|
78
|
+
fetchCrvusdFactoryPools: (useApi?: boolean) => Promise<void>;
|
|
77
79
|
fetchCryptoFactoryPools: (useApi?: boolean) => Promise<void>;
|
|
78
80
|
fetchNewFactoryPools: () => Promise<string[]>;
|
|
79
81
|
fetchNewCryptoFactoryPools: () => Promise<string[]>;
|
|
80
82
|
fetchRecentlyDeployedFactoryPool: (poolAddress: string) => Promise<string>;
|
|
81
83
|
fetchRecentlyDeployedCryptoFactoryPool: (poolAddress: string) => Promise<string>;
|
|
82
|
-
|
|
84
|
+
getMainPoolList: () => string[];
|
|
83
85
|
getFactoryPoolList: () => string[];
|
|
86
|
+
getCrvusdFactoryPoolList: () => string[];
|
|
84
87
|
getCryptoFactoryPoolList: () => string[];
|
|
88
|
+
getPoolList: () => string[];
|
|
85
89
|
setCustomFeeData(customFeeData: {
|
|
86
90
|
gasPrice?: number;
|
|
87
91
|
maxFeePerGas?: number;
|
package/lib/curve.js
CHANGED
|
@@ -299,48 +299,72 @@ var Curve = /** @class */ (function () {
|
|
|
299
299
|
this.fetchFactoryPools = function (useApi) {
|
|
300
300
|
if (useApi === void 0) { useApi = true; }
|
|
301
301
|
return __awaiter(_this, void 0, void 0, function () {
|
|
302
|
-
var _a, _b,
|
|
303
|
-
return __generator(this, function (
|
|
304
|
-
switch (
|
|
302
|
+
var _a, _b, _c, _d, _e;
|
|
303
|
+
return __generator(this, function (_f) {
|
|
304
|
+
switch (_f.label) {
|
|
305
305
|
case 0:
|
|
306
306
|
if (this.chainId === 1313161554)
|
|
307
307
|
return [2 /*return*/];
|
|
308
|
-
if (!useApi) return [3 /*break*/,
|
|
308
|
+
if (!useApi) return [3 /*break*/, 2];
|
|
309
309
|
_a = this.constants;
|
|
310
310
|
_b = lowerCasePoolDataAddresses;
|
|
311
|
-
return [4 /*yield*/, getFactoryPoolsDataFromApi.call(this,
|
|
311
|
+
return [4 /*yield*/, getFactoryPoolsDataFromApi.call(this, "factory")];
|
|
312
312
|
case 1:
|
|
313
|
-
_a.FACTORY_POOLS_DATA = _b.apply(void 0, [
|
|
314
|
-
|
|
315
|
-
_c = lowerCasePoolDataAddresses;
|
|
316
|
-
return [4 /*yield*/, getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.crvusd_factory)];
|
|
313
|
+
_a.FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
314
|
+
return [3 /*break*/, 4];
|
|
317
315
|
case 2:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
_h.label = 3;
|
|
321
|
-
case 3: return [3 /*break*/, 7];
|
|
322
|
-
case 4:
|
|
323
|
-
_d = this.constants;
|
|
324
|
-
_e = lowerCasePoolDataAddresses;
|
|
316
|
+
_c = this.constants;
|
|
317
|
+
_d = lowerCasePoolDataAddresses;
|
|
325
318
|
return [4 /*yield*/, getFactoryPoolData.call(this)];
|
|
326
|
-
case
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
case 6:
|
|
332
|
-
poolData = _f.apply(void 0, [_h.sent()]);
|
|
333
|
-
this.constants.FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
|
|
334
|
-
_h.label = 7;
|
|
335
|
-
case 7:
|
|
336
|
-
_g = this.constants;
|
|
319
|
+
case 3:
|
|
320
|
+
_c.FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
321
|
+
_f.label = 4;
|
|
322
|
+
case 4:
|
|
323
|
+
_e = this.constants;
|
|
337
324
|
return [4 /*yield*/, this._filterHiddenPools(this.constants.FACTORY_POOLS_DATA)];
|
|
338
|
-
case
|
|
339
|
-
|
|
325
|
+
case 5:
|
|
326
|
+
_e.FACTORY_POOLS_DATA = _f.sent();
|
|
340
327
|
this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
|
|
341
328
|
return [4 /*yield*/, _killGauges(this.constants.FACTORY_POOLS_DATA)];
|
|
342
|
-
case
|
|
343
|
-
|
|
329
|
+
case 6:
|
|
330
|
+
_f.sent();
|
|
331
|
+
return [2 /*return*/];
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
this.fetchCrvusdFactoryPools = function (useApi) {
|
|
337
|
+
if (useApi === void 0) { useApi = true; }
|
|
338
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
339
|
+
var _a, _b, _c, _d, _e;
|
|
340
|
+
return __generator(this, function (_f) {
|
|
341
|
+
switch (_f.label) {
|
|
342
|
+
case 0:
|
|
343
|
+
if (this.chainId != 1)
|
|
344
|
+
return [2 /*return*/];
|
|
345
|
+
if (!useApi) return [3 /*break*/, 2];
|
|
346
|
+
_a = this.constants;
|
|
347
|
+
_b = lowerCasePoolDataAddresses;
|
|
348
|
+
return [4 /*yield*/, getFactoryPoolsDataFromApi.call(this, "factory-crvusd")];
|
|
349
|
+
case 1:
|
|
350
|
+
_a.CRVUSD_FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
351
|
+
return [3 /*break*/, 4];
|
|
352
|
+
case 2:
|
|
353
|
+
_c = this.constants;
|
|
354
|
+
_d = lowerCasePoolDataAddresses;
|
|
355
|
+
return [4 /*yield*/, getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.crvusd_factory)];
|
|
356
|
+
case 3:
|
|
357
|
+
_c.CRVUSD_FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
|
|
358
|
+
_f.label = 4;
|
|
359
|
+
case 4:
|
|
360
|
+
_e = this.constants;
|
|
361
|
+
return [4 /*yield*/, this._filterHiddenPools(this.constants.CRVUSD_FACTORY_POOLS_DATA)];
|
|
362
|
+
case 5:
|
|
363
|
+
_e.CRVUSD_FACTORY_POOLS_DATA = _f.sent();
|
|
364
|
+
this._updateDecimalsAndGauges(this.constants.CRVUSD_FACTORY_POOLS_DATA);
|
|
365
|
+
return [4 /*yield*/, _killGauges(this.constants.CRVUSD_FACTORY_POOLS_DATA)];
|
|
366
|
+
case 6:
|
|
367
|
+
_f.sent();
|
|
344
368
|
return [2 /*return*/];
|
|
345
369
|
}
|
|
346
370
|
});
|
|
@@ -358,7 +382,7 @@ var Curve = /** @class */ (function () {
|
|
|
358
382
|
if (!useApi) return [3 /*break*/, 2];
|
|
359
383
|
_a = this.constants;
|
|
360
384
|
_b = lowerCasePoolDataAddresses;
|
|
361
|
-
return [4 /*yield*/, getFactoryPoolsDataFromApi.call(this,
|
|
385
|
+
return [4 /*yield*/, getFactoryPoolsDataFromApi.call(this, "factory-crypto")];
|
|
362
386
|
case 1:
|
|
363
387
|
_a.CRYPTO_FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
|
|
364
388
|
return [3 /*break*/, 4];
|
|
@@ -390,7 +414,7 @@ var Curve = /** @class */ (function () {
|
|
|
390
414
|
case 0:
|
|
391
415
|
if (this.chainId === 1313161554)
|
|
392
416
|
return [2 /*return*/, []];
|
|
393
|
-
currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA)
|
|
417
|
+
currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
|
|
394
418
|
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
395
419
|
_a = lowerCasePoolDataAddresses;
|
|
396
420
|
return [4 /*yield*/, getFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
@@ -455,9 +479,11 @@ var Curve = /** @class */ (function () {
|
|
|
455
479
|
}
|
|
456
480
|
});
|
|
457
481
|
}); };
|
|
458
|
-
this.
|
|
482
|
+
this.getMainPoolList = function () { return Object.keys(_this.constants.POOLS_DATA); };
|
|
459
483
|
this.getFactoryPoolList = function () { return Object.keys(_this.constants.FACTORY_POOLS_DATA); };
|
|
484
|
+
this.getCrvusdFactoryPoolList = function () { return Object.keys(_this.constants.CRVUSD_FACTORY_POOLS_DATA); };
|
|
460
485
|
this.getCryptoFactoryPoolList = function () { return Object.keys(_this.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
486
|
+
this.getPoolList = function () { return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], _this.getMainPoolList(), true), _this.getFactoryPoolList(), true), _this.getCrvusdFactoryPoolList(), true), _this.getCryptoFactoryPoolList(), true); };
|
|
461
487
|
// @ts-ignore
|
|
462
488
|
this.provider = null;
|
|
463
489
|
// @ts-ignore
|
|
@@ -476,6 +502,7 @@ var Curve = /** @class */ (function () {
|
|
|
476
502
|
ALIASES: {},
|
|
477
503
|
POOLS_DATA: {},
|
|
478
504
|
FACTORY_POOLS_DATA: {},
|
|
505
|
+
CRVUSD_FACTORY_POOLS_DATA: {},
|
|
479
506
|
CRYPTO_FACTORY_POOLS_DATA: {},
|
|
480
507
|
LLAMMAS_DATA: {},
|
|
481
508
|
COINS: {},
|
|
@@ -511,6 +538,7 @@ var Curve = /** @class */ (function () {
|
|
|
511
538
|
ALIASES: {},
|
|
512
539
|
POOLS_DATA: {},
|
|
513
540
|
FACTORY_POOLS_DATA: {},
|
|
541
|
+
CRVUSD_FACTORY_POOLS_DATA: {},
|
|
514
542
|
CRYPTO_FACTORY_POOLS_DATA: {},
|
|
515
543
|
LLAMMAS_DATA: {},
|
|
516
544
|
COINS: {},
|
package/lib/external-api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import memoize from "memoizee";
|
|
2
2
|
import { IExtendedPoolDataFromApi, ISubgraphPoolData, IDict, INetworkName } from "./interfaces";
|
|
3
|
-
export declare const _getPoolsFromApi: ((network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>) & memoize.Memoized<(network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>>;
|
|
3
|
+
export declare const _getPoolsFromApi: ((network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crvusd" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>) & memoize.Memoized<(network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crvusd" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>>;
|
|
4
4
|
export declare const _getSubgraphData: ((network: INetworkName) => Promise<{
|
|
5
5
|
poolsData: ISubgraphPoolData[];
|
|
6
6
|
totalVolume: number;
|
package/lib/factory/constants.js
CHANGED
|
@@ -52,7 +52,8 @@ export var implementationABIDictEthereum = lowerCaseKeys({
|
|
|
52
52
|
"0x4A4d7868390EF5CaC51cDA262888f34bD3025C3F": Plain2OptimizedABI,
|
|
53
53
|
"0xc629a01eC23AB04E1050500A3717A2a5c0701497": Plain2BasicABI,
|
|
54
54
|
"0x94b4DFd9Ba5865Cc931195c99A2db42F3fc5d45B": Plain2ETHABI,
|
|
55
|
-
"
|
|
55
|
+
"0x847ee1227A9900B73aEeb3a47fAc92c52FD54ed9": Plain2ETHABI,
|
|
56
|
+
"0x67fe41A94e779CcFa22cff02cc2957DC9C0e4286": Plain2BasicABI,
|
|
56
57
|
"0x9B52F13DF69D79Ec5aAB6D1aCe3157d29B409cC3": Plain3BasicABI,
|
|
57
58
|
"0x50b085f2e5958C4A87baf93A8AB79F6bec068494": Plain3BalancesABI,
|
|
58
59
|
"0x8c1aB78601c259E1B43F19816923609dC7d7de9B": Plain3ETHABI,
|
package/lib/factory/deploy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
-
export declare const deployStablePlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
|
|
3
|
-
export declare const deployStablePlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
|
|
2
|
+
export declare const deployStablePlainPoolEstimateGas: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<number>;
|
|
3
|
+
export declare const deployStablePlainPool: (name: string, symbol: string, coins: string[], A: number | string, fee: number | string, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<ethers.ContractTransactionResponse>;
|
|
4
4
|
export declare const getDeployedStablePlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
5
5
|
export declare const deployStableMetaPoolEstimateGas: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<number>;
|
|
6
6
|
export declare const deployStableMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: number | string, fee: number | string, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
|
package/lib/factory/deploy.js
CHANGED
|
@@ -68,8 +68,14 @@ assetType, implementationIdx, estimateGas) { return __awaiter(void 0, void 0, vo
|
|
|
68
68
|
throw Error("fee must be <= 1%. Passed fee = ".concat(fee));
|
|
69
69
|
if (![0, 1, 2, 3].includes(assetType))
|
|
70
70
|
throw Error("Invalid assetType. Must be one of: 0 = USD, 1 = ETH, 2 = BTC, 3 = Other");
|
|
71
|
-
if (
|
|
72
|
-
|
|
71
|
+
if (curve.chainId !== 1 || coins.length > 2) {
|
|
72
|
+
if (![0, 1, 2, 3].includes(implementationIdx))
|
|
73
|
+
throw Error("Invalid implementationIdx. Must be one 0, 1, 2 or 3");
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (![0, 1, 2, 3, 4, 5].includes(implementationIdx))
|
|
77
|
+
throw Error("Invalid implementationIdx. Must be one 0, 1, 2, 3, 4 or 5");
|
|
78
|
+
}
|
|
73
79
|
_A = parseUnits(A, 0);
|
|
74
80
|
_fee = parseUnits(fee, 8);
|
|
75
81
|
_coins = coins.concat(Array(4 - coins.length).fill(curve.constants.ZERO_ADDRESS));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IDict, IPoolData, ICurve, IPoolDataFromApi } from "../interfaces";
|
|
2
2
|
export declare const lowerCasePoolDataAddresses: (poolsData: IPoolDataFromApi[]) => IPoolDataFromApi[];
|
|
3
|
-
export declare function getFactoryPoolsDataFromApi(this: ICurve,
|
|
3
|
+
export declare function getFactoryPoolsDataFromApi(this: ICurve, factoryType: "factory" | "factory-crvusd" | "factory-crypto"): Promise<IDict<IPoolData>>;
|
|
@@ -146,15 +146,15 @@ function setFactoryCoinsContracts(rawPoolList) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
export function getFactoryPoolsDataFromApi(
|
|
149
|
+
export function getFactoryPoolsDataFromApi(factoryType) {
|
|
150
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var network,
|
|
151
|
+
var network, isCrypto, rawPoolList, _a, mainAddresses, FACTORY_POOLS_DATA;
|
|
152
152
|
var _this = this;
|
|
153
153
|
return __generator(this, function (_b) {
|
|
154
154
|
switch (_b.label) {
|
|
155
155
|
case 0:
|
|
156
156
|
network = this.constants.NETWORK_NAME;
|
|
157
|
-
|
|
157
|
+
isCrypto = factoryType === "factory-crypto";
|
|
158
158
|
_a = lowerCasePoolDataAddresses;
|
|
159
159
|
return [4 /*yield*/, _getPoolsFromApi(network, factoryType)];
|
|
160
160
|
case 1:
|
|
@@ -251,6 +251,7 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
|
|
|
251
251
|
coinAddrDecimalsDict[addr] = decimals[i];
|
|
252
252
|
});
|
|
253
253
|
coinAddrNamesDict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
|
|
254
|
+
coinAddrDecimalsDict[this.constants.NATIVE_TOKEN.address] = 18;
|
|
254
255
|
return [2 /*return*/, [tokenSymbols, tokenNames, coinAddrNamesDict, coinAddrDecimalsDict]];
|
|
255
256
|
}
|
|
256
257
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const curve: {
|
|
|
25
25
|
signerAddress: string;
|
|
26
26
|
setCustomFeeData: typeof setCustomFeeData;
|
|
27
27
|
getPoolList: () => string[];
|
|
28
|
+
getMainPoolList: () => string[];
|
|
28
29
|
getUserPoolListByLiquidity: (address?: string) => Promise<string[]>;
|
|
29
30
|
getUserPoolListByClaimable: (address?: string) => Promise<string[]>;
|
|
30
31
|
getUserPoolList: (address?: string, useApi?: boolean) => Promise<string[]>;
|
|
@@ -57,7 +58,7 @@ declare const curve: {
|
|
|
57
58
|
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
58
59
|
fetchNewPools: () => Promise<string[]>;
|
|
59
60
|
getPoolList: () => string[];
|
|
60
|
-
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
|
|
61
|
+
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<ethers.ContractTransactionResponse>;
|
|
61
62
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
|
|
62
63
|
deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
63
64
|
getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
@@ -65,11 +66,15 @@ declare const curve: {
|
|
|
65
66
|
getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
66
67
|
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
67
68
|
estimateGas: {
|
|
68
|
-
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
|
|
69
|
+
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3 | 4 | 5) => Promise<number>;
|
|
69
70
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<number>;
|
|
70
71
|
deployGauge: (poolAddress: string) => Promise<number>;
|
|
71
72
|
};
|
|
72
73
|
};
|
|
74
|
+
crvUSDFactory: {
|
|
75
|
+
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
76
|
+
getPoolList: () => string[];
|
|
77
|
+
};
|
|
73
78
|
cryptoFactory: {
|
|
74
79
|
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
75
80
|
fetchNewPools: () => Promise<string[]>;
|
package/lib/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var curve = {
|
|
|
67
67
|
signerAddress: '',
|
|
68
68
|
setCustomFeeData: setCustomFeeData,
|
|
69
69
|
getPoolList: _curve.getPoolList,
|
|
70
|
+
getMainPoolList: _curve.getMainPoolList,
|
|
70
71
|
getUserPoolListByLiquidity: getUserPoolListByLiquidity,
|
|
71
72
|
getUserPoolListByClaimable: getUserPoolListByClaimable,
|
|
72
73
|
getUserPoolList: getUserPoolList,
|
|
@@ -103,6 +104,10 @@ var curve = {
|
|
|
103
104
|
}); }); },
|
|
104
105
|
},
|
|
105
106
|
},
|
|
107
|
+
crvUSDFactory: {
|
|
108
|
+
fetchPools: _curve.fetchCrvusdFactoryPools,
|
|
109
|
+
getPoolList: _curve.getCrvusdFactoryPoolList,
|
|
110
|
+
},
|
|
106
111
|
cryptoFactory: {
|
|
107
112
|
fetchPools: _curve.fetchCryptoFactoryPools,
|
|
108
113
|
fetchNewPools: _curve.fetchNewCryptoFactoryPools,
|
|
@@ -1079,7 +1079,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
});
|
|
1081
1081
|
}); };
|
|
1082
|
-
var poolData = __assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA), curve.constants.LLAMMAS_DATA)[id];
|
|
1082
|
+
var poolData = __assign(__assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRVUSD_FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA), curve.constants.LLAMMAS_DATA)[id];
|
|
1083
1083
|
this.id = id;
|
|
1084
1084
|
this.name = poolData.name;
|
|
1085
1085
|
this.fullName = poolData.full_name;
|
package/lib/pools/utils.js
CHANGED
|
@@ -45,15 +45,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
};
|
|
57
48
|
import { getPool } from "./poolConstructor.js";
|
|
58
49
|
import { curve } from "../curve.js";
|
|
59
50
|
import { _getRewardsFromApi, _getUsdRate, _setContracts, toBN } from "../utils.js";
|
|
@@ -109,7 +100,7 @@ export var getUserPoolListByLiquidity = function (address) {
|
|
|
109
100
|
return __generator(this, function (_a) {
|
|
110
101
|
switch (_a.label) {
|
|
111
102
|
case 0:
|
|
112
|
-
pools =
|
|
103
|
+
pools = curve.getPoolList();
|
|
113
104
|
return [4 /*yield*/, _getUserLpBalances(pools, address, false)];
|
|
114
105
|
case 1:
|
|
115
106
|
_lpBalances = _a.sent();
|
|
@@ -405,7 +396,7 @@ export var getUserPoolListByClaimable = function (address) {
|
|
|
405
396
|
return __generator(this, function (_a) {
|
|
406
397
|
switch (_a.label) {
|
|
407
398
|
case 0:
|
|
408
|
-
pools =
|
|
399
|
+
pools = curve.getPoolList();
|
|
409
400
|
return [4 /*yield*/, _getUserClaimable(pools, address, false)];
|
|
410
401
|
case 1:
|
|
411
402
|
_claimable = _a.sent();
|
|
@@ -464,7 +455,7 @@ export var getUserPoolList = function (address, useApi) {
|
|
|
464
455
|
return __generator(this, function (_b) {
|
|
465
456
|
switch (_b.label) {
|
|
466
457
|
case 0:
|
|
467
|
-
pools =
|
|
458
|
+
pools = curve.getPoolList();
|
|
468
459
|
return [4 /*yield*/, Promise.all([
|
|
469
460
|
_getUserLpBalances(pools, address, false),
|
|
470
461
|
useApi ? _getUserClaimableUseApi(pools, address, false) : _getUserClaimable(pools, address, false),
|
package/lib/router.js
CHANGED
|
@@ -136,7 +136,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
136
136
|
case 0:
|
|
137
137
|
inputCoinAddress = inputCoinAddress.toLowerCase();
|
|
138
138
|
outputCoinAddress = outputCoinAddress.toLowerCase();
|
|
139
|
-
ALL_POOLS = Object.entries(__assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA), curve.constants.LLAMMAS_DATA));
|
|
139
|
+
ALL_POOLS = Object.entries(__assign(__assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRVUSD_FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA), curve.constants.LLAMMAS_DATA));
|
|
140
140
|
return [4 /*yield*/, _getAmplificationCoefficientsFromApi()];
|
|
141
141
|
case 1:
|
|
142
142
|
amplificationCoefficientDict = _s.sent();
|
|
@@ -174,7 +174,7 @@ var _findAllRoutes = function (inputCoinAddress, outputCoinAddress) { return __a
|
|
|
174
174
|
case 0:
|
|
175
175
|
wrapped_coin_addresses = poolData.wrapped_coin_addresses.map(function (a) { return a.toLowerCase(); });
|
|
176
176
|
underlying_coin_addresses = poolData.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); });
|
|
177
|
-
base_pool = poolData.is_meta ? curve.constants.POOLS_DATA[poolData.base_pool] : null;
|
|
177
|
+
base_pool = poolData.is_meta ? __assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA)[poolData.base_pool] : null;
|
|
178
178
|
meta_coin_addresses = base_pool ? base_pool.underlying_coin_addresses.map(function (a) { return a.toLowerCase(); }) : [];
|
|
179
179
|
token_address = poolData.token_address.toLowerCase();
|
|
180
180
|
is_aave_like_lending = poolData.is_lending && wrapped_coin_addresses.length === 3 && !poolData.deposit_address;
|
package/lib/utils.js
CHANGED
|
@@ -391,14 +391,14 @@ export var ensureAllowance = function (coins, amounts, spender, isMax) {
|
|
|
391
391
|
});
|
|
392
392
|
};
|
|
393
393
|
export var getPoolNameBySwapAddress = function (swapAddress) {
|
|
394
|
-
var poolsData = __assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
394
|
+
var poolsData = __assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRVUSD_FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
395
395
|
return Object.entries(poolsData).filter(function (_a) {
|
|
396
396
|
var _ = _a[0], poolData = _a[1];
|
|
397
397
|
return poolData.swap_address.toLowerCase() === swapAddress.toLowerCase();
|
|
398
398
|
})[0][0];
|
|
399
399
|
};
|
|
400
400
|
var _getTokenAddressBySwapAddress = function (swapAddress) {
|
|
401
|
-
var poolsData = __assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
401
|
+
var poolsData = __assign(__assign(__assign(__assign({}, curve.constants.POOLS_DATA), curve.constants.FACTORY_POOLS_DATA), curve.constants.CRVUSD_FACTORY_POOLS_DATA), curve.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
402
402
|
var res = Object.entries(poolsData).filter(function (_a) {
|
|
403
403
|
var _ = _a[0], poolData = _a[1];
|
|
404
404
|
return poolData.swap_address.toLowerCase() === swapAddress.toLowerCase();
|