@curvefi/api 2.49.6 → 2.50.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 +18 -0
- package/lib/constants/coins/bsc.d.ts +6 -0
- package/lib/constants/coins/bsc.js +11 -0
- package/lib/constants/pools/bsc.d.ts +2 -0
- package/lib/constants/pools/bsc.js +2 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +2 -1
- package/lib/curve.js +19 -2
- 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 +21 -0
- package/lib/factory/factory.js +2 -2
- package/lib/interfaces.d.ts +2 -2
- package/lib/pools/PoolTemplate.d.ts +3 -3
- package/lib/pools/PoolTemplate.js +20 -18
- package/lib/utils.js +4 -2
- package/package.json +1 -1
|
@@ -11,3 +11,4 @@ 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
13
|
export declare const ALIASES_BASE: import("../interfaces.js").IDict<string>;
|
|
14
|
+
export declare const ALIASES_BSC: import("../interfaces.js").IDict<string>;
|
package/lib/constants/aliases.js
CHANGED
|
@@ -236,6 +236,24 @@ export var ALIASES_BASE = lowerCaseValues({
|
|
|
236
236
|
"factory_admin": "0x0000000000000000000000000000000000000000",
|
|
237
237
|
"gas_oracle": '0xc0d3C0d3C0d3c0D3C0D3C0d3C0d3C0D3C0D3000f', // <-- NEW
|
|
238
238
|
});
|
|
239
|
+
export var ALIASES_BSC = lowerCaseValues({
|
|
240
|
+
"crv": "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
|
|
241
|
+
"gauge_factory": "0x0000000000000000000000000000000000000000",
|
|
242
|
+
"voting_escrow": "0x0000000000000000000000000000000000000000",
|
|
243
|
+
"fee_distributor": "0x0000000000000000000000000000000000000000",
|
|
244
|
+
"gauge_controller": "0x0000000000000000000000000000000000000000",
|
|
245
|
+
"address_provider": "0x0000000000000000000000000000000000000000",
|
|
246
|
+
"router": "0x0000000000000000000000000000000000000000",
|
|
247
|
+
"deposit_and_stake": "0x0000000000000000000000000000000000000000",
|
|
248
|
+
"stable_calc": "0x0000000000000000000000000000000000000000",
|
|
249
|
+
"crypto_calc": '0x0000000000000000000000000000000000000000',
|
|
250
|
+
"factory": '0xEfDE221f306152971D8e9f181bFe998447975810',
|
|
251
|
+
"crvusd_factory": '0x0000000000000000000000000000000000000000',
|
|
252
|
+
"eywa_factory": '0x0000000000000000000000000000000000000000',
|
|
253
|
+
"crypto_factory": '0xBd5fBd2FA58cB15228a9Abdac9ec994f79E3483C',
|
|
254
|
+
"tricrypto_factory": '0xc55837710bc500F1E3c7bb9dd1d51F7c5647E657',
|
|
255
|
+
"factory_admin": '0x0000000000000000000000000000000000000000',
|
|
256
|
+
});
|
|
239
257
|
var registry_exchange_deprecated = {
|
|
240
258
|
'1': '0x99a58482bd75cbab83b27ec03ca68ff489b5788f',
|
|
241
259
|
'10': '0x22d710931f01c1681ca1570ff016ed42eb7b7c2a',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IDict } from "../../interfaces.js";
|
|
2
|
+
export declare const COINS_BSC: IDict<string>;
|
|
3
|
+
export declare const cTokensBsc: never[];
|
|
4
|
+
export declare const yTokensBsc: never[];
|
|
5
|
+
export declare const ycTokensBsc: never[];
|
|
6
|
+
export declare const aTokensBsc: never[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lowerCaseValues } from "../utils.js";
|
|
2
|
+
export var COINS_BSC = lowerCaseValues({
|
|
3
|
+
//crv: '0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415', // <--- TODO ADD
|
|
4
|
+
// --- BSC ---
|
|
5
|
+
bnb: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
6
|
+
wbnb: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
|
|
7
|
+
});
|
|
8
|
+
export var cTokensBsc = []; //.map((a) => a.toLowerCase());
|
|
9
|
+
export var yTokensBsc = []; //.map((a) => a.toLowerCase());
|
|
10
|
+
export var ycTokensBsc = []; //.map((a) => a.toLowerCase());
|
|
11
|
+
export var aTokensBsc = []; //.map((a) => a.toLowerCase());
|
|
@@ -12,4 +12,5 @@ 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
|
-
|
|
15
|
+
import { POOLS_DATA_BSC } from "./bsc.js";
|
|
16
|
+
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, POOLS_DATA_BSC, };
|
|
@@ -12,4 +12,5 @@ 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
|
-
|
|
15
|
+
import { POOLS_DATA_BSC } from "./bsc.js";
|
|
16
|
+
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, POOLS_DATA_BSC, };
|
package/lib/curve.js
CHANGED
|
@@ -85,8 +85,8 @@ import factoryAdminABI from './constants/abis/factory-admin.json' assert { type:
|
|
|
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
87
|
import gasOracleABI from './constants/abis/gas_oracle_optimism.json' assert { type: 'json' };
|
|
88
|
-
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';
|
|
89
|
-
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";
|
|
88
|
+
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, POOLS_DATA_BSC, } from './constants/pools/index.js';
|
|
89
|
+
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, ALIASES_BSC, } from "./constants/aliases.js";
|
|
90
90
|
import { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum } from "./constants/coins/ethereum.js";
|
|
91
91
|
import { COINS_OPTIMISM, cTokensOptimism, yTokensOptimism, ycTokensOptimism, aTokensOptimism } from "./constants/coins/optimism.js";
|
|
92
92
|
import { COINS_POLYGON, cTokensPolygon, yTokensPolygon, ycTokensPolygon, aTokensPolygon } from "./constants/coins/polygon.js";
|
|
@@ -100,6 +100,7 @@ import { COINS_KAVA, cTokensKava, yTokensKava, ycTokensKava, aTokensKava } from
|
|
|
100
100
|
import { COINS_CELO, cTokensCelo, yTokensCelo, ycTokensCelo, aTokensCelo } from "./constants/coins/celo.js";
|
|
101
101
|
import { COINS_ZKSYNC, cTokensZkSync, yTokensZkSync, ycTokensZkSync, aTokensZkSync } from "./constants/coins/zksync.js";
|
|
102
102
|
import { COINS_BASE, cTokensBase, yTokensBase, ycTokensBase, aTokensBase } from "./constants/coins/base.js";
|
|
103
|
+
import { COINS_BSC, cTokensBsc, yTokensBsc, ycTokensBsc, aTokensBsc } from "./constants/coins/bsc.js";
|
|
103
104
|
import { lowerCasePoolDataAddresses, extractDecimals, extractGauges } from "./constants/utils.js";
|
|
104
105
|
import { _getAllGauges, _getHiddenPools } from "./external-api.js";
|
|
105
106
|
import { L2Networks } from "./constants/L2Networks.js";
|
|
@@ -142,6 +143,12 @@ export var NATIVE_TOKENS = {
|
|
|
142
143
|
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
143
144
|
wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
|
|
144
145
|
},
|
|
146
|
+
56: {
|
|
147
|
+
symbol: 'BNB',
|
|
148
|
+
wrappedSymbol: 'WBNB',
|
|
149
|
+
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
150
|
+
wrappedAddress: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'.toLowerCase(),
|
|
151
|
+
},
|
|
145
152
|
100: {
|
|
146
153
|
symbol: 'XDAi',
|
|
147
154
|
wrappedSymbol: 'WXDAI',
|
|
@@ -231,6 +238,16 @@ export var NETWORK_CONSTANTS = {
|
|
|
231
238
|
ycTokens: ycTokensOptimism,
|
|
232
239
|
aTokens: aTokensOptimism,
|
|
233
240
|
},
|
|
241
|
+
56: {
|
|
242
|
+
NAME: 'bsc',
|
|
243
|
+
ALIASES: ALIASES_BSC,
|
|
244
|
+
POOLS_DATA: POOLS_DATA_BSC,
|
|
245
|
+
COINS: COINS_BSC,
|
|
246
|
+
cTokens: cTokensBsc,
|
|
247
|
+
yTokens: yTokensBsc,
|
|
248
|
+
ycTokens: ycTokensBsc,
|
|
249
|
+
aTokens: aTokensBsc,
|
|
250
|
+
},
|
|
234
251
|
100: {
|
|
235
252
|
NAME: 'xdai',
|
|
236
253
|
ALIASES: ALIASES_XDAI,
|
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 (["kava", "celo", "zksync", "base"].includes(network))
|
|
101
|
-
return [2 /*return*/, {}]; // Exclude Kava, Celo, ZkSync and
|
|
100
|
+
if (["kava", "celo", "zksync", "base", "bsc"].includes(network))
|
|
101
|
+
return [2 /*return*/, {}]; // Exclude Kava, Celo, ZkSync, Base and Bsc
|
|
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
|
-
// Base, ZkSync, Moonbeam, Kava and Celo only
|
|
120
|
+
// Base, Bsc, 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;
|
|
@@ -11,6 +11,7 @@ export declare const lpTokenBasePoolIdDictKava: IDict<string>;
|
|
|
11
11
|
export declare const lpTokenBasePoolIdDictCelo: IDict<string>;
|
|
12
12
|
export declare const lpTokenBasePoolIdDictZkSync: IDict<string>;
|
|
13
13
|
export declare const lpTokenBasePoolIdDictBase: IDict<string>;
|
|
14
|
+
export declare const lpTokenBasePoolIdDictBsc: IDict<string>;
|
|
14
15
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
15
16
|
address: string;
|
|
16
17
|
ABI: any;
|
|
@@ -59,6 +60,10 @@ export declare const basePoolIdZapDictBase: IDict<{
|
|
|
59
60
|
address: string;
|
|
60
61
|
ABI: any;
|
|
61
62
|
}>;
|
|
63
|
+
export declare const basePoolIdZapDictBsc: IDict<{
|
|
64
|
+
address: string;
|
|
65
|
+
ABI: any;
|
|
66
|
+
}>;
|
|
62
67
|
export declare const CRYPTO_FACTORY_CONSTANTS: {
|
|
63
68
|
[index: number]: {
|
|
64
69
|
lpTokenBasePoolIdDict: IDict<string>;
|
|
@@ -20,6 +20,7 @@ export var lpTokenBasePoolIdDictKava = lowerCaseKeys({});
|
|
|
20
20
|
export var lpTokenBasePoolIdDictCelo = lowerCaseKeys({});
|
|
21
21
|
export var lpTokenBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
22
22
|
export var lpTokenBasePoolIdDictBase = lowerCaseKeys({});
|
|
23
|
+
export var lpTokenBasePoolIdDictBsc = lowerCaseKeys({});
|
|
23
24
|
export var basePoolIdZapDictEthereum = {
|
|
24
25
|
'3pool': {
|
|
25
26
|
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
|
|
@@ -46,6 +47,7 @@ export var basePoolIdZapDictKava = {};
|
|
|
46
47
|
export var basePoolIdZapDictCelo = {};
|
|
47
48
|
export var basePoolIdZapDictZkSync = {};
|
|
48
49
|
export var basePoolIdZapDictBase = {};
|
|
50
|
+
export var basePoolIdZapDictBsc = {};
|
|
49
51
|
export var CRYPTO_FACTORY_CONSTANTS = {
|
|
50
52
|
1: {
|
|
51
53
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictEthereum,
|
|
@@ -55,6 +57,10 @@ export var CRYPTO_FACTORY_CONSTANTS = {
|
|
|
55
57
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictOptimism,
|
|
56
58
|
basePoolIdZapDict: basePoolIdZapDictOptimism,
|
|
57
59
|
},
|
|
60
|
+
56: {
|
|
61
|
+
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictBsc,
|
|
62
|
+
basePoolIdZapDict: basePoolIdZapDictBsc,
|
|
63
|
+
},
|
|
58
64
|
100: {
|
|
59
65
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictXDai,
|
|
60
66
|
basePoolIdZapDict: basePoolIdZapDictXDai,
|
|
@@ -11,6 +11,7 @@ export declare const implementationABIDictKava: IDict<any>;
|
|
|
11
11
|
export declare const implementationABIDictCelo: IDict<any>;
|
|
12
12
|
export declare const implementationABIDictZkSync: IDict<any>;
|
|
13
13
|
export declare const implementationABIDictBase: IDict<any>;
|
|
14
|
+
export declare const implementationABIDictBsc: IDict<any>;
|
|
14
15
|
export declare const implementationBasePoolIdDictEthereum: IDict<string>;
|
|
15
16
|
export declare const implementationBasePoolIdDictPolygon: IDict<string>;
|
|
16
17
|
export declare const implementationBasePoolIdDictFantom: IDict<string>;
|
|
@@ -23,6 +24,7 @@ export declare const implementationBasePoolIdDictKava: IDict<string>;
|
|
|
23
24
|
export declare const implementationBasePoolIdDictCelo: IDict<string>;
|
|
24
25
|
export declare const implementationBasePoolIdDictZkSync: IDict<string>;
|
|
25
26
|
export declare const implementationBasePoolIdDictBase: IDict<string>;
|
|
27
|
+
export declare const implementationBasePoolIdDictBsc: IDict<string>;
|
|
26
28
|
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
27
29
|
address: string;
|
|
28
30
|
ABI: any;
|
|
@@ -71,6 +73,10 @@ export declare const basePoolIdZapDictBase: IDict<{
|
|
|
71
73
|
address: string;
|
|
72
74
|
ABI: any;
|
|
73
75
|
}>;
|
|
76
|
+
export declare const basePoolIdZapDictBsc: IDict<{
|
|
77
|
+
address: string;
|
|
78
|
+
ABI: any;
|
|
79
|
+
}>;
|
|
74
80
|
export declare const FACTORY_CONSTANTS: {
|
|
75
81
|
[index: number]: {
|
|
76
82
|
implementationABIDict: IDict<any>;
|
package/lib/factory/constants.js
CHANGED
|
@@ -261,6 +261,20 @@ export var implementationABIDictBase = lowerCaseKeys({
|
|
|
261
261
|
"0x50E09Ee7080b32aef3e92346891dD2DD389B5fAf": Plain4ETHABI,
|
|
262
262
|
"0x44d9B3f4EE15AC81FEb918501fca0ddc9d83C976": Plain4OptimizedABI,
|
|
263
263
|
});
|
|
264
|
+
export var implementationABIDictBsc = lowerCaseKeys({
|
|
265
|
+
"0xB90B9B1F91a01Ea22A182CD84C1E22222e39B415": Plain2BasicABI,
|
|
266
|
+
"0x7CDE88e96E9445D986537074B1bFD32c5623c71f": Plain2BalancesABI,
|
|
267
|
+
"0x5BD917879e04Cf18EC79285a1C960C5fbA7f5EA3": Plain2ETHABI,
|
|
268
|
+
"0x630C7Ad3998f397df0c0A8FfDB7a65B61ec5539E": Plain2OptimizedABI,
|
|
269
|
+
"0xD166EEdf272B860E991d331B71041799379185D5": Plain3BasicABI,
|
|
270
|
+
"0x5C627d6925e448Ae418BC8a45d56B31fe5009Bea": Plain3BalancesABI,
|
|
271
|
+
"0x22D710931F01c1681Ca1570Ff016eD42EB7b7c2a": Plain3ETHABI,
|
|
272
|
+
"0xA50d9a424A14aF0b9e7e9243dc1597d977f6cB09": Plain3OptimizedABI,
|
|
273
|
+
"0xeD49979026DC44DC7E83b1471794ec9b2a365Ea2": Plain4BasicABI,
|
|
274
|
+
"0x0Cc51c9786f3777a6d50961CEBb2BB6E69ec5e07": Plain4BalancesABI,
|
|
275
|
+
"0x0a31527a8dE2Ee97BBD8cCE14Db8E8826a0b6C4f": Plain4ETHABI,
|
|
276
|
+
"0x1086F023146f9026A9Bb22983CE866813C59518A": Plain4OptimizedABI,
|
|
277
|
+
});
|
|
264
278
|
export var implementationBasePoolIdDictEthereum = lowerCaseKeys({
|
|
265
279
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
266
280
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -319,6 +333,7 @@ export var implementationBasePoolIdDictKava = lowerCaseKeys({});
|
|
|
319
333
|
export var implementationBasePoolIdDictCelo = lowerCaseKeys({});
|
|
320
334
|
export var implementationBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
321
335
|
export var implementationBasePoolIdDictBase = lowerCaseKeys({});
|
|
336
|
+
export var implementationBasePoolIdDictBsc = lowerCaseKeys({});
|
|
322
337
|
export var basePoolIdZapDictEthereum = {
|
|
323
338
|
'3pool': {
|
|
324
339
|
address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
@@ -414,6 +429,7 @@ export var basePoolIdZapDictKava = {};
|
|
|
414
429
|
export var basePoolIdZapDictCelo = {};
|
|
415
430
|
export var basePoolIdZapDictZkSync = {};
|
|
416
431
|
export var basePoolIdZapDictBase = {};
|
|
432
|
+
export var basePoolIdZapDictBsc = {};
|
|
417
433
|
export var FACTORY_CONSTANTS = {
|
|
418
434
|
1: {
|
|
419
435
|
implementationABIDict: implementationABIDictEthereum,
|
|
@@ -425,6 +441,11 @@ export var FACTORY_CONSTANTS = {
|
|
|
425
441
|
implementationBasePoolIdDict: implementationBasePoolIdDictOptimism,
|
|
426
442
|
basePoolIdZapDict: basePoolIdZapDictOptimism,
|
|
427
443
|
},
|
|
444
|
+
56: {
|
|
445
|
+
implementationABIDict: implementationABIDictBsc,
|
|
446
|
+
implementationBasePoolIdDict: implementationBasePoolIdDictBsc,
|
|
447
|
+
basePoolIdZapDict: basePoolIdZapDictBsc,
|
|
448
|
+
},
|
|
428
449
|
100: {
|
|
429
450
|
implementationABIDict: implementationABIDictXDai,
|
|
430
451
|
implementationBasePoolIdDict: implementationBasePoolIdDictXDai,
|
package/lib/factory/factory.js
CHANGED
|
@@ -72,8 +72,8 @@ export var BLACK_LIST = {
|
|
|
72
72
|
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
73
73
|
],
|
|
74
74
|
42161: [
|
|
75
|
-
"0xd7bb79aee866672419999a0496d99c54741d67b5"
|
|
76
|
-
]
|
|
75
|
+
"0xd7bb79aee866672419999a0496d99c54741d67b5",
|
|
76
|
+
],
|
|
77
77
|
};
|
|
78
78
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
79
79
|
function getRecentlyCreatedPoolId(swapAddress) {
|
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" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
-
export type IChainId = 1 | 10 | 100 | 137 | 250 | 324 | 1284 | 2222 | 8453 | 42161 | 42220 | 43114 | 1313161554;
|
|
6
|
+
export type INetworkName = "ethereum" | "bsc" | "optimism" | "xdai" | "polygon" | "fantom" | "zksync" | "moonbeam" | "kava" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
+
export type IChainId = 1 | 10 | 56 | 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 ISwapType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
@@ -40,8 +40,8 @@ export declare class PoolTemplate {
|
|
|
40
40
|
depositWrapped: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
41
41
|
stakeApprove: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
42
42
|
stake: (lpTokenAmount: number | string) => Promise<number>;
|
|
43
|
-
unstake: (lpTokenAmount: number | string) => Promise<number>;
|
|
44
|
-
claimCrv: () => Promise<number>;
|
|
43
|
+
unstake: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
44
|
+
claimCrv: () => Promise<number | number[]>;
|
|
45
45
|
claimRewards: () => Promise<number>;
|
|
46
46
|
depositAndStakeApprove: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
47
47
|
depositAndStake: (amounts: (number | string)[]) => Promise<number>;
|
|
@@ -137,7 +137,7 @@ export declare class PoolTemplate {
|
|
|
137
137
|
unstake(lpTokenAmount: number | string): Promise<string>;
|
|
138
138
|
crvProfit: (address?: string) => Promise<IProfit>;
|
|
139
139
|
claimableCrv(address?: string): Promise<string>;
|
|
140
|
-
claimCrvEstimateGas(): Promise<number>;
|
|
140
|
+
claimCrvEstimateGas(): Promise<number | number[]>;
|
|
141
141
|
claimCrv(): Promise<string>;
|
|
142
142
|
boost: (address?: string) => Promise<string>;
|
|
143
143
|
userCrvApy: (address?: string) => Promise<number>;
|
|
@@ -56,7 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
};
|
|
57
57
|
import memoize from "memoizee";
|
|
58
58
|
import { _getPoolsFromApi, _getSubgraphData, _getFactoryAPYsAndVolumes, _getLegacyAPYsAndVolumes } from '../external-api.js';
|
|
59
|
-
import { _getCoinAddresses, _getBalances, _prepareAddresses, _ensureAllowance, _getUsdRate, hasAllowance, ensureAllowance, ensureAllowanceEstimateGas, BN, toBN, toStringFromBN, parseUnits, getEthIndex, fromBN, _cutZeros, _setContracts, _get_small_x, _get_price_impact, checkNumber, _getCrvApyFromApi, _getRewardsFromApi, mulBy1_3, smartNumber, } from '../utils.js';
|
|
59
|
+
import { _getCoinAddresses, _getBalances, _prepareAddresses, _ensureAllowance, _getUsdRate, hasAllowance, ensureAllowance, ensureAllowanceEstimateGas, BN, toBN, toStringFromBN, parseUnits, getEthIndex, fromBN, _cutZeros, _setContracts, _get_small_x, _get_price_impact, checkNumber, _getCrvApyFromApi, _getRewardsFromApi, mulBy1_3, smartNumber, DIGas, } from '../utils.js';
|
|
60
60
|
import { curve as _curve, curve } from "../curve.js";
|
|
61
61
|
import ERC20Abi from '../constants/abis/ERC20.json' assert { type: 'json' };
|
|
62
62
|
var DAY = 86400;
|
|
@@ -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, 8453, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 3];
|
|
228
|
+
if (![56, 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, 8453, 42220, 1313161554].includes(curve.chainId)) return [3 /*break*/, 2];
|
|
263
|
+
if (![56, 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),
|
|
@@ -1689,7 +1689,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1689
1689
|
throw Error("unstakeEstimateGas method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1690
1690
|
}
|
|
1691
1691
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1692
|
-
_c =
|
|
1692
|
+
_c = smartNumber;
|
|
1693
1693
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1694
1694
|
case 1: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];
|
|
1695
1695
|
}
|
|
@@ -1698,9 +1698,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1698
1698
|
};
|
|
1699
1699
|
PoolTemplate.prototype.unstake = function (lpTokenAmount) {
|
|
1700
1700
|
return __awaiter(this, void 0, void 0, function () {
|
|
1701
|
-
var _lpTokenAmount, gasLimit;
|
|
1702
|
-
return __generator(this, function (
|
|
1703
|
-
switch (
|
|
1701
|
+
var _lpTokenAmount, gasLimit, _c;
|
|
1702
|
+
return __generator(this, function (_d) {
|
|
1703
|
+
switch (_d.label) {
|
|
1704
1704
|
case 0:
|
|
1705
1705
|
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1706
1706
|
throw Error("unstake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
@@ -1708,12 +1708,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1708
1708
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1709
1709
|
return [4 /*yield*/, curve.updateFeeData()];
|
|
1710
1710
|
case 1:
|
|
1711
|
-
|
|
1711
|
+
_d.sent();
|
|
1712
|
+
_c = DIGas;
|
|
1712
1713
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1713
1714
|
case 2:
|
|
1714
|
-
gasLimit =
|
|
1715
|
+
gasLimit = _c.apply(void 0, [(_d.sent())]) * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
|
|
1715
1716
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1716
|
-
case 3: return [2 /*return*/, (
|
|
1717
|
+
case 3: return [2 /*return*/, (_d.sent()).hash];
|
|
1717
1718
|
}
|
|
1718
1719
|
});
|
|
1719
1720
|
});
|
|
@@ -1750,7 +1751,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1750
1751
|
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.minter].contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1751
1752
|
case 1: return [2 /*return*/, _c.apply(void 0, [_e.sent()])];
|
|
1752
1753
|
case 2:
|
|
1753
|
-
_d =
|
|
1754
|
+
_d = smartNumber;
|
|
1754
1755
|
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.gauge_factory].contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1755
1756
|
case 3: return [2 /*return*/, _d.apply(void 0, [_e.sent()])];
|
|
1756
1757
|
}
|
|
@@ -1759,19 +1760,20 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1759
1760
|
};
|
|
1760
1761
|
PoolTemplate.prototype.claimCrv = function () {
|
|
1761
1762
|
return __awaiter(this, void 0, void 0, function () {
|
|
1762
|
-
var contract, gasLimit, _c;
|
|
1763
|
-
return __generator(this, function (
|
|
1764
|
-
switch (
|
|
1763
|
+
var contract, gasLimit, _c, _d;
|
|
1764
|
+
return __generator(this, function (_e) {
|
|
1765
|
+
switch (_e.label) {
|
|
1765
1766
|
case 0:
|
|
1766
1767
|
if (this.rewardsOnly())
|
|
1767
1768
|
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use claimRewards instead"));
|
|
1768
1769
|
contract = curve.chainId === 1 ? curve.contracts[curve.constants.ALIASES.minter].contract : curve.contracts[curve.constants.ALIASES.gauge_factory].contract;
|
|
1769
1770
|
_c = mulBy1_3;
|
|
1771
|
+
_d = DIGas;
|
|
1770
1772
|
return [4 /*yield*/, contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1771
1773
|
case 1:
|
|
1772
|
-
gasLimit = _c.apply(void 0, [_d.sent()]);
|
|
1774
|
+
gasLimit = _c.apply(void 0, [_d.apply(void 0, [_e.sent()])]);
|
|
1773
1775
|
return [4 /*yield*/, contract.mint(this.gauge, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1774
|
-
case 2: return [2 /*return*/, (
|
|
1776
|
+
case 2: return [2 /*return*/, (_e.sent()).hash];
|
|
1775
1777
|
}
|
|
1776
1778
|
});
|
|
1777
1779
|
});
|
|
@@ -2268,11 +2270,11 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2268
2270
|
case 17:
|
|
2269
2271
|
_gas = (_q.sent());
|
|
2270
2272
|
if (estimateGas)
|
|
2271
|
-
return [2 /*return*/,
|
|
2273
|
+
return [2 /*return*/, smartNumber(_gas)];
|
|
2272
2274
|
return [4 /*yield*/, curve.updateFeeData()];
|
|
2273
2275
|
case 18:
|
|
2274
2276
|
_q.sent();
|
|
2275
|
-
gasLimit = _gas * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
|
|
2277
|
+
gasLimit = DIGas(_gas) * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
|
|
2276
2278
|
return [4 /*yield*/, contract.deposit_and_stake(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
|
|
2277
2279
|
case 19: return [2 /*return*/, (_q.sent()).hash];
|
|
2278
2280
|
}
|
package/lib/utils.js
CHANGED
|
@@ -606,6 +606,7 @@ export var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, v
|
|
|
606
606
|
chainName = {
|
|
607
607
|
1: 'ethereum',
|
|
608
608
|
10: 'optimistic-ethereum',
|
|
609
|
+
56: "bsc",
|
|
609
610
|
100: 'xdai',
|
|
610
611
|
137: 'polygon-pos',
|
|
611
612
|
250: 'fantom',
|
|
@@ -621,6 +622,7 @@ export var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, v
|
|
|
621
622
|
nativeTokenName = {
|
|
622
623
|
1: 'ethereum',
|
|
623
624
|
10: 'ethereum',
|
|
625
|
+
56: 'bnb',
|
|
624
626
|
100: 'xdai',
|
|
625
627
|
137: 'matic-network',
|
|
626
628
|
250: 'fantom',
|
|
@@ -769,10 +771,10 @@ export var getVolume = function (network) {
|
|
|
769
771
|
switch (_e.label) {
|
|
770
772
|
case 0:
|
|
771
773
|
network = _getNetworkName(network);
|
|
772
|
-
if (!["zksync", "moonbeam", "kava", "base", "celo", "aurora"].includes(network)) return [3 /*break*/, 8];
|
|
774
|
+
if (!["zksync", "moonbeam", "kava", "base", "celo", "aurora", "bsc"].includes(network)) return [3 /*break*/, 8];
|
|
773
775
|
chainId = _getChainId(network);
|
|
774
776
|
if (curve.chainId !== chainId)
|
|
775
|
-
throw Error("To get volume for ZkSync, Moonbeam, Kava, Base, Celo or
|
|
777
|
+
throw Error("To get volume for ZkSync, Moonbeam, Kava, Base, Celo, Aurora or Bsc connect to the network first");
|
|
776
778
|
return [4 /*yield*/, Promise.all([
|
|
777
779
|
_getLegacyAPYsAndVolumes(network),
|
|
778
780
|
_getFactoryAPYsAndVolumes(network),
|