@curvefi/api 2.20.1 → 2.21.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 +14 -1
- package/lib/constants/coins/celo.d.ts +7 -0
- package/lib/constants/coins/celo.js +16 -0
- package/lib/constants/pools/celo.d.ts +4 -0
- package/lib/constants/pools/celo.js +5 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +3 -1
- package/lib/constants/utils.d.ts +1 -1
- package/lib/curve.js +17 -0
- package/lib/external-api.js +5 -5
- package/lib/factory/constants-crypto.d.ts +5 -0
- package/lib/factory/constants-crypto.js +7 -1
- package/lib/factory/constants.d.ts +6 -0
- package/lib/factory/constants.js +22 -1
- package/lib/factory/factory-crypto.js +1 -18
- package/lib/factory/factory.js +10 -34
- package/lib/index.d.ts +4 -0
- package/lib/index.js +1 -0
- package/lib/pools/PoolTemplate.js +4 -4
- package/lib/pools/utils.js +1 -1
- package/lib/utils.d.ts +4 -0
- package/lib/utils.js +40 -2
- package/package.json +2 -2
|
@@ -8,3 +8,4 @@ export declare const ALIASES_XDAI: import("../interfaces").IDict<string>;
|
|
|
8
8
|
export declare const ALIASES_MOONBEAM: import("../interfaces").IDict<string>;
|
|
9
9
|
export declare const ALIASES_AURORA: import("../interfaces").IDict<string>;
|
|
10
10
|
export declare const ALIASES_KAVA: import("../interfaces").IDict<string>;
|
|
11
|
+
export declare const ALIASES_CELO: import("../interfaces").IDict<string>;
|
package/lib/constants/aliases.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALIASES_KAVA = exports.ALIASES_AURORA = exports.ALIASES_MOONBEAM = exports.ALIASES_XDAI = exports.ALIASES_OPTIMISM = exports.ALIASES_ARBITRUM = exports.ALIASES_AVALANCHE = exports.ALIASES_FANTOM = exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
3
|
+
exports.ALIASES_CELO = exports.ALIASES_KAVA = exports.ALIASES_AURORA = exports.ALIASES_MOONBEAM = exports.ALIASES_XDAI = exports.ALIASES_OPTIMISM = exports.ALIASES_ARBITRUM = exports.ALIASES_AVALANCHE = exports.ALIASES_FANTOM = exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
exports.ALIASES_ETHEREUM = (0, utils_1.lowerCaseValues)({
|
|
6
6
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
@@ -132,3 +132,16 @@ exports.ALIASES_KAVA = (0, utils_1.lowerCaseValues)({
|
|
|
132
132
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
133
133
|
"registry_exchange": "",
|
|
134
134
|
});
|
|
135
|
+
exports.ALIASES_CELO = (0, utils_1.lowerCaseValues)({
|
|
136
|
+
"crv": "0x0a7432cF27F1aE3825c313F3C81e7D3efD7639aB",
|
|
137
|
+
"minter": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
|
|
138
|
+
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
139
|
+
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
|
|
140
|
+
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
141
|
+
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
142
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
143
|
+
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
144
|
+
"factory": '0x5277A0226d10392295E8D383E9724D6E416d6e6C',
|
|
145
|
+
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
146
|
+
"registry_exchange": "",
|
|
147
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aTokensCelo = exports.ycTokensCelo = exports.yTokensCelo = exports.cTokensCelo = exports.COINS_CELO = void 0;
|
|
4
|
+
var utils_1 = require("../utils");
|
|
5
|
+
exports.COINS_CELO = (0, utils_1.lowerCaseValues)({
|
|
6
|
+
'crv': '0x0a7432cF27F1aE3825c313F3C81e7D3efD7639aB',
|
|
7
|
+
// --- USD ---
|
|
8
|
+
'dai': '0x90Ca507a5D4458a4C6C6249d186b6dCb02a5BCCd',
|
|
9
|
+
'usdc': '0xef4229c8c3250C675F21BCefa42f58EfbfF6002a',
|
|
10
|
+
'usdt': '0x88eeC49252c8cbc039DCdB394c0c2BA2f1637EA0',
|
|
11
|
+
'3crv': '0x998395fEd908d33CF27115A1D9Ab6555def6cd45',
|
|
12
|
+
});
|
|
13
|
+
exports.cTokensCelo = []; //.map((a) => a.toLowerCase());
|
|
14
|
+
exports.yTokensCelo = []; //.map((a) => a.toLowerCase());
|
|
15
|
+
exports.ycTokensCelo = []; //.map((a) => a.toLowerCase());
|
|
16
|
+
exports.aTokensCelo = []; //.map((a) => a.toLowerCase());
|
|
@@ -8,4 +8,5 @@ import { POOLS_DATA_XDAI } from "./xdai";
|
|
|
8
8
|
import { POOLS_DATA_MOONBEAM } from "./moonbeam";
|
|
9
9
|
import { POOLS_DATA_AURORA } from "./aurora";
|
|
10
10
|
import { POOLS_DATA_KAVA } from "./kava";
|
|
11
|
-
|
|
11
|
+
import { POOLS_DATA_CELO } from "./celo";
|
|
12
|
+
export { POOLS_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, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POOLS_DATA_KAVA = exports.POOLS_DATA_AURORA = exports.POOLS_DATA_MOONBEAM = exports.POOLS_DATA_XDAI = exports.POOLS_DATA_OPTIMISM = exports.POOLS_DATA_ARBITRUM = exports.POOLS_DATA_AVALANCHE = exports.POOLS_DATA_FANTOM = exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
3
|
+
exports.POOLS_DATA_CELO = exports.POOLS_DATA_KAVA = exports.POOLS_DATA_AURORA = exports.POOLS_DATA_MOONBEAM = exports.POOLS_DATA_XDAI = exports.POOLS_DATA_OPTIMISM = exports.POOLS_DATA_ARBITRUM = exports.POOLS_DATA_AVALANCHE = exports.POOLS_DATA_FANTOM = exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
4
4
|
var ethereum_1 = require("./ethereum");
|
|
5
5
|
Object.defineProperty(exports, "POOLS_DATA_ETHEREUM", { enumerable: true, get: function () { return ethereum_1.POOLS_DATA_ETHEREUM; } });
|
|
6
6
|
var polygon_1 = require("./polygon");
|
|
@@ -21,3 +21,5 @@ var aurora_1 = require("./aurora");
|
|
|
21
21
|
Object.defineProperty(exports, "POOLS_DATA_AURORA", { enumerable: true, get: function () { return aurora_1.POOLS_DATA_AURORA; } });
|
|
22
22
|
var kava_1 = require("./kava");
|
|
23
23
|
Object.defineProperty(exports, "POOLS_DATA_KAVA", { enumerable: true, get: function () { return kava_1.POOLS_DATA_KAVA; } });
|
|
24
|
+
var celo_1 = require("./celo");
|
|
25
|
+
Object.defineProperty(exports, "POOLS_DATA_CELO", { enumerable: true, get: function () { return celo_1.POOLS_DATA_CELO; } });
|
package/lib/constants/utils.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export declare const lowerCasePoolDataAddresses: (poolsData: IDict<IPoolData>) =
|
|
|
3
3
|
export declare const extractDecimals: (poolsData: IDict<IPoolData>) => IDict<number>;
|
|
4
4
|
export declare const extractGauges: (poolsData: IDict<IPoolData>) => string[];
|
|
5
5
|
export declare const lowerCaseValues: (dict: IDict<string>) => IDict<string>;
|
|
6
|
-
export declare const lowerCaseKeys: (dict: IDict<
|
|
6
|
+
export declare const lowerCaseKeys: (dict: IDict<any>) => IDict<any>;
|
package/lib/curve.js
CHANGED
|
@@ -92,6 +92,7 @@ var xdai_1 = require("./constants/coins/xdai");
|
|
|
92
92
|
var moonbeam_1 = require("./constants/coins/moonbeam");
|
|
93
93
|
var aurora_1 = require("./constants/coins/aurora");
|
|
94
94
|
var kava_1 = require("./constants/coins/kava");
|
|
95
|
+
var celo_1 = require("./constants/coins/celo");
|
|
95
96
|
var utils_1 = require("./constants/utils");
|
|
96
97
|
exports.NATIVE_TOKENS = {
|
|
97
98
|
1: {
|
|
@@ -136,6 +137,12 @@ exports.NATIVE_TOKENS = {
|
|
|
136
137
|
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
137
138
|
wrappedAddress: '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'.toLowerCase(),
|
|
138
139
|
},
|
|
140
|
+
42220: {
|
|
141
|
+
symbol: 'CELO',
|
|
142
|
+
wrappedSymbol: 'WCELO',
|
|
143
|
+
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
144
|
+
wrappedAddress: '0x3Ad443d769A07f287806874F8E5405cE3Ac902b9'.toLowerCase(),
|
|
145
|
+
},
|
|
139
146
|
43114: {
|
|
140
147
|
symbol: 'AVAX',
|
|
141
148
|
wrappedSymbol: 'WAVAX',
|
|
@@ -226,6 +233,16 @@ exports.NETWORK_CONSTANTS = {
|
|
|
226
233
|
ycTokens: kava_1.ycTokensKava,
|
|
227
234
|
aTokens: kava_1.aTokensKava,
|
|
228
235
|
},
|
|
236
|
+
42220: {
|
|
237
|
+
NAME: 'celo',
|
|
238
|
+
ALIASES: aliases_1.ALIASES_CELO,
|
|
239
|
+
POOLS_DATA: pools_1.POOLS_DATA_CELO,
|
|
240
|
+
COINS: celo_1.COINS_CELO,
|
|
241
|
+
cTokens: celo_1.cTokensCelo,
|
|
242
|
+
yTokens: celo_1.yTokensCelo,
|
|
243
|
+
ycTokens: celo_1.ycTokensCelo,
|
|
244
|
+
aTokens: celo_1.aTokensCelo,
|
|
245
|
+
},
|
|
229
246
|
43114: {
|
|
230
247
|
NAME: 'avalanche',
|
|
231
248
|
ALIASES: aliases_1.ALIASES_AVALANCHE,
|
package/lib/external-api.js
CHANGED
|
@@ -99,8 +99,8 @@ exports._getLegacyAPYsAndVolumes = (0, memoizee_1.default)(function (network) {
|
|
|
99
99
|
return __generator(this, function (_a) {
|
|
100
100
|
switch (_a.label) {
|
|
101
101
|
case 0:
|
|
102
|
-
if (curve_1.curve.chainId === 2222)
|
|
103
|
-
return [2 /*return*/, {}]; // Exclude Kava
|
|
102
|
+
if (curve_1.curve.chainId === 2222 || curve_1.curve.chainId === 42220)
|
|
103
|
+
return [2 /*return*/, {}]; // Exclude Kava and Celo
|
|
104
104
|
url = "https://stats.curve.fi/raw-stats-".concat(network, "/apys.json");
|
|
105
105
|
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
106
106
|
case 1:
|
|
@@ -119,15 +119,15 @@ exports._getLegacyAPYsAndVolumes = (0, memoizee_1.default)(function (network) {
|
|
|
119
119
|
promise: true,
|
|
120
120
|
maxAge: 5 * 60 * 1000, // 5m
|
|
121
121
|
});
|
|
122
|
-
// Moonbeam and
|
|
122
|
+
// Moonbeam, Kava and Celo only
|
|
123
123
|
exports._getFactoryAPYsAndVolumes = (0, memoizee_1.default)(function (network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
124
|
var url, response;
|
|
125
125
|
var _a;
|
|
126
126
|
return __generator(this, function (_b) {
|
|
127
127
|
switch (_b.label) {
|
|
128
128
|
case 0:
|
|
129
|
-
if (curve_1.curve.chainId
|
|
130
|
-
return [2 /*return*/, []];
|
|
129
|
+
if (curve_1.curve.chainId === 1313161554)
|
|
130
|
+
return [2 /*return*/, []]; // Exclude Aurora
|
|
131
131
|
url = "https://api.curve.fi/api/getFactoryAPYs-".concat(network);
|
|
132
132
|
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
133
133
|
case 1:
|
|
@@ -8,6 +8,7 @@ export declare const lpTokenBasePoolIdDictOptimism: IDict<string>;
|
|
|
8
8
|
export declare const lpTokenBasePoolIdDictXDai: IDict<string>;
|
|
9
9
|
export declare const lpTokenBasePoolIdDictMoonbeam: IDict<string>;
|
|
10
10
|
export declare const lpTokenBasePoolIdDictKava: IDict<string>;
|
|
11
|
+
export declare const lpTokenBasePoolIdDictCelo: IDict<string>;
|
|
11
12
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
12
13
|
address: string;
|
|
13
14
|
ABI: any;
|
|
@@ -44,6 +45,10 @@ export declare const basePoolIdZapDictKava: IDict<{
|
|
|
44
45
|
address: string;
|
|
45
46
|
ABI: any;
|
|
46
47
|
}>;
|
|
48
|
+
export declare const basePoolIdZapDictCelo: IDict<{
|
|
49
|
+
address: string;
|
|
50
|
+
ABI: any;
|
|
51
|
+
}>;
|
|
47
52
|
export declare const CRYPTO_FACTORY_CONSTANTS: {
|
|
48
53
|
[index: number]: {
|
|
49
54
|
lpTokenBasePoolIdDict: IDict<string>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CRYPTO_FACTORY_CONSTANTS = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.lpTokenBasePoolIdDictKava = exports.lpTokenBasePoolIdDictMoonbeam = exports.lpTokenBasePoolIdDictXDai = exports.lpTokenBasePoolIdDictOptimism = exports.lpTokenBasePoolIdDictArbitrum = exports.lpTokenBasePoolIdDictAvalanche = exports.lpTokenBasePoolIdDictFantom = exports.lpTokenBasePoolIdDictPolygon = exports.lpTokenBasePoolIdDictEthereum = void 0;
|
|
6
|
+
exports.CRYPTO_FACTORY_CONSTANTS = exports.basePoolIdZapDictCelo = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.lpTokenBasePoolIdDictCelo = exports.lpTokenBasePoolIdDictKava = exports.lpTokenBasePoolIdDictMoonbeam = exports.lpTokenBasePoolIdDictXDai = exports.lpTokenBasePoolIdDictOptimism = exports.lpTokenBasePoolIdDictArbitrum = exports.lpTokenBasePoolIdDictAvalanche = exports.lpTokenBasePoolIdDictFantom = exports.lpTokenBasePoolIdDictPolygon = exports.lpTokenBasePoolIdDictEthereum = void 0;
|
|
7
7
|
var utils_1 = require("../constants/utils");
|
|
8
8
|
// --- ZAPS --
|
|
9
9
|
var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
|
|
@@ -23,6 +23,7 @@ exports.lpTokenBasePoolIdDictOptimism = (0, utils_1.lowerCaseKeys)({});
|
|
|
23
23
|
exports.lpTokenBasePoolIdDictXDai = (0, utils_1.lowerCaseKeys)({});
|
|
24
24
|
exports.lpTokenBasePoolIdDictMoonbeam = (0, utils_1.lowerCaseKeys)({});
|
|
25
25
|
exports.lpTokenBasePoolIdDictKava = (0, utils_1.lowerCaseKeys)({});
|
|
26
|
+
exports.lpTokenBasePoolIdDictCelo = (0, utils_1.lowerCaseKeys)({});
|
|
26
27
|
exports.basePoolIdZapDictEthereum = {
|
|
27
28
|
'3pool': {
|
|
28
29
|
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
|
|
@@ -46,6 +47,7 @@ exports.basePoolIdZapDictOptimism = {};
|
|
|
46
47
|
exports.basePoolIdZapDictXDai = {};
|
|
47
48
|
exports.basePoolIdZapDictMoonbeam = {};
|
|
48
49
|
exports.basePoolIdZapDictKava = {};
|
|
50
|
+
exports.basePoolIdZapDictCelo = {};
|
|
49
51
|
exports.CRYPTO_FACTORY_CONSTANTS = {
|
|
50
52
|
1: {
|
|
51
53
|
lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictEthereum,
|
|
@@ -75,6 +77,10 @@ exports.CRYPTO_FACTORY_CONSTANTS = {
|
|
|
75
77
|
lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictKava,
|
|
76
78
|
basePoolIdZapDict: exports.basePoolIdZapDictKava,
|
|
77
79
|
},
|
|
80
|
+
42220: {
|
|
81
|
+
lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictCelo,
|
|
82
|
+
basePoolIdZapDict: exports.basePoolIdZapDictCelo,
|
|
83
|
+
},
|
|
78
84
|
43114: {
|
|
79
85
|
lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictAvalanche,
|
|
80
86
|
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
@@ -8,6 +8,7 @@ export declare const implementationABIDictOptimism: IDict<any>;
|
|
|
8
8
|
export declare const implementationABIDictXDai: IDict<any>;
|
|
9
9
|
export declare const implementationABIDictMoonbeam: IDict<any>;
|
|
10
10
|
export declare const implementationABIDictKava: IDict<any>;
|
|
11
|
+
export declare const implementationABIDictCelo: IDict<any>;
|
|
11
12
|
export declare const implementationBasePoolIdDictEthereum: IDict<string>;
|
|
12
13
|
export declare const implementationBasePoolIdDictPolygon: IDict<string>;
|
|
13
14
|
export declare const implementationBasePoolIdDictFantom: IDict<string>;
|
|
@@ -17,6 +18,7 @@ export declare const implementationBasePoolIdDictOptimism: IDict<string>;
|
|
|
17
18
|
export declare const implementationBasePoolIdDictXDai: IDict<string>;
|
|
18
19
|
export declare const implementationBasePoolIdDictMoonbeam: IDict<string>;
|
|
19
20
|
export declare const implementationBasePoolIdDictKava: IDict<string>;
|
|
21
|
+
export declare const implementationBasePoolIdDictCelo: IDict<string>;
|
|
20
22
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
21
23
|
address: string;
|
|
22
24
|
ABI: any;
|
|
@@ -53,6 +55,10 @@ export declare const basePoolIdZapDictKava: IDict<{
|
|
|
53
55
|
address: string;
|
|
54
56
|
ABI: any;
|
|
55
57
|
}>;
|
|
58
|
+
export declare const basePoolIdZapDictCelo: IDict<{
|
|
59
|
+
address: string;
|
|
60
|
+
ABI: any;
|
|
61
|
+
}>;
|
|
56
62
|
export declare const FACTORY_CONSTANTS: {
|
|
57
63
|
[index: number]: {
|
|
58
64
|
implementationABIDict: IDict<any>;
|
package/lib/factory/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FACTORY_CONSTANTS = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictKava = exports.implementationBasePoolIdDictMoonbeam = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictKava = exports.implementationABIDictMoonbeam = exports.implementationABIDictXDai = exports.implementationABIDictOptimism = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.basePoolIdZapDictCelo = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictCelo = exports.implementationBasePoolIdDictKava = exports.implementationBasePoolIdDictMoonbeam = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictCelo = exports.implementationABIDictKava = exports.implementationABIDictMoonbeam = exports.implementationABIDictXDai = exports.implementationABIDictOptimism = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
7
|
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
8
|
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
9
|
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
@@ -196,6 +196,20 @@ exports.implementationABIDictKava = {
|
|
|
196
196
|
"0x6378dd741b24bd884f3590d7bc7555fdb2f5b003": Plain4ETH_json_1.default,
|
|
197
197
|
"0x509495dfeec3a53acb2f60669985d868131ad9a5": Plain4Optimized_json_1.default,
|
|
198
198
|
};
|
|
199
|
+
exports.implementationABIDictCelo = {
|
|
200
|
+
"0xfEE7166C32Bdf6356Ef60636f43400AA55551A96": Plain2Basic_json_1.default,
|
|
201
|
+
"0x183Bb362aAa53f24BDF76a5E0FE11eEEce21F44d": Plain2Balances_json_1.default,
|
|
202
|
+
"0x469CF0874E62cfbaD342AE7e11aBCfC0F08dC17d": Plain2ETH_json_1.default,
|
|
203
|
+
"0xE5ddCc991c29d3a5350E1Eb669439F0237dB7490": Plain2Optimized_json_1.default,
|
|
204
|
+
"0xBcdCADB91446366d10b293152c967e64dE789B92": Plain3Basic_json_1.default,
|
|
205
|
+
"0x9Adb8f6B5c4A6Be6625E46e2fd352B859B4bf711": Plain3Balances_json_1.default,
|
|
206
|
+
"0x15Eb833Fa0689458Dc7B11517932780DfdFaa046": Plain3ETH_json_1.default,
|
|
207
|
+
"0xa72F339708461537223Bc415008eD61338Fe0CA2": Plain3Optimized_json_1.default,
|
|
208
|
+
"0x59395Ef4FB6F266F7B117CF0a7223eC45d78A2AF": Plain4Basic_json_1.default,
|
|
209
|
+
"0x3730D8B82BF3fF6Cc6dFDBe2Fd7B2A655e74eAae": Plain4Balances_json_1.default,
|
|
210
|
+
"0x0F5390AB4C5456a769056C96E4D7C71770b52319": Plain4ETH_json_1.default,
|
|
211
|
+
"0xA73b02a97B45604cd9f0BBAA153eCfe01f409350": Plain4Optimized_json_1.default,
|
|
212
|
+
};
|
|
199
213
|
exports.implementationBasePoolIdDictEthereum = {
|
|
200
214
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
201
215
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -247,6 +261,7 @@ exports.implementationBasePoolIdDictXDai = {
|
|
|
247
261
|
};
|
|
248
262
|
exports.implementationBasePoolIdDictMoonbeam = {};
|
|
249
263
|
exports.implementationBasePoolIdDictKava = {};
|
|
264
|
+
exports.implementationBasePoolIdDictCelo = {};
|
|
250
265
|
exports.basePoolIdZapDictEthereum = {
|
|
251
266
|
'3pool': {
|
|
252
267
|
address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
@@ -331,6 +346,7 @@ exports.basePoolIdZapDictXDai = {
|
|
|
331
346
|
};
|
|
332
347
|
exports.basePoolIdZapDictMoonbeam = {};
|
|
333
348
|
exports.basePoolIdZapDictKava = {};
|
|
349
|
+
exports.basePoolIdZapDictCelo = {};
|
|
334
350
|
exports.FACTORY_CONSTANTS = {
|
|
335
351
|
1: {
|
|
336
352
|
implementationABIDict: exports.implementationABIDictEthereum,
|
|
@@ -367,6 +383,11 @@ exports.FACTORY_CONSTANTS = {
|
|
|
367
383
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictKava,
|
|
368
384
|
basePoolIdZapDict: exports.basePoolIdZapDictKava,
|
|
369
385
|
},
|
|
386
|
+
42220: {
|
|
387
|
+
implementationABIDict: exports.implementationABIDictCelo,
|
|
388
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictCelo,
|
|
389
|
+
basePoolIdZapDict: exports.basePoolIdZapDictCelo,
|
|
390
|
+
},
|
|
370
391
|
43114: {
|
|
371
392
|
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
372
393
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
|
|
@@ -273,24 +273,7 @@ function getExistingCoinAddressNameDict() {
|
|
|
273
273
|
var poolData = _a[_i];
|
|
274
274
|
_loop_1(poolData);
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
278
|
-
if (this.chainId === 10)
|
|
279
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
280
|
-
if (this.chainId === 100)
|
|
281
|
-
dict[this.constants.NATIVE_TOKEN.address] = "XDAI";
|
|
282
|
-
if (this.chainId === 137)
|
|
283
|
-
dict[this.constants.NATIVE_TOKEN.address] = "MATIC";
|
|
284
|
-
if (this.chainId === 250)
|
|
285
|
-
dict[this.constants.NATIVE_TOKEN.address] = "FTM";
|
|
286
|
-
if (this.chainId === 1284)
|
|
287
|
-
dict[this.constants.NATIVE_TOKEN.address] = "GLMR";
|
|
288
|
-
if (this.chainId === 2222)
|
|
289
|
-
dict[this.constants.NATIVE_TOKEN.address] = "KAVA";
|
|
290
|
-
if (this.chainId === 43114)
|
|
291
|
-
dict[this.constants.NATIVE_TOKEN.address] = "AVAX";
|
|
292
|
-
if (this.chainId === 42161)
|
|
293
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
276
|
+
dict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
|
|
294
277
|
return dict;
|
|
295
278
|
}
|
|
296
279
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
package/lib/factory/factory.js
CHANGED
|
@@ -69,19 +69,11 @@ var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.
|
|
|
69
69
|
var common_1 = require("./common");
|
|
70
70
|
var constants_1 = require("./constants");
|
|
71
71
|
var BLACK_LIST = {
|
|
72
|
-
1: [],
|
|
73
|
-
10: [],
|
|
74
|
-
100: [],
|
|
75
72
|
137: [
|
|
76
73
|
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
77
74
|
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
78
75
|
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
79
76
|
],
|
|
80
|
-
250: [],
|
|
81
|
-
1284: [],
|
|
82
|
-
2222: [],
|
|
83
|
-
43114: [],
|
|
84
|
-
42161: [],
|
|
85
77
|
};
|
|
86
78
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
87
79
|
function getRecentlyCreatedPoolId(swapAddress) {
|
|
@@ -115,27 +107,28 @@ function getRecentlyCreatedPoolId(swapAddress) {
|
|
|
115
107
|
});
|
|
116
108
|
}
|
|
117
109
|
function getFactoryIdsAndSwapAddresses() {
|
|
110
|
+
var _a;
|
|
118
111
|
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
-
var factoryContract, factoryMulticallContract, poolCount,
|
|
120
|
-
return __generator(this, function (
|
|
121
|
-
switch (
|
|
112
|
+
var factoryContract, factoryMulticallContract, poolCount, _b, _c, _e, calls, i, factories, swapAddresses, blacklist;
|
|
113
|
+
return __generator(this, function (_f) {
|
|
114
|
+
switch (_f.label) {
|
|
122
115
|
case 0:
|
|
123
116
|
factoryContract = this.contracts[this.constants.ALIASES.factory].contract;
|
|
124
117
|
factoryMulticallContract = this.contracts[this.constants.ALIASES.factory].multicallContract;
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
_b = Number;
|
|
119
|
+
_e = (_c = ethers_1.ethers.utils).formatUnits;
|
|
127
120
|
return [4 /*yield*/, factoryContract.pool_count(this.constantOptions)];
|
|
128
121
|
case 1:
|
|
129
|
-
poolCount =
|
|
122
|
+
poolCount = _b.apply(void 0, [_e.apply(_c, [_f.sent(), 0])]);
|
|
130
123
|
calls = [];
|
|
131
124
|
for (i = 0; i < poolCount; i++) {
|
|
132
125
|
calls.push(factoryMulticallContract.pool_list(i));
|
|
133
126
|
}
|
|
134
127
|
return [4 /*yield*/, this.multicallProvider.all(calls)];
|
|
135
128
|
case 2:
|
|
136
|
-
factories = (
|
|
129
|
+
factories = (_f.sent()).map(function (addr, i) { return ({ id: "factory-v2-".concat(i), address: addr.toLowerCase() }); });
|
|
137
130
|
swapAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address.toLowerCase(); });
|
|
138
|
-
blacklist = BLACK_LIST[this.chainId];
|
|
131
|
+
blacklist = (_a = BLACK_LIST[this.chainId]) !== null && _a !== void 0 ? _a : [];
|
|
139
132
|
factories = factories.filter(function (f) { return !swapAddresses.includes(f.address) && !blacklist.includes(f.address); });
|
|
140
133
|
return [2 /*return*/, [factories.map(function (f) { return f.id; }), factories.map(function (f) { return f.address; })]];
|
|
141
134
|
}
|
|
@@ -299,24 +292,7 @@ function getExistingCoinAddressNameDict() {
|
|
|
299
292
|
var poolData = _a[_i];
|
|
300
293
|
_loop_1(poolData);
|
|
301
294
|
}
|
|
302
|
-
|
|
303
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
304
|
-
if (this.chainId === 10)
|
|
305
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
306
|
-
if (this.chainId === 100)
|
|
307
|
-
dict[this.constants.NATIVE_TOKEN.address] = "XDAI";
|
|
308
|
-
if (this.chainId === 137)
|
|
309
|
-
dict[this.constants.NATIVE_TOKEN.address] = "MATIC";
|
|
310
|
-
if (this.chainId === 250)
|
|
311
|
-
dict[this.constants.NATIVE_TOKEN.address] = "FTM";
|
|
312
|
-
if (this.chainId === 1284)
|
|
313
|
-
dict[this.constants.NATIVE_TOKEN.address] = "GLMR";
|
|
314
|
-
if (this.chainId === 2222)
|
|
315
|
-
dict[this.constants.NATIVE_TOKEN.address] = "KAVA";
|
|
316
|
-
if (this.chainId === 43114)
|
|
317
|
-
dict[this.constants.NATIVE_TOKEN.address] = "AVAX";
|
|
318
|
-
if (this.chainId === 42161)
|
|
319
|
-
dict[this.constants.NATIVE_TOKEN.address] = "ETH";
|
|
295
|
+
dict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
|
|
320
296
|
return dict;
|
|
321
297
|
}
|
|
322
298
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
package/lib/index.d.ts
CHANGED
|
@@ -52,6 +52,10 @@ declare const curve: {
|
|
|
52
52
|
getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
|
|
53
53
|
hasAllowance: (coins: string[], amounts: (string | number)[], address: string, spender: string) => Promise<boolean>;
|
|
54
54
|
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string) => Promise<string[]>;
|
|
55
|
+
getCoinNamesAndSymbols: (coins: string[]) => Promise<{
|
|
56
|
+
name: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
}[]>;
|
|
55
59
|
factory: {
|
|
56
60
|
deployPlainPool: (name: string, symbol: string, coins: string[], A: number, fee: number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransaction>;
|
|
57
61
|
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: number, fee: number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransaction>;
|
package/lib/index.js
CHANGED
|
@@ -132,6 +132,7 @@ var curve = {
|
|
|
132
132
|
getAllowance: utils_2.getAllowance,
|
|
133
133
|
hasAllowance: utils_2.hasAllowance,
|
|
134
134
|
ensureAllowance: utils_2.ensureAllowance,
|
|
135
|
+
getCoinNamesAndSymbols: utils_2.getCoinNamesAndSymbols,
|
|
135
136
|
factory: {
|
|
136
137
|
deployPlainPool: deploy_1.deployStablePlainPool,
|
|
137
138
|
deployMetaPool: deploy_1.deployStableMetaPool,
|
|
@@ -167,7 +167,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
167
167
|
return __generator(this, function (_e) {
|
|
168
168
|
switch (_e.label) {
|
|
169
169
|
case 0:
|
|
170
|
-
if (![1284, 2222, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 3];
|
|
170
|
+
if (![1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 3];
|
|
171
171
|
return [4 /*yield*/, Promise.all([
|
|
172
172
|
(0, external_api_1._getLegacyAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
|
|
173
173
|
(0, external_api_1._getFactoryAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
|
|
@@ -202,7 +202,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
202
202
|
return __generator(this, function (_d) {
|
|
203
203
|
switch (_d.label) {
|
|
204
204
|
case 0:
|
|
205
|
-
if (![1284, 2222, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 2];
|
|
205
|
+
if (![1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 2];
|
|
206
206
|
return [4 /*yield*/, Promise.all([
|
|
207
207
|
(0, external_api_1._getLegacyAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
|
|
208
208
|
(0, external_api_1._getFactoryAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
|
|
@@ -1116,8 +1116,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
1118
|
PoolTemplate.prototype.rewardsOnly = function () {
|
|
1119
|
-
if (curve_1.curve.chainId === 2222)
|
|
1120
|
-
return true; // TODO remove this for Kava
|
|
1119
|
+
if (curve_1.curve.chainId === 2222 || curve_1.curve.chainId === 42220)
|
|
1120
|
+
return true; // TODO remove this for Kava and Celo
|
|
1121
1121
|
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
1122
1122
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
1123
1123
|
var gaugeContract = curve_1.curve.contracts[this.gauge].contract;
|
package/lib/pools/utils.js
CHANGED
|
@@ -182,7 +182,7 @@ var _getUserClaimable = function (pools, address, useCache) { return __awaiter(v
|
|
|
182
182
|
for (_i = 0, poolsToFetch_3 = poolsToFetch; _i < poolsToFetch_3.length; _i++) {
|
|
183
183
|
poolId = poolsToFetch_3[_i];
|
|
184
184
|
pool = (0, poolConstructor_1.getPool)(poolId);
|
|
185
|
-
if (curve_1.curve.chainId === 2222 || pool.gauge === ethers_1.ethers.constants.AddressZero) { // TODO remove this for Kava
|
|
185
|
+
if (curve_1.curve.chainId === 2222 || curve_1.curve.chainId === 42220 || pool.gauge === ethers_1.ethers.constants.AddressZero) { // TODO remove this for Kava and Celo
|
|
186
186
|
hasCrvReward.push(false);
|
|
187
187
|
continue;
|
|
188
188
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -33,3 +33,7 @@ export declare const getTVL: (chainId?: number) => Promise<number>;
|
|
|
33
33
|
export declare const _setContracts: (address: string, abi: any) => void;
|
|
34
34
|
export declare const _get_small_x: (_x: ethers.BigNumber, _y: ethers.BigNumber, x_decimals: number, y_decimals: number) => BigNumber;
|
|
35
35
|
export declare const _get_price_impact: (_x: ethers.BigNumber, _y: ethers.BigNumber, _small_x: ethers.BigNumber, _small_y: ethers.BigNumber, x_decimals: number, y_decimals: number) => BigNumber;
|
|
36
|
+
export declare const getCoinNamesAndSymbols: (coins: string[]) => Promise<{
|
|
37
|
+
name: string;
|
|
38
|
+
symbol: string;
|
|
39
|
+
}[]>;
|
package/lib/utils.js
CHANGED
|
@@ -59,13 +59,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports._get_price_impact = exports._get_small_x = exports._setContracts = exports.getTVL = exports.getUsdRate = exports._getUsdRate = exports._getUsdPricesFromApi = exports.getPoolNameBySwapAddress = exports.ensureAllowance = exports.ensureAllowanceEstimateGas = exports._ensureAllowance = exports.hasAllowance = exports.getAllowance = exports._getAllowance = exports.getBalances = exports._prepareAddresses = exports._getBalances = exports._getCoinDecimals = exports._getCoinAddresses = exports._getCoinAddressesNoCheck = exports.getEthIndex = exports.isEth = exports.parseUnits = exports.formatNumber = exports.checkNumber = exports._cutZeros = exports.fromBN = exports.toStringFromBN = exports.toBN = exports.BN = exports.MAX_ALLOWANCE = exports.ETH_ADDRESS = void 0;
|
|
62
|
+
exports.getCoinNamesAndSymbols = exports._get_price_impact = exports._get_small_x = exports._setContracts = exports.getTVL = exports.getUsdRate = exports._getUsdRate = exports._getUsdPricesFromApi = exports.getPoolNameBySwapAddress = exports.ensureAllowance = exports.ensureAllowanceEstimateGas = exports._ensureAllowance = exports.hasAllowance = exports.getAllowance = exports._getAllowance = exports.getBalances = exports._prepareAddresses = exports._getBalances = exports._getCoinDecimals = exports._getCoinAddresses = exports._getCoinAddressesNoCheck = exports.getEthIndex = exports.isEth = exports.parseUnits = exports.formatNumber = exports.checkNumber = exports._cutZeros = exports.fromBN = exports.toStringFromBN = exports.toBN = exports.BN = exports.MAX_ALLOWANCE = exports.ETH_ADDRESS = void 0;
|
|
63
63
|
var axios_1 = __importDefault(require("axios"));
|
|
64
64
|
var ethers_1 = require("ethers");
|
|
65
|
+
var ethcall_1 = require("ethcall");
|
|
65
66
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
66
67
|
var curve_1 = require("./curve");
|
|
67
68
|
var external_api_1 = require("./external-api");
|
|
68
|
-
var
|
|
69
|
+
var ERC20_json_1 = __importDefault(require("./constants/abis/ERC20.json"));
|
|
69
70
|
exports.ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
70
71
|
exports.MAX_ALLOWANCE = ethers_1.ethers.BigNumber.from(2).pow(ethers_1.ethers.BigNumber.from(256)).sub(ethers_1.ethers.BigNumber.from(1));
|
|
71
72
|
// bignumber.js
|
|
@@ -472,6 +473,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
472
473
|
250: 'fantom',
|
|
473
474
|
1284: 'moonbeam',
|
|
474
475
|
2222: 'kava',
|
|
476
|
+
42220: 'celo',
|
|
475
477
|
43114: 'avalanche',
|
|
476
478
|
42161: 'arbitrum-one',
|
|
477
479
|
1313161554: 'aurora',
|
|
@@ -484,6 +486,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
484
486
|
250: 'fantom',
|
|
485
487
|
1284: 'moonbeam',
|
|
486
488
|
2222: 'kava',
|
|
489
|
+
42220: 'celo',
|
|
487
490
|
43114: 'avalanche-2',
|
|
488
491
|
42161: 'ethereum',
|
|
489
492
|
1313161554: 'ethereum',
|
|
@@ -555,6 +558,7 @@ var getTVL = function (chainId) {
|
|
|
555
558
|
250: "fantom",
|
|
556
559
|
1284: "moonbeam",
|
|
557
560
|
2222: 'kava',
|
|
561
|
+
42220: 'celo',
|
|
558
562
|
43114: "avalanche",
|
|
559
563
|
42161: "arbitrum",
|
|
560
564
|
1313161554: "aurora",
|
|
@@ -605,3 +609,37 @@ var _get_price_impact = function (_x, _y, _small_x, _small_y, x_decimals, y_deci
|
|
|
605
609
|
return (0, exports.BN)(1).minus(rateBN.div(smallRateBN)).times(100);
|
|
606
610
|
};
|
|
607
611
|
exports._get_price_impact = _get_price_impact;
|
|
612
|
+
var getCoinNamesAndSymbols = function (coins) { return __awaiter(void 0, void 0, void 0, function () {
|
|
613
|
+
var coinAddresses, ethIndex, contractCalls, _i, coinAddresses_3, coinAddr, coinContract, _response, res;
|
|
614
|
+
return __generator(this, function (_a) {
|
|
615
|
+
switch (_a.label) {
|
|
616
|
+
case 0:
|
|
617
|
+
coinAddresses = (0, exports._getCoinAddressesNoCheck)(coins);
|
|
618
|
+
ethIndex = (0, exports.getEthIndex)(coinAddresses);
|
|
619
|
+
if (ethIndex !== -1) {
|
|
620
|
+
coinAddresses.splice(ethIndex, 1);
|
|
621
|
+
}
|
|
622
|
+
contractCalls = [];
|
|
623
|
+
for (_i = 0, coinAddresses_3 = coinAddresses; _i < coinAddresses_3.length; _i++) {
|
|
624
|
+
coinAddr = coinAddresses_3[_i];
|
|
625
|
+
coinContract = new ethcall_1.Contract(coinAddr, ERC20_json_1.default);
|
|
626
|
+
contractCalls.push(coinContract.name(), coinContract.symbol());
|
|
627
|
+
}
|
|
628
|
+
return [4 /*yield*/, curve_1.curve.multicallProvider.all(contractCalls)];
|
|
629
|
+
case 1:
|
|
630
|
+
_response = _a.sent();
|
|
631
|
+
if (ethIndex !== -1) {
|
|
632
|
+
_response.splice.apply(_response, __spreadArray([ethIndex * 2, 0], ['Ethereum', 'ETH'], false));
|
|
633
|
+
}
|
|
634
|
+
res = [];
|
|
635
|
+
coins.forEach(function (address, i) {
|
|
636
|
+
res.push({
|
|
637
|
+
name: _response.shift(),
|
|
638
|
+
symbol: _response.shift(),
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
return [2 /*return*/, res];
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}); };
|
|
645
|
+
exports.getCoinNamesAndSymbols = getCoinNamesAndSymbols;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.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
|
"@ethersproject/networks": "^5.5.0",
|
|
35
35
|
"axios": "^0.21.1",
|
|
36
36
|
"bignumber.js": "^9.0.1",
|
|
37
|
-
"ethcall": "^4.8.
|
|
37
|
+
"ethcall": "^4.8.9",
|
|
38
38
|
"ethers": "^5.4.6",
|
|
39
39
|
"memoizee": "^0.4.15"
|
|
40
40
|
}
|