@curvefi/api 2.69.12 → 2.69.14
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/abis/avaxcrypto/swap.json +1195 -0
- package/lib/constants/abis/avaxcrypto/zap.json +250 -0
- package/lib/constants/abis/factory-v2/MetaUSDGeist.json +932 -0
- package/lib/constants/chainIds.d.ts +1 -0
- package/lib/constants/chainIds.js +1 -0
- package/lib/constants/coins/aurora.d.ts +3 -0
- package/lib/constants/coins/aurora.js +9 -0
- package/lib/constants/coins/avalanche.d.ts +4 -0
- package/lib/constants/coins/avalanche.js +34 -0
- package/lib/constants/coins/celo.d.ts +3 -0
- package/lib/constants/coins/celo.js +9 -0
- package/lib/constants/coins/ethereum.js +3 -0
- package/lib/constants/coins/index.d.ts +10 -1
- package/lib/constants/coins/index.js +10 -1
- package/lib/constants/coins/kava.d.ts +3 -0
- package/lib/constants/coins/kava.js +9 -0
- package/lib/constants/coins/mantle.d.ts +2 -0
- package/lib/constants/coins/mantle.js +5 -0
- package/lib/constants/coins/moonbeam.d.ts +3 -0
- package/lib/constants/coins/moonbeam.js +9 -0
- package/lib/constants/coins/sonic.d.ts +2 -0
- package/lib/constants/coins/sonic.js +5 -0
- package/lib/constants/coins/xlayer.d.ts +2 -0
- package/lib/constants/coins/xlayer.js +5 -0
- package/lib/constants/coins/zksync.d.ts +2 -0
- package/lib/constants/coins/zksync.js +6 -0
- package/lib/constants/factory/crypto.d.ts +45 -0
- package/lib/constants/factory/crypto.js +72 -0
- package/lib/constants/factory/stable.d.ts +9 -0
- package/lib/constants/factory/stable.js +119 -0
- package/lib/constants/network_constants.js +258 -2
- package/lib/constants/pools/aurora.d.ts +2 -0
- package/lib/constants/pools/aurora.js +31 -0
- package/lib/constants/pools/avalanche.d.ts +2 -0
- package/lib/constants/pools/avalanche.js +166 -0
- package/lib/constants/pools/celo.d.ts +2 -0
- package/lib/constants/pools/celo.js +2 -0
- package/lib/constants/pools/index.d.ts +10 -1
- package/lib/constants/pools/index.js +10 -1
- package/lib/constants/pools/kava.d.ts +2 -0
- package/lib/constants/pools/kava.js +2 -0
- package/lib/constants/pools/mantle.d.ts +2 -0
- package/lib/constants/pools/mantle.js +2 -0
- package/lib/constants/pools/moonbeam.d.ts +2 -0
- package/lib/constants/pools/moonbeam.js +31 -0
- package/lib/constants/pools/sonic.d.ts +2 -0
- package/lib/constants/pools/sonic.js +2 -0
- package/lib/constants/pools/xlayer.d.ts +2 -0
- package/lib/constants/pools/xlayer.js +2 -0
- package/lib/constants/pools/zksync.d.ts +2 -0
- package/lib/constants/pools/zksync.js +2 -0
- package/lib/constants/rewardNetworks.js +1 -1
- package/lib/constants/volumeNetworks.d.ts +2 -0
- package/lib/constants/volumeNetworks.js +3 -1
- package/lib/curve.js +4 -1
- package/lib/external-api.d.ts +2 -0
- package/lib/external-api.js +41 -0
- package/lib/pools/PoolTemplate.js +2 -0
- package/lib/pools/subClasses/statsPool.js +2 -2
- package/lib/pools/utils.js +7 -2
- package/lib/route-graph.worker.js +65 -2
- package/lib/utils.js +55 -3
- package/package.json +1 -1
package/lib/curve.js
CHANGED
|
@@ -54,7 +54,7 @@ import { L2Networks } from "./constants/L2Networks.js";
|
|
|
54
54
|
import { getTwocryptoFactoryPoolData } from "./factory/factory-twocrypto.js";
|
|
55
55
|
import { applyFeeDataOverride, computeEip1559Fees, computeLegacyOrFallback, fetchFeeHistory, getNetworkConstants, } from "./utils.js";
|
|
56
56
|
import { _setPoolsFromApi } from "./cached.js";
|
|
57
|
-
export const OLD_CHAINS = [1, 10, 56, 100, 137, 8453, 42161]; // these chains have non-ng pools
|
|
57
|
+
export const OLD_CHAINS = [1, 10, 56, 100, 137, 1284, 2222, 8453, 42161, 42220, 43114, 1313161554]; // these chains have non-ng pools
|
|
58
58
|
export const memoizedContract = () => {
|
|
59
59
|
const cache = {};
|
|
60
60
|
return (address, abi, provider) => {
|
|
@@ -481,6 +481,9 @@ export class Curve {
|
|
|
481
481
|
this.constants.STABLE_FACTORY_CONSTANTS = (_k = STABLE_FACTORY_CONSTANTS[this.chainId]) !== null && _k !== void 0 ? _k : {};
|
|
482
482
|
this.constants.CRYPTO_FACTORY_CONSTANTS = (_l = CRYPTO_FACTORY_CONSTANTS[this.chainId]) !== null && _l !== void 0 ? _l : {};
|
|
483
483
|
}
|
|
484
|
+
if (this.chainId === 5000) {
|
|
485
|
+
this.constantOptions = {};
|
|
486
|
+
}
|
|
484
487
|
this.multicallProvider = new MulticallProvider(this.chainId, this.provider);
|
|
485
488
|
if (this.signer) {
|
|
486
489
|
try {
|
package/lib/external-api.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { ICurveLiteNetwork, IDaoProposal, IDaoProposalListItem, IDict, IExtended
|
|
|
3
3
|
export declare const uncached_getAllPoolsFromApi: (network: INetworkName, isLiteChain: boolean) => Promise<Record<IPoolType, IExtendedPoolDataFromApi>>;
|
|
4
4
|
export declare const createUsdPricesDict: (allTypesExtendedPoolData: IExtendedPoolDataFromApi[]) => IDict<number>;
|
|
5
5
|
export declare const createCrvApyDict: (allTypesExtendedPoolData: IExtendedPoolDataFromApi[]) => IDict<[number, number]>;
|
|
6
|
+
export declare const _getSubgraphData: ((network: INetworkName) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: INetworkName) => Promise<IVolumeAndAPYs>>;
|
|
6
7
|
export declare const _getVolumes: ((network: string) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: string) => Promise<IVolumeAndAPYs>>;
|
|
8
|
+
export declare const _getFactoryAPYs: ((network: string) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: string) => Promise<IVolumeAndAPYs>>;
|
|
7
9
|
export declare const _getAllGauges: (() => Promise<IDict<IGaugesDataFromApi>>) & memoize.Memoized<() => Promise<IDict<IGaugesDataFromApi>>>;
|
|
8
10
|
export declare const _getAllGaugesFormatted: (() => Promise<IDict<any>>) & memoize.Memoized<() => Promise<IDict<any>>>;
|
|
9
11
|
export declare const _getHiddenPools: ((isLiteChain: boolean) => Promise<IDict<string[]>>) & memoize.Memoized<(isLiteChain: boolean) => Promise<IDict<string[]>>>;
|
package/lib/external-api.js
CHANGED
|
@@ -107,6 +107,25 @@ export const createCrvApyDict = (allTypesExtendedPoolData) => {
|
|
|
107
107
|
}
|
|
108
108
|
return apyDict;
|
|
109
109
|
};
|
|
110
|
+
export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
var _a, _b, _c;
|
|
112
|
+
const data = yield fetchData(`https://api.curve.finance/api/getSubgraphData/${network}`);
|
|
113
|
+
const poolsData = data.poolList.map((data) => ({
|
|
114
|
+
address: data.address,
|
|
115
|
+
volumeUSD: data.volumeUSD,
|
|
116
|
+
day: data.latestDailyApy,
|
|
117
|
+
week: data.latestWeeklyApy,
|
|
118
|
+
}));
|
|
119
|
+
return {
|
|
120
|
+
poolsData: poolsData,
|
|
121
|
+
totalVolume: (_a = data.totalVolume) !== null && _a !== void 0 ? _a : 0,
|
|
122
|
+
cryptoVolume: (_b = data.cryptoVolume) !== null && _b !== void 0 ? _b : 0,
|
|
123
|
+
cryptoShare: (_c = data.cryptoShare) !== null && _c !== void 0 ? _c : 0,
|
|
124
|
+
};
|
|
125
|
+
}), {
|
|
126
|
+
promise: true,
|
|
127
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
128
|
+
});
|
|
110
129
|
export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
130
|
var _a, _b, _c;
|
|
112
131
|
const { pools, totalVolumes } = yield fetchData(`https://api.curve.finance/api/getVolumes/${network}`);
|
|
@@ -126,6 +145,28 @@ export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0
|
|
|
126
145
|
promise: true,
|
|
127
146
|
maxAge: 5 * 60 * 1000, // 5m
|
|
128
147
|
});
|
|
148
|
+
export const _getFactoryAPYs = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
+
const [stableData, cryptoData] = yield Promise.all(['stable', 'crypto'].map((type) => fetchData(`https://api.curve.finance/api/getFactoryAPYs/${network}/${type}`)));
|
|
150
|
+
const stableVolume = stableData.totalVolumeUsd || stableData.totalVolume || 0;
|
|
151
|
+
const cryptoVolume = cryptoData.totalVolumeUsd || cryptoData.totalVolume || 0;
|
|
152
|
+
return {
|
|
153
|
+
poolsData: [...stableData.poolDetails, ...cryptoData.poolDetails].map((item) => {
|
|
154
|
+
var _a, _b, _c;
|
|
155
|
+
return ({
|
|
156
|
+
address: item.poolAddress,
|
|
157
|
+
volumeUSD: (_a = item.totalVolumeUsd) !== null && _a !== void 0 ? _a : 0,
|
|
158
|
+
day: (_b = item.apy) !== null && _b !== void 0 ? _b : 0,
|
|
159
|
+
week: ((_c = item.apy) !== null && _c !== void 0 ? _c : 0) * 7, // Because api does not return week apy
|
|
160
|
+
});
|
|
161
|
+
}),
|
|
162
|
+
totalVolume: stableVolume + cryptoVolume,
|
|
163
|
+
cryptoVolume,
|
|
164
|
+
cryptoShare: 100 * cryptoVolume / (stableVolume + cryptoVolume),
|
|
165
|
+
};
|
|
166
|
+
}), {
|
|
167
|
+
promise: true,
|
|
168
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
169
|
+
});
|
|
129
170
|
export const _getAllGauges = memoize(() => fetchData(`https://api.curve.finance/api/getAllGauges`), {
|
|
130
171
|
promise: true,
|
|
131
172
|
maxAge: 5 * 60 * 1000, // 5m
|
|
@@ -591,6 +591,8 @@ export class PoolTemplate extends CorePool {
|
|
|
591
591
|
return checkVyperVulnerability(this.curve.chainId, this.id, this.implementation);
|
|
592
592
|
}
|
|
593
593
|
rewardsOnly() {
|
|
594
|
+
if (this.curve.chainId === 2222 || this.curve.chainId === 324)
|
|
595
|
+
return true; // TODO remove this for Kava and ZkSync
|
|
594
596
|
if (this.gauge.address === this.curve.constants.ZERO_ADDRESS)
|
|
595
597
|
throw Error(`${this.name} doesn't have gauge`);
|
|
596
598
|
return !findAbiFunction(this.curve.contracts[this.gauge.address].abi, 'inflation_rate')
|
|
@@ -134,7 +134,7 @@ export class StatsPool {
|
|
|
134
134
|
});
|
|
135
135
|
this.volume = () => __awaiter(this, void 0, void 0, function* () {
|
|
136
136
|
const curve = this.pool.curve;
|
|
137
|
-
if (curve.isLiteChain) {
|
|
137
|
+
if (curve.isLiteChain && curve.chainId !== 146) {
|
|
138
138
|
throw Error('This method is not supported for the lite version');
|
|
139
139
|
}
|
|
140
140
|
const network = curve.constants.NETWORK_NAME;
|
|
@@ -147,7 +147,7 @@ export class StatsPool {
|
|
|
147
147
|
});
|
|
148
148
|
this.baseApy = () => __awaiter(this, void 0, void 0, function* () {
|
|
149
149
|
const curve = this.pool.curve;
|
|
150
|
-
if (curve.isLiteChain) {
|
|
150
|
+
if (curve.isLiteChain && curve.chainId !== 146) {
|
|
151
151
|
throw Error('baseApy is not supported for the lite version');
|
|
152
152
|
}
|
|
153
153
|
const network = curve.constants.NETWORK_NAME;
|
package/lib/pools/utils.js
CHANGED
|
@@ -94,7 +94,7 @@ function _getUserClaimable(pools, address, useCache) {
|
|
|
94
94
|
const hasCrvReward = [];
|
|
95
95
|
for (const poolId of poolsToFetch) {
|
|
96
96
|
const pool = getPool.call(this, poolId);
|
|
97
|
-
if (pool.gauge.address === this.constants.ZERO_ADDRESS) {
|
|
97
|
+
if (this.chainId === 324 || this.chainId === 2222 || pool.gauge.address === this.constants.ZERO_ADDRESS) { // TODO remove this for ZkSync and Kava
|
|
98
98
|
hasCrvReward.push(false);
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
@@ -227,7 +227,7 @@ function _getUserClaimableUseApi(pools, address, useCache) {
|
|
|
227
227
|
const hasCrvReward = [];
|
|
228
228
|
for (const poolId of poolsToFetch) {
|
|
229
229
|
const pool = getPool.call(this, poolId);
|
|
230
|
-
if (pool.gauge.address === this.constants.ZERO_ADDRESS) {
|
|
230
|
+
if (this.chainId === 324 || this.chainId === 2222 || pool.gauge.address === this.constants.ZERO_ADDRESS) { // TODO remove this for ZkSync and Kava
|
|
231
231
|
hasCrvReward.push(false);
|
|
232
232
|
continue;
|
|
233
233
|
}
|
|
@@ -383,6 +383,11 @@ export const checkVyperVulnerability = (chainId, poolId, implementation) => {
|
|
|
383
383
|
"0xAAe75FAebCae43b9d541Fd875622BE48D9B4f5D0",
|
|
384
384
|
"0x89287c32c2CAC1C76227F6d300B2DBbab6b75C08",
|
|
385
385
|
].map((a) => a.toLowerCase()),
|
|
386
|
+
43114: [
|
|
387
|
+
"0x64448B78561690B70E17CBE8029a3e5c1bB7136e",
|
|
388
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc",
|
|
389
|
+
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410",
|
|
390
|
+
].map((a) => a.toLowerCase()),
|
|
386
391
|
};
|
|
387
392
|
const implementations = (_a = vulnerableImplementations[chainId]) !== null && _a !== void 0 ? _a : [];
|
|
388
393
|
return implementations.includes((_b = implementation === null || implementation === void 0 ? void 0 : implementation.toLowerCase()) !== null && _b !== void 0 ? _b : "");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export function routeGraphWorker() {
|
|
2
2
|
const GRAPH_MAX_EDGES = 3;
|
|
3
|
+
const CELO_CHAIN_ID = 42220;
|
|
3
4
|
const ARC_CHAIN_ID = 5042; // native USDC is the same asset as its ERC-20 interface
|
|
4
5
|
// Pools excluded from router
|
|
5
6
|
const EXCLUDED_POOLS_FROM_ROUTER = {
|
|
@@ -10,8 +11,8 @@ export function routeGraphWorker() {
|
|
|
10
11
|
const routerGraph = {};
|
|
11
12
|
// Pool addresses we don't want to index when building routes
|
|
12
13
|
const blacklistedPools = new Set((blacklist !== null && blacklist !== void 0 ? blacklist : []).map((a) => a.toLowerCase()));
|
|
13
|
-
// ETH <-> WETH (exclude Arc — native USDC = ERC-20 USDC)
|
|
14
|
-
if (chainId !== ARC_CHAIN_ID) {
|
|
14
|
+
// ETH <-> WETH (exclude Celo, Arc — native USDC = ERC-20 USDC)
|
|
15
|
+
if (chainId !== CELO_CHAIN_ID && chainId !== ARC_CHAIN_ID) {
|
|
15
16
|
const wrapperAddress = constants.NATIVE_TOKEN.wrapperAddress || constants.NATIVE_TOKEN.wrappedAddress;
|
|
16
17
|
routerGraph[constants.NATIVE_TOKEN.address] = {};
|
|
17
18
|
routerGraph[constants.NATIVE_TOKEN.address][constants.NATIVE_TOKEN.wrappedAddress] = [{
|
|
@@ -246,6 +247,68 @@ export function routeGraphWorker() {
|
|
|
246
247
|
tvl: Infinity,
|
|
247
248
|
}];
|
|
248
249
|
}
|
|
250
|
+
// svZCHF <-> ZCHF (Ethereum only)
|
|
251
|
+
if (chainId === 1) {
|
|
252
|
+
routerGraph[constants.COINS.zchf] = {};
|
|
253
|
+
routerGraph[constants.COINS.zchf][constants.COINS.svzchf] = [{
|
|
254
|
+
poolId: "svZCHF wrapper",
|
|
255
|
+
swapAddress: constants.COINS.svzchf,
|
|
256
|
+
inputCoinAddress: constants.COINS.zchf,
|
|
257
|
+
outputCoinAddress: constants.COINS.svzchf,
|
|
258
|
+
swapParams: [0, 1, 9, 0, 0],
|
|
259
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
260
|
+
basePool: constants.ZERO_ADDRESS,
|
|
261
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
262
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
263
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
264
|
+
tvl: Infinity,
|
|
265
|
+
}];
|
|
266
|
+
routerGraph[constants.COINS.svzchf] = {};
|
|
267
|
+
routerGraph[constants.COINS.svzchf][constants.COINS.zchf] = [{
|
|
268
|
+
poolId: "svZCHF wrapper",
|
|
269
|
+
swapAddress: constants.COINS.svzchf,
|
|
270
|
+
inputCoinAddress: constants.COINS.svzchf,
|
|
271
|
+
outputCoinAddress: constants.COINS.zchf,
|
|
272
|
+
swapParams: [1, 0, 9, 0, 0],
|
|
273
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
274
|
+
basePool: constants.ZERO_ADDRESS,
|
|
275
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
276
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
277
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
278
|
+
tvl: Infinity,
|
|
279
|
+
}];
|
|
280
|
+
}
|
|
281
|
+
// syrupUSDC <-> USDC (Ethereum only)
|
|
282
|
+
if (chainId === 1) {
|
|
283
|
+
routerGraph[constants.COINS.usdc] = {};
|
|
284
|
+
routerGraph[constants.COINS.usdc][constants.COINS.syrupusdc] = [{
|
|
285
|
+
poolId: "syrupUSDC wrapper",
|
|
286
|
+
swapAddress: constants.COINS.syrupusdc,
|
|
287
|
+
inputCoinAddress: constants.COINS.usdc,
|
|
288
|
+
outputCoinAddress: constants.COINS.syrupusdc,
|
|
289
|
+
swapParams: [0, 1, 9, 0, 0],
|
|
290
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
291
|
+
basePool: constants.ZERO_ADDRESS,
|
|
292
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
293
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
294
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
295
|
+
tvl: Infinity,
|
|
296
|
+
}];
|
|
297
|
+
routerGraph[constants.COINS.syrupusdc] = {};
|
|
298
|
+
routerGraph[constants.COINS.syrupusdc][constants.COINS.usdc] = [{
|
|
299
|
+
poolId: "syrupUSDC wrapper",
|
|
300
|
+
swapAddress: constants.COINS.syrupusdc,
|
|
301
|
+
inputCoinAddress: constants.COINS.syrupusdc,
|
|
302
|
+
outputCoinAddress: constants.COINS.usdc,
|
|
303
|
+
swapParams: [1, 0, 9, 0, 0],
|
|
304
|
+
poolAddress: constants.ZERO_ADDRESS,
|
|
305
|
+
basePool: constants.ZERO_ADDRESS,
|
|
306
|
+
baseToken: constants.ZERO_ADDRESS,
|
|
307
|
+
secondBasePool: constants.ZERO_ADDRESS,
|
|
308
|
+
secondBaseToken: constants.ZERO_ADDRESS,
|
|
309
|
+
tvl: Infinity,
|
|
310
|
+
}];
|
|
311
|
+
}
|
|
249
312
|
// USDe -> sUSDe (Ethereum only)
|
|
250
313
|
if (chainId === 1) {
|
|
251
314
|
routerGraph[constants.COINS.usde] = {};
|
package/lib/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Contract, ethers } from 'ethers';
|
|
11
11
|
import { Contract as MulticallContract } from "@curvefi/ethcall";
|
|
12
12
|
import BigNumber from 'bignumber.js';
|
|
13
|
-
import { _getCurveLiteNetworks, _getLiteNetworksData, _getVolumes, } from "./external-api.js";
|
|
13
|
+
import { _getCurveLiteNetworks, _getFactoryAPYs, _getLiteNetworksData, _getSubgraphData, _getVolumes, } from "./external-api.js";
|
|
14
14
|
import { _getAllPoolsFromApi, _getUsdPricesFromApi } from "./cached.js";
|
|
15
15
|
import ERC20Abi from './constants/abis/ERC20.json' with { type: 'json' };
|
|
16
16
|
import { L2Networks } from './constants/L2Networks.js';
|
|
@@ -354,10 +354,19 @@ export function _getUsdRate(assetId) {
|
|
|
354
354
|
56: "binance-smart-chain",
|
|
355
355
|
100: 'xdai',
|
|
356
356
|
137: 'polygon-pos',
|
|
357
|
+
146: 'sonic',
|
|
358
|
+
196: 'x-layer',
|
|
357
359
|
252: 'fraxtal',
|
|
360
|
+
324: 'zksync',
|
|
358
361
|
999: 'hyperliquid',
|
|
362
|
+
1284: 'moonbeam',
|
|
363
|
+
2222: 'kava',
|
|
364
|
+
5000: 'mantle',
|
|
359
365
|
8453: 'base',
|
|
366
|
+
42220: 'celo',
|
|
367
|
+
43114: 'avalanche',
|
|
360
368
|
42161: 'arbitrum-one',
|
|
369
|
+
1313161554: 'aurora',
|
|
361
370
|
}[this.chainId];
|
|
362
371
|
const nativeTokenName = this.isLiteChain ? (_b = (_a = this.constants) === null || _a === void 0 ? void 0 : _a.API_CONSTANTS) === null || _b === void 0 ? void 0 : _b.nativeTokenName : {
|
|
363
372
|
1: 'ethereum',
|
|
@@ -365,10 +374,19 @@ export function _getUsdRate(assetId) {
|
|
|
365
374
|
56: 'binancecoin',
|
|
366
375
|
100: 'xdai',
|
|
367
376
|
137: 'matic-network',
|
|
377
|
+
146: 'sonic-3',
|
|
378
|
+
196: 'okb',
|
|
368
379
|
252: 'frax-share',
|
|
380
|
+
324: 'ethereum',
|
|
381
|
+
1284: 'moonbeam',
|
|
369
382
|
999: 'hyperliquid',
|
|
383
|
+
2222: 'kava',
|
|
384
|
+
5000: 'mantle',
|
|
370
385
|
8453: 'ethereum',
|
|
386
|
+
42220: 'celo',
|
|
387
|
+
43114: 'avalanche-2',
|
|
371
388
|
42161: 'ethereum',
|
|
389
|
+
1313161554: 'ethereum',
|
|
372
390
|
}[this.chainId];
|
|
373
391
|
if (chainName === undefined) {
|
|
374
392
|
throw Error('curve object is not initialized');
|
|
@@ -490,6 +508,15 @@ export function getGasPriceFromL2() {
|
|
|
490
508
|
if (this.chainId === 42161) {
|
|
491
509
|
return yield getBaseFeeByLastBlock.call(this);
|
|
492
510
|
}
|
|
511
|
+
if (this.chainId === 196) {
|
|
512
|
+
return yield getGasPrice.call(this); // gwei
|
|
513
|
+
}
|
|
514
|
+
if (this.chainId === 324) {
|
|
515
|
+
return yield getGasPrice.call(this); // gwei
|
|
516
|
+
}
|
|
517
|
+
if (this.chainId === 5000) {
|
|
518
|
+
return yield getGasPrice.call(this); // gwei
|
|
519
|
+
}
|
|
493
520
|
if (L2Networks.includes(this.chainId)) {
|
|
494
521
|
const gasPrice = yield this.contracts[this.constants.ALIASES.gas_oracle_blob].contract.gasPrice({ "gasPrice": "0x2000000" });
|
|
495
522
|
return Number(gasPrice);
|
|
@@ -508,6 +535,25 @@ export function getGasInfoForL2() {
|
|
|
508
535
|
maxPriorityFeePerGas: 0.01,
|
|
509
536
|
};
|
|
510
537
|
}
|
|
538
|
+
else if (this.chainId === 196) {
|
|
539
|
+
const gasPrice = yield getGasPrice.call(this);
|
|
540
|
+
return {
|
|
541
|
+
gasPrice,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
else if (this.chainId === 324) {
|
|
545
|
+
const gasPrice = yield getGasPrice.call(this);
|
|
546
|
+
return {
|
|
547
|
+
gasPrice,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
else if (this.chainId === 5000) {
|
|
551
|
+
const baseFee = yield getBaseFeeByLastBlock.call(this);
|
|
552
|
+
return {
|
|
553
|
+
maxFeePerGas: Number(((baseFee * 1.1) + 0.01).toFixed(2)),
|
|
554
|
+
maxPriorityFeePerGas: 0.01,
|
|
555
|
+
};
|
|
556
|
+
}
|
|
511
557
|
else {
|
|
512
558
|
throw Error("This method exists only for L2 networks");
|
|
513
559
|
}
|
|
@@ -629,18 +675,24 @@ export function getTVL() {
|
|
|
629
675
|
}
|
|
630
676
|
export function getVolumeApiController(network) {
|
|
631
677
|
return __awaiter(this, void 0, void 0, function* () {
|
|
632
|
-
if (this.isLiteChain) {
|
|
678
|
+
if (this.isLiteChain && this.chainId !== 146) {
|
|
633
679
|
throw Error('This method is not supported for the lite version');
|
|
634
680
|
}
|
|
635
681
|
if (volumeNetworks.getVolumes.includes(this.chainId)) {
|
|
636
682
|
return yield _getVolumes(network);
|
|
637
683
|
}
|
|
684
|
+
if (volumeNetworks.getFactoryAPYs.includes(this.chainId)) {
|
|
685
|
+
return yield _getFactoryAPYs(network);
|
|
686
|
+
}
|
|
687
|
+
if (volumeNetworks.getSubgraphData.includes(this.chainId)) {
|
|
688
|
+
return yield _getSubgraphData(network);
|
|
689
|
+
}
|
|
638
690
|
throw Error(`Can't get volume for network: ${network}`);
|
|
639
691
|
});
|
|
640
692
|
}
|
|
641
693
|
export function getVolume() {
|
|
642
694
|
return __awaiter(this, arguments, void 0, function* (chainId = this.chainId) {
|
|
643
|
-
if (this.isLiteChain) {
|
|
695
|
+
if (this.isLiteChain && this.chainId !== 146) {
|
|
644
696
|
throw Error('This method is not supported for the lite version');
|
|
645
697
|
}
|
|
646
698
|
const networkConstants = yield getNetworkConstants.call(this, chainId);
|