@curvefi/api 2.45.0 → 2.46.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/lib/constants/aliases.d.ts +1 -0
- package/lib/constants/aliases.js +21 -1
- package/lib/constants/coins/base.d.ts +6 -0
- package/lib/constants/coins/base.js +11 -0
- package/lib/constants/pools/base.d.ts +2 -0
- package/lib/constants/pools/base.js +2 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +2 -1
- package/lib/curve.js +29 -12
- package/lib/external-api.js +3 -3
- package/lib/factory/constants-crypto.d.ts +5 -0
- package/lib/factory/constants-crypto.js +6 -0
- package/lib/factory/constants.d.ts +6 -0
- package/lib/factory/constants.js +23 -2
- package/lib/interfaces.d.ts +2 -2
- package/lib/pools/PoolTemplate.js +16 -12
- package/lib/utils.js +4 -2
- package/package.json +2 -2
|
@@ -10,3 +10,4 @@ export declare const ALIASES_AURORA: import("../interfaces.js").IDict<string>;
|
|
|
10
10
|
export declare const ALIASES_KAVA: import("../interfaces.js").IDict<string>;
|
|
11
11
|
export declare const ALIASES_CELO: import("../interfaces.js").IDict<string>;
|
|
12
12
|
export declare const ALIASES_ZKSYNC: import("../interfaces.js").IDict<string>;
|
|
13
|
+
export declare const ALIASES_BASE: import("../interfaces.js").IDict<string>;
|
package/lib/constants/aliases.js
CHANGED
|
@@ -217,7 +217,8 @@ export var ALIASES_ZKSYNC = lowerCaseValues({
|
|
|
217
217
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
218
218
|
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
219
219
|
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
220
|
-
"stable_calc": "
|
|
220
|
+
"stable_calc": "0x0000000000000000000000000000000000000000",
|
|
221
|
+
"crypto_calc": '0x0000000000000000000000000000000000000000',
|
|
221
222
|
"factory": '0xAF5261eD780fd5b80CF6E206b6BF90CbB97F511B',
|
|
222
223
|
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
223
224
|
"eywa_factory": '0x37F22A0B028f2152e6CAcef210e0C4d3b875f367',
|
|
@@ -226,3 +227,22 @@ export var ALIASES_ZKSYNC = lowerCaseValues({
|
|
|
226
227
|
"registry_exchange": "0x0000000000000000000000000000000000000000",
|
|
227
228
|
"factory_admin": "0x0000000000000000000000000000000000000000",
|
|
228
229
|
});
|
|
230
|
+
export var ALIASES_BASE = lowerCaseValues({
|
|
231
|
+
"crv": "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
|
|
232
|
+
"minter": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
|
|
233
|
+
"voting_escrow": "0x0000000000000000000000000000000000000000",
|
|
234
|
+
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
|
|
235
|
+
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
236
|
+
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
237
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
238
|
+
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
239
|
+
"stable_calc": "0x0000000000000000000000000000000000000000",
|
|
240
|
+
"crypto_calc": '0x0000000000000000000000000000000000000000',
|
|
241
|
+
"factory": '0x3093f9B57A428F3EB6285a589cb35bEA6e78c336',
|
|
242
|
+
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d',
|
|
243
|
+
"eywa_factory": '0x37F22A0B028f2152e6CAcef210e0C4d3b875f367',
|
|
244
|
+
"crypto_factory": '0x5EF72230578b3e399E6C6F4F6360edF95e83BBfd',
|
|
245
|
+
"tricrypto_factory": '0xA5961898870943c68037F6848d2D866Ed2016bcB',
|
|
246
|
+
"registry_exchange": "0x0000000000000000000000000000000000000000",
|
|
247
|
+
"factory_admin": "0x0000000000000000000000000000000000000000",
|
|
248
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IDict } from "../../interfaces.js";
|
|
2
|
+
export declare const COINS_BASE: IDict<string>;
|
|
3
|
+
export declare const cTokensBase: never[];
|
|
4
|
+
export declare const yTokensBase: never[];
|
|
5
|
+
export declare const ycTokensBase: never[];
|
|
6
|
+
export declare const aTokensBase: never[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lowerCaseValues } from "../utils.js";
|
|
2
|
+
export var COINS_BASE = lowerCaseValues({
|
|
3
|
+
crv: '0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415',
|
|
4
|
+
// --- ETH ---
|
|
5
|
+
eth: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
6
|
+
weth: '0x4200000000000000000000000000000000000006',
|
|
7
|
+
});
|
|
8
|
+
export var cTokensBase = []; //.map((a) => a.toLowerCase());
|
|
9
|
+
export var yTokensBase = []; //.map((a) => a.toLowerCase());
|
|
10
|
+
export var ycTokensBase = []; //.map((a) => a.toLowerCase());
|
|
11
|
+
export var aTokensBase = []; //.map((a) => a.toLowerCase());
|
|
@@ -11,4 +11,5 @@ import { POOLS_DATA_AURORA } from "./aurora.js";
|
|
|
11
11
|
import { POOLS_DATA_KAVA } from "./kava.js";
|
|
12
12
|
import { POOLS_DATA_CELO } from "./celo.js";
|
|
13
13
|
import { POOLS_DATA_ZKSYNC } from "./zksync.js";
|
|
14
|
-
|
|
14
|
+
import { POOLS_DATA_BASE } from "./base.js";
|
|
15
|
+
export { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, };
|
|
@@ -11,4 +11,5 @@ import { POOLS_DATA_AURORA } from "./aurora.js";
|
|
|
11
11
|
import { POOLS_DATA_KAVA } from "./kava.js";
|
|
12
12
|
import { POOLS_DATA_CELO } from "./celo.js";
|
|
13
13
|
import { POOLS_DATA_ZKSYNC } from "./zksync.js";
|
|
14
|
-
|
|
14
|
+
import { POOLS_DATA_BASE } from "./base.js";
|
|
15
|
+
export { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, };
|
package/lib/curve.js
CHANGED
|
@@ -84,8 +84,8 @@ import factoryEywaABI from './constants/abis/factory-eywa.json' assert { type: '
|
|
|
84
84
|
import factoryAdminABI from './constants/abis/factory-admin.json' assert { type: 'json' };
|
|
85
85
|
import cryptoFactoryABI from './constants/abis/factory-crypto.json' assert { type: 'json' };
|
|
86
86
|
import tricryptoFactoryABI from './constants/abis/factory-tricrypto.json' assert { type: 'json' };
|
|
87
|
-
import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, } from './constants/pools/index.js';
|
|
88
|
-
import { ALIASES_ETHEREUM, ALIASES_OPTIMISM, ALIASES_POLYGON, ALIASES_FANTOM, ALIASES_AVALANCHE, ALIASES_ARBITRUM, ALIASES_XDAI, ALIASES_MOONBEAM, ALIASES_AURORA, ALIASES_KAVA, ALIASES_CELO, ALIASES_ZKSYNC, } from "./constants/aliases.js";
|
|
87
|
+
import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, } from './constants/pools/index.js';
|
|
88
|
+
import { ALIASES_ETHEREUM, ALIASES_OPTIMISM, ALIASES_POLYGON, ALIASES_FANTOM, ALIASES_AVALANCHE, ALIASES_ARBITRUM, ALIASES_XDAI, ALIASES_MOONBEAM, ALIASES_AURORA, ALIASES_KAVA, ALIASES_CELO, ALIASES_ZKSYNC, ALIASES_BASE, } from "./constants/aliases.js";
|
|
89
89
|
import { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum } from "./constants/coins/ethereum.js";
|
|
90
90
|
import { COINS_OPTIMISM, cTokensOptimism, yTokensOptimism, ycTokensOptimism, aTokensOptimism } from "./constants/coins/optimism.js";
|
|
91
91
|
import { COINS_POLYGON, cTokensPolygon, yTokensPolygon, ycTokensPolygon, aTokensPolygon } from "./constants/coins/polygon.js";
|
|
@@ -98,6 +98,7 @@ import { COINS_AURORA, cTokensAurora, yTokensAurora, ycTokensAurora, aTokensAuro
|
|
|
98
98
|
import { COINS_KAVA, cTokensKava, yTokensKava, ycTokensKava, aTokensKava } from "./constants/coins/kava.js";
|
|
99
99
|
import { COINS_CELO, cTokensCelo, yTokensCelo, ycTokensCelo, aTokensCelo } from "./constants/coins/celo.js";
|
|
100
100
|
import { COINS_ZKSYNC, cTokensZkSync, yTokensZkSync, ycTokensZkSync, aTokensZkSync } from "./constants/coins/zksync.js";
|
|
101
|
+
import { COINS_BASE, cTokensBase, yTokensBase, ycTokensBase, aTokensBase } from "./constants/coins/base.js";
|
|
101
102
|
import { lowerCasePoolDataAddresses, extractDecimals, extractGauges } from "./constants/utils.js";
|
|
102
103
|
import { _getAllGauges, _getHiddenPools } from "./external-api.js";
|
|
103
104
|
var _killGauges = function (poolsData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -170,6 +171,12 @@ export var NATIVE_TOKENS = {
|
|
|
170
171
|
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
171
172
|
wrappedAddress: '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'.toLowerCase(),
|
|
172
173
|
},
|
|
174
|
+
8453: {
|
|
175
|
+
symbol: 'ETH',
|
|
176
|
+
wrappedSymbol: 'WETH',
|
|
177
|
+
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
178
|
+
wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
|
|
179
|
+
},
|
|
173
180
|
42161: {
|
|
174
181
|
symbol: 'ETH',
|
|
175
182
|
wrappedSymbol: 'WETH',
|
|
@@ -277,6 +284,16 @@ export var NETWORK_CONSTANTS = {
|
|
|
277
284
|
ycTokens: ycTokensKava,
|
|
278
285
|
aTokens: aTokensKava,
|
|
279
286
|
},
|
|
287
|
+
8453: {
|
|
288
|
+
NAME: 'base',
|
|
289
|
+
ALIASES: ALIASES_BASE,
|
|
290
|
+
POOLS_DATA: POOLS_DATA_BASE,
|
|
291
|
+
COINS: COINS_BASE,
|
|
292
|
+
cTokens: cTokensBase,
|
|
293
|
+
yTokens: yTokensBase,
|
|
294
|
+
ycTokens: ycTokensBase,
|
|
295
|
+
aTokens: aTokensBase,
|
|
296
|
+
},
|
|
280
297
|
42161: {
|
|
281
298
|
NAME: 'arbitrum',
|
|
282
299
|
ALIASES: ALIASES_ARBITRUM,
|
|
@@ -444,7 +461,7 @@ var Curve = /** @class */ (function () {
|
|
|
444
461
|
return __generator(this, function (_h) {
|
|
445
462
|
switch (_h.label) {
|
|
446
463
|
case 0:
|
|
447
|
-
if (![1, 137, 250].includes(this.chainId))
|
|
464
|
+
if (![1, 137, 250, 8453].includes(this.chainId))
|
|
448
465
|
return [2 /*return*/];
|
|
449
466
|
if (!useApi) return [3 /*break*/, 2];
|
|
450
467
|
_a = this.constants;
|
|
@@ -486,7 +503,7 @@ var Curve = /** @class */ (function () {
|
|
|
486
503
|
return __generator(this, function (_k) {
|
|
487
504
|
switch (_k.label) {
|
|
488
505
|
case 0:
|
|
489
|
-
if (![1, 42161].includes(this.chainId))
|
|
506
|
+
if (![1, 8453, 42161].includes(this.chainId))
|
|
490
507
|
return [2 /*return*/]; // Ethereum, Arbitrum
|
|
491
508
|
if (!useApi) return [3 /*break*/, 2];
|
|
492
509
|
_a = this.constants;
|
|
@@ -540,7 +557,7 @@ var Curve = /** @class */ (function () {
|
|
|
540
557
|
if (this.chainId === 1313161554)
|
|
541
558
|
return [2 /*return*/, []];
|
|
542
559
|
currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
|
|
543
|
-
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
560
|
+
lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
544
561
|
_a = lowerCasePoolDataAddresses;
|
|
545
562
|
return [4 /*yield*/, getFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
546
563
|
case 1:
|
|
@@ -556,10 +573,10 @@ var Curve = /** @class */ (function () {
|
|
|
556
573
|
return __generator(this, function (_b) {
|
|
557
574
|
switch (_b.label) {
|
|
558
575
|
case 0:
|
|
559
|
-
if (![1, 137, 250].includes(this.chainId))
|
|
576
|
+
if (![1, 137, 250, 8453].includes(this.chainId))
|
|
560
577
|
return [2 /*return*/, []];
|
|
561
578
|
currentPoolIds = Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
|
|
562
|
-
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
579
|
+
lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
563
580
|
_a = lowerCasePoolDataAddresses;
|
|
564
581
|
return [4 /*yield*/, getCryptoFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
565
582
|
case 1:
|
|
@@ -575,10 +592,10 @@ var Curve = /** @class */ (function () {
|
|
|
575
592
|
return __generator(this, function (_b) {
|
|
576
593
|
switch (_b.label) {
|
|
577
594
|
case 0:
|
|
578
|
-
if (![1, 42161].includes(this.chainId))
|
|
595
|
+
if (![1, 8453, 42161].includes(this.chainId))
|
|
579
596
|
return [2 /*return*/, []]; // Ethereum, Arbitrum
|
|
580
597
|
currentPoolIds = Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
|
|
581
|
-
lastPoolIdx = Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
598
|
+
lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
|
|
582
599
|
_a = lowerCasePoolDataAddresses;
|
|
583
600
|
return [4 /*yield*/, getTricryptoFactoryPoolData.call(this, lastPoolIdx + 1)];
|
|
584
601
|
case 1:
|
|
@@ -611,7 +628,7 @@ var Curve = /** @class */ (function () {
|
|
|
611
628
|
return __generator(this, function (_b) {
|
|
612
629
|
switch (_b.label) {
|
|
613
630
|
case 0:
|
|
614
|
-
if (![1, 137, 250].includes(this.chainId))
|
|
631
|
+
if (![1, 137, 250, 8453].includes(this.chainId))
|
|
615
632
|
return [2 /*return*/, ''];
|
|
616
633
|
_a = lowerCasePoolDataAddresses;
|
|
617
634
|
return [4 /*yield*/, getCryptoFactoryPoolData.call(this, 0, poolAddress)];
|
|
@@ -628,7 +645,7 @@ var Curve = /** @class */ (function () {
|
|
|
628
645
|
return __generator(this, function (_b) {
|
|
629
646
|
switch (_b.label) {
|
|
630
647
|
case 0:
|
|
631
|
-
if (![1, 42161].includes(this.chainId))
|
|
648
|
+
if (![1, 8453, 42161].includes(this.chainId))
|
|
632
649
|
return [2 /*return*/, '']; // Ethereum, Arbitrum
|
|
633
650
|
_a = lowerCasePoolDataAddresses;
|
|
634
651
|
return [4 /*yield*/, getTricryptoFactoryPoolData.call(this, 0, poolAddress)];
|
|
@@ -879,7 +896,7 @@ var Curve = /** @class */ (function () {
|
|
|
879
896
|
this.setContract(this.constants.ALIASES.voting_escrow, votingEscrowABI);
|
|
880
897
|
this.setContract(this.constants.ALIASES.fee_distributor, feeDistributorABI);
|
|
881
898
|
this.setContract(this.constants.ALIASES.address_provider, addressProviderABI);
|
|
882
|
-
if (!(this.chainId !== 324)) return [3 /*break*/, 20];
|
|
899
|
+
if (!(this.chainId !== 324 && this.chainId !== 8453)) return [3 /*break*/, 20];
|
|
883
900
|
addressProviderContract = this.contracts[this.constants.ALIASES.address_provider].contract;
|
|
884
901
|
_o = this.constants.ALIASES;
|
|
885
902
|
return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
|
package/lib/external-api.js
CHANGED
|
@@ -97,8 +97,8 @@ export var _getLegacyAPYsAndVolumes = memoize(function (network) { return __awai
|
|
|
97
97
|
return __generator(this, function (_a) {
|
|
98
98
|
switch (_a.label) {
|
|
99
99
|
case 0:
|
|
100
|
-
if (
|
|
101
|
-
return [2 /*return*/, {}]; // Exclude Kava, Celo and
|
|
100
|
+
if (["kava", "celo", "zksync", "base"].includes(network))
|
|
101
|
+
return [2 /*return*/, {}]; // Exclude Kava, Celo, ZkSync and Base
|
|
102
102
|
url = "https://api.curve.fi/api/getMainPoolsAPYs/" + network;
|
|
103
103
|
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
104
104
|
case 1:
|
|
@@ -117,7 +117,7 @@ export var _getLegacyAPYsAndVolumes = memoize(function (network) { return __awai
|
|
|
117
117
|
promise: true,
|
|
118
118
|
maxAge: 5 * 60 * 1000, // 5m
|
|
119
119
|
});
|
|
120
|
-
// ZkSync, Moonbeam, Kava and Celo only
|
|
120
|
+
// Base, ZkSync, Moonbeam, Kava and Celo only
|
|
121
121
|
export var _getFactoryAPYsAndVolumes = memoize(function (network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
122
122
|
var url, response;
|
|
123
123
|
var _a;
|
|
@@ -10,6 +10,7 @@ export declare const lpTokenBasePoolIdDictMoonbeam: IDict<string>;
|
|
|
10
10
|
export declare const lpTokenBasePoolIdDictKava: IDict<string>;
|
|
11
11
|
export declare const lpTokenBasePoolIdDictCelo: IDict<string>;
|
|
12
12
|
export declare const lpTokenBasePoolIdDictZkSync: IDict<string>;
|
|
13
|
+
export declare const lpTokenBasePoolIdDictBase: IDict<string>;
|
|
13
14
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
14
15
|
address: string;
|
|
15
16
|
ABI: any;
|
|
@@ -54,6 +55,10 @@ export declare const basePoolIdZapDictZkSync: IDict<{
|
|
|
54
55
|
address: string;
|
|
55
56
|
ABI: any;
|
|
56
57
|
}>;
|
|
58
|
+
export declare const basePoolIdZapDictBase: IDict<{
|
|
59
|
+
address: string;
|
|
60
|
+
ABI: any;
|
|
61
|
+
}>;
|
|
57
62
|
export declare const CRYPTO_FACTORY_CONSTANTS: {
|
|
58
63
|
[index: number]: {
|
|
59
64
|
lpTokenBasePoolIdDict: IDict<string>;
|
|
@@ -19,6 +19,7 @@ export var lpTokenBasePoolIdDictMoonbeam = lowerCaseKeys({});
|
|
|
19
19
|
export var lpTokenBasePoolIdDictKava = lowerCaseKeys({});
|
|
20
20
|
export var lpTokenBasePoolIdDictCelo = lowerCaseKeys({});
|
|
21
21
|
export var lpTokenBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
22
|
+
export var lpTokenBasePoolIdDictBase = lowerCaseKeys({});
|
|
22
23
|
export var basePoolIdZapDictEthereum = {
|
|
23
24
|
'3pool': {
|
|
24
25
|
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
|
|
@@ -44,6 +45,7 @@ export var basePoolIdZapDictMoonbeam = {};
|
|
|
44
45
|
export var basePoolIdZapDictKava = {};
|
|
45
46
|
export var basePoolIdZapDictCelo = {};
|
|
46
47
|
export var basePoolIdZapDictZkSync = {};
|
|
48
|
+
export var basePoolIdZapDictBase = {};
|
|
47
49
|
export var CRYPTO_FACTORY_CONSTANTS = {
|
|
48
50
|
1: {
|
|
49
51
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictEthereum,
|
|
@@ -77,6 +79,10 @@ export var CRYPTO_FACTORY_CONSTANTS = {
|
|
|
77
79
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictKava,
|
|
78
80
|
basePoolIdZapDict: basePoolIdZapDictKava,
|
|
79
81
|
},
|
|
82
|
+
8453: {
|
|
83
|
+
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictBase,
|
|
84
|
+
basePoolIdZapDict: basePoolIdZapDictBase,
|
|
85
|
+
},
|
|
80
86
|
42220: {
|
|
81
87
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictCelo,
|
|
82
88
|
basePoolIdZapDict: basePoolIdZapDictCelo,
|
|
@@ -10,6 +10,7 @@ export declare const implementationABIDictMoonbeam: IDict<any>;
|
|
|
10
10
|
export declare const implementationABIDictKava: IDict<any>;
|
|
11
11
|
export declare const implementationABIDictCelo: IDict<any>;
|
|
12
12
|
export declare const implementationABIDictZkSync: IDict<any>;
|
|
13
|
+
export declare const implementationABIDictBase: IDict<any>;
|
|
13
14
|
export declare const implementationBasePoolIdDictEthereum: IDict<string>;
|
|
14
15
|
export declare const implementationBasePoolIdDictPolygon: IDict<string>;
|
|
15
16
|
export declare const implementationBasePoolIdDictFantom: IDict<string>;
|
|
@@ -21,6 +22,7 @@ export declare const implementationBasePoolIdDictMoonbeam: IDict<string>;
|
|
|
21
22
|
export declare const implementationBasePoolIdDictKava: IDict<string>;
|
|
22
23
|
export declare const implementationBasePoolIdDictCelo: IDict<string>;
|
|
23
24
|
export declare const implementationBasePoolIdDictZkSync: IDict<string>;
|
|
25
|
+
export declare const implementationBasePoolIdDictBase: IDict<string>;
|
|
24
26
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
25
27
|
address: string;
|
|
26
28
|
ABI: any;
|
|
@@ -65,6 +67,10 @@ export declare const basePoolIdZapDictZkSync: IDict<{
|
|
|
65
67
|
address: string;
|
|
66
68
|
ABI: any;
|
|
67
69
|
}>;
|
|
70
|
+
export declare const basePoolIdZapDictBase: IDict<{
|
|
71
|
+
address: string;
|
|
72
|
+
ABI: any;
|
|
73
|
+
}>;
|
|
68
74
|
export declare const FACTORY_CONSTANTS: {
|
|
69
75
|
[index: number]: {
|
|
70
76
|
implementationABIDict: IDict<any>;
|
package/lib/factory/constants.js
CHANGED
|
@@ -229,7 +229,7 @@ export var implementationABIDictCelo = lowerCaseKeys({
|
|
|
229
229
|
"0x0F5390AB4C5456a769056C96E4D7C71770b52319": Plain4ETHABI,
|
|
230
230
|
"0xA73b02a97B45604cd9f0BBAA153eCfe01f409350": Plain4OptimizedABI,
|
|
231
231
|
});
|
|
232
|
-
export var implementationABIDictZkSync = {
|
|
232
|
+
export var implementationABIDictZkSync = lowerCaseKeys({
|
|
233
233
|
"0x7c2a205C52361410233540008f7095dEF5915843": Plain2BasicABI,
|
|
234
234
|
"0xEF04fC6b95b1658AfdFd527aF9b947cd7BD46bde": Plain2BalancesABI,
|
|
235
235
|
"0x4887ef1a68f30364a25a8b0bAA13EeeA7eeBE574": Plain2ETHABI,
|
|
@@ -242,7 +242,21 @@ export var implementationABIDictZkSync = {
|
|
|
242
242
|
"0x3D21E268d6A526948e978ad1595052c949927e54": Plain4BalancesABI,
|
|
243
243
|
"0xD46aed59fBd5eB6c134b1AFb364240bb62dA0451": Plain4ETHABI,
|
|
244
244
|
"0xE80AeF1a4782eA7b7f9Ad9F0c2ed9343861934e3": Plain4OptimizedABI,
|
|
245
|
-
};
|
|
245
|
+
});
|
|
246
|
+
export var implementationABIDictBase = lowerCaseKeys({
|
|
247
|
+
"0xD166EEdf272B860E991d331B71041799379185D5": Plain2BasicABI,
|
|
248
|
+
"0x5C627d6925e448Ae418BC8a45d56B31fe5009Bea": Plain2BalancesABI,
|
|
249
|
+
"0x22D710931F01c1681Ca1570Ff016eD42EB7b7c2a": Plain2ETHABI,
|
|
250
|
+
"0xA50d9a424A14aF0b9e7e9243dc1597d977f6cB09": Plain2OptimizedABI,
|
|
251
|
+
"0xeD49979026DC44DC7E83b1471794ec9b2a365Ea2": Plain3BasicABI,
|
|
252
|
+
"0x0Cc51c9786f3777a6d50961CEBb2BB6E69ec5e07": Plain3BalancesABI,
|
|
253
|
+
"0x0a31527a8dE2Ee97BBD8cCE14Db8E8826a0b6C4f": Plain3ETHABI,
|
|
254
|
+
"0x1086F023146f9026A9Bb22983CE866813C59518A": Plain3OptimizedABI,
|
|
255
|
+
"0x1621E58d36EB5Ef26F9768Ebe9DB77181b1f5a02": Plain4BasicABI,
|
|
256
|
+
"0x2FdDeDF2D842f23da2B81b9144e75cEcb691Bf19": Plain4BalancesABI,
|
|
257
|
+
"0x50E09Ee7080b32aef3e92346891dD2DD389B5fAf": Plain4ETHABI,
|
|
258
|
+
"0x44d9B3f4EE15AC81FEb918501fca0ddc9d83C976": Plain4OptimizedABI,
|
|
259
|
+
});
|
|
246
260
|
export var implementationBasePoolIdDictEthereum = lowerCaseKeys({
|
|
247
261
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
248
262
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -300,6 +314,7 @@ export var implementationBasePoolIdDictMoonbeam = lowerCaseKeys({});
|
|
|
300
314
|
export var implementationBasePoolIdDictKava = lowerCaseKeys({});
|
|
301
315
|
export var implementationBasePoolIdDictCelo = lowerCaseKeys({});
|
|
302
316
|
export var implementationBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
317
|
+
export var implementationBasePoolIdDictBase = lowerCaseKeys({});
|
|
303
318
|
export var basePoolIdZapDictEthereum = {
|
|
304
319
|
'3pool': {
|
|
305
320
|
address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
@@ -394,6 +409,7 @@ export var basePoolIdZapDictMoonbeam = {};
|
|
|
394
409
|
export var basePoolIdZapDictKava = {};
|
|
395
410
|
export var basePoolIdZapDictCelo = {};
|
|
396
411
|
export var basePoolIdZapDictZkSync = {};
|
|
412
|
+
export var basePoolIdZapDictBase = {};
|
|
397
413
|
export var FACTORY_CONSTANTS = {
|
|
398
414
|
1: {
|
|
399
415
|
implementationABIDict: implementationABIDictEthereum,
|
|
@@ -435,6 +451,11 @@ export var FACTORY_CONSTANTS = {
|
|
|
435
451
|
implementationBasePoolIdDict: implementationBasePoolIdDictKava,
|
|
436
452
|
basePoolIdZapDict: basePoolIdZapDictKava,
|
|
437
453
|
},
|
|
454
|
+
8453: {
|
|
455
|
+
implementationABIDict: implementationABIDictBase,
|
|
456
|
+
implementationBasePoolIdDict: implementationBasePoolIdDictBase,
|
|
457
|
+
basePoolIdZapDict: basePoolIdZapDictBase,
|
|
458
|
+
},
|
|
438
459
|
42220: {
|
|
439
460
|
implementationABIDict: implementationABIDictCelo,
|
|
440
461
|
implementationBasePoolIdDict: implementationBasePoolIdDictCelo,
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Contract as MulticallContract, Provider as MulticallProvider } from "et
|
|
|
3
3
|
export interface IDict<T> {
|
|
4
4
|
[index: string]: T;
|
|
5
5
|
}
|
|
6
|
-
export type INetworkName = "ethereum" | "optimism" | "xdai" | "polygon" | "fantom" | "zksync" | "moonbeam" | "kava" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
-
export type IChainId = 1 | 10 | 100 | 137 | 250 | 324 | 1284 | 2222 | 42161 | 42220 | 43114 | 1313161554;
|
|
6
|
+
export type INetworkName = "ethereum" | "optimism" | "xdai" | "polygon" | "fantom" | "zksync" | "moonbeam" | "kava" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
+
export type IChainId = 1 | 10 | 100 | 137 | 250 | 324 | 1284 | 2222 | 8453 | 42161 | 42220 | 43114 | 1313161554;
|
|
8
8
|
export type IFactoryPoolType = "factory" | "factory-crvusd" | "factory-eywa" | "factory-crypto" | "factory-tricrypto";
|
|
9
9
|
export type IPoolType = "main" | "crypto" | IFactoryPoolType;
|
|
10
10
|
export type REFERENCE_ASSET = 'USD' | 'EUR' | 'BTC' | 'ETH' | 'LINK' | 'CRYPTO' | 'OTHER';
|
|
@@ -225,7 +225,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
225
225
|
return __generator(this, function (_e) {
|
|
226
226
|
switch (_e.label) {
|
|
227
227
|
case 0:
|
|
228
|
-
if (![324, 1284, 2222, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 3];
|
|
228
|
+
if (![324, 1284, 2222, 8453, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 3];
|
|
229
229
|
return [4 /*yield*/, Promise.all([
|
|
230
230
|
_getLegacyAPYsAndVolumes(curve.constants.NETWORK_NAME),
|
|
231
231
|
_getFactoryAPYsAndVolumes(curve.constants.NETWORK_NAME),
|
|
@@ -260,7 +260,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
260
260
|
return __generator(this, function (_d) {
|
|
261
261
|
switch (_d.label) {
|
|
262
262
|
case 0:
|
|
263
|
-
if (![324, 1284, 2222, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 2];
|
|
263
|
+
if (![324, 1284, 2222, 8453, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 2];
|
|
264
264
|
return [4 /*yield*/, Promise.all([
|
|
265
265
|
_getLegacyAPYsAndVolumes(curve.constants.NETWORK_NAME),
|
|
266
266
|
_getFactoryAPYsAndVolumes(curve.constants.NETWORK_NAME),
|
|
@@ -439,7 +439,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
439
439
|
return __generator(this, function (_c) {
|
|
440
440
|
switch (_c.label) {
|
|
441
441
|
case 0:
|
|
442
|
-
if (!
|
|
442
|
+
if (!this.isCrypto) return [3 /*break*/, 6];
|
|
443
443
|
_c.label = 1;
|
|
444
444
|
case 1:
|
|
445
445
|
_c.trys.push([1, 3, , 6]);
|
|
@@ -466,22 +466,26 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
466
466
|
});
|
|
467
467
|
return [2 /*return*/, parseUnits(Math.sqrt(amounts.map(Number).reduce(function (a, b) { return a * b; })))];
|
|
468
468
|
case 6:
|
|
469
|
-
_c.trys.push([6,
|
|
469
|
+
_c.trys.push([6, 13, , 15]);
|
|
470
470
|
contract = curve.contracts[curve.constants.ALIASES.stable_calc].contract;
|
|
471
|
-
if (!
|
|
472
|
-
|
|
473
|
-
return [4 /*yield*/, contract.calc_token_amount_meta(this.address, this.lpToken, _amounts.concat(Array(5 - _amounts.length).fill(curve.parseUnits("0"))), _amounts.length, basePool.address, basePool.lpToken, isDeposit, useUnderlying)];
|
|
471
|
+
if (!(curve.constants.ALIASES.stable_calc === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 8];
|
|
472
|
+
return [4 /*yield*/, this._pureCalcLpTokenAmount(_amounts, isDeposit, useUnderlying)];
|
|
474
473
|
case 7: return [2 /*return*/, _c.sent()];
|
|
475
|
-
case 8:
|
|
474
|
+
case 8:
|
|
475
|
+
if (!this.isMeta) return [3 /*break*/, 10];
|
|
476
|
+
basePool = new PoolTemplate(this.basePool);
|
|
477
|
+
return [4 /*yield*/, contract.calc_token_amount_meta(this.address, this.lpToken, _amounts.concat(Array(10 - _amounts.length).fill(curve.parseUnits("0"))), _amounts.length, basePool.address, basePool.lpToken, isDeposit, useUnderlying)];
|
|
476
478
|
case 9: return [2 /*return*/, _c.sent()];
|
|
477
|
-
case 10: return [
|
|
478
|
-
case 11:
|
|
479
|
+
case 10: return [4 /*yield*/, contract.calc_token_amount(this.address, this.lpToken, _amounts.concat(Array(10 - _amounts.length).fill(curve.parseUnits("0"))), _amounts.length, isDeposit, useUnderlying && this.isLending)];
|
|
480
|
+
case 11: return [2 /*return*/, _c.sent()];
|
|
481
|
+
case 12: return [3 /*break*/, 15];
|
|
482
|
+
case 13:
|
|
479
483
|
e_3 = _c.sent();
|
|
480
484
|
if (!isDeposit)
|
|
481
485
|
throw e_3; // Seeding is only for deposit
|
|
482
486
|
lpContract = curve.contracts[this.lpToken].contract;
|
|
483
487
|
return [4 /*yield*/, lpContract.totalSupply(curve.constantOptions)];
|
|
484
|
-
case
|
|
488
|
+
case 14:
|
|
485
489
|
_lpTotalSupply = _c.sent();
|
|
486
490
|
if (_lpTotalSupply > curve.parseUnits("0"))
|
|
487
491
|
throw e_3; // Already seeded
|
|
@@ -504,7 +508,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
504
508
|
}
|
|
505
509
|
_amounts18Decimals = amounts_1.map(function (a) { return parseUnits(a); });
|
|
506
510
|
return [2 /*return*/, _amounts18Decimals.reduce(function (_a, _b) { return _a + _b; })];
|
|
507
|
-
case
|
|
511
|
+
case 15: return [2 /*return*/];
|
|
508
512
|
}
|
|
509
513
|
});
|
|
510
514
|
});
|
package/lib/utils.js
CHANGED
|
@@ -518,6 +518,7 @@ export var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, v
|
|
|
518
518
|
324: 'zksync',
|
|
519
519
|
1284: 'moonbeam',
|
|
520
520
|
2222: 'kava',
|
|
521
|
+
8453: 'base',
|
|
521
522
|
42220: 'celo',
|
|
522
523
|
43114: 'avalanche',
|
|
523
524
|
42161: 'arbitrum-one',
|
|
@@ -532,6 +533,7 @@ export var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, v
|
|
|
532
533
|
324: 'ethereum',
|
|
533
534
|
1284: 'moonbeam',
|
|
534
535
|
2222: 'kava',
|
|
536
|
+
8453: 'ethereum',
|
|
535
537
|
42220: 'celo',
|
|
536
538
|
43114: 'avalanche-2',
|
|
537
539
|
42161: 'ethereum',
|
|
@@ -636,10 +638,10 @@ export var getVolume = function (network) {
|
|
|
636
638
|
switch (_e.label) {
|
|
637
639
|
case 0:
|
|
638
640
|
network = _getNetworkName(network);
|
|
639
|
-
if (!["zksync", "moonbeam", "kava", "celo", "aurora"].includes(network)) return [3 /*break*/, 8];
|
|
641
|
+
if (!["zksync", "moonbeam", "kava", "base", "celo", "aurora"].includes(network)) return [3 /*break*/, 8];
|
|
640
642
|
chainId = _getChainId(network);
|
|
641
643
|
if (curve.chainId !== chainId)
|
|
642
|
-
throw Error("To get volume for ZkSync, Moonbeam, Kava, Celo or Aurora connect to the network first");
|
|
644
|
+
throw Error("To get volume for ZkSync, Moonbeam, Kava, Base, Celo or Aurora connect to the network first");
|
|
643
645
|
return [4 /*yield*/, Promise.all([
|
|
644
646
|
_getLegacyAPYsAndVolumes(network),
|
|
645
647
|
_getFactoryAPYsAndVolumes(network),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.0",
|
|
4
4
|
"description": "JavaScript library for curve.fi",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Macket",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"axios": "^0.21.1",
|
|
36
36
|
"bignumber.js": "^9.0.1",
|
|
37
|
-
"ethcall": "^6.0.
|
|
37
|
+
"ethcall": "^6.0.2",
|
|
38
38
|
"ethers": "^6.7.0",
|
|
39
39
|
"memoizee": "^0.4.15"
|
|
40
40
|
}
|