@curvefi/api 2.69.9 → 2.69.11
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/chainIds.d.ts +0 -1
- package/lib/constants/chainIds.js +0 -1
- package/lib/constants/coins/index.d.ts +1 -10
- package/lib/constants/coins/index.js +1 -10
- package/lib/constants/factory/crypto.d.ts +0 -45
- package/lib/constants/factory/crypto.js +0 -72
- package/lib/constants/factory/stable.d.ts +0 -9
- package/lib/constants/factory/stable.js +0 -119
- package/lib/constants/network_constants.js +2 -258
- package/lib/constants/pools/index.d.ts +1 -10
- package/lib/constants/pools/index.js +1 -10
- package/lib/constants/rewardNetworks.js +1 -1
- package/lib/constants/volumeNetworks.d.ts +0 -2
- package/lib/constants/volumeNetworks.js +1 -3
- package/lib/curve.js +1 -4
- package/lib/external-api.d.ts +0 -2
- package/lib/external-api.js +0 -41
- package/lib/pools/PoolTemplate.d.ts +1 -0
- package/lib/pools/PoolTemplate.js +17 -3
- package/lib/pools/mixins/swapWrappedMixins.js +2 -0
- package/lib/pools/mixins/withdrawExpectedMixins.js +8 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -0
- package/lib/pools/subClasses/statsPool.js +2 -2
- package/lib/pools/utils.js +2 -7
- package/lib/route-graph.worker.js +2 -3
- package/lib/utils.js +3 -55
- package/package.json +1 -1
- package/lib/constants/abis/avaxcrypto/swap.json +0 -1195
- package/lib/constants/abis/avaxcrypto/zap.json +0 -250
- package/lib/constants/abis/factory-v2/MetaUSDGeist.json +0 -932
- package/lib/constants/coins/aurora.d.ts +0 -3
- package/lib/constants/coins/aurora.js +0 -9
- package/lib/constants/coins/avalanche.d.ts +0 -4
- package/lib/constants/coins/avalanche.js +0 -34
- package/lib/constants/coins/celo.d.ts +0 -3
- package/lib/constants/coins/celo.js +0 -9
- package/lib/constants/coins/kava.d.ts +0 -3
- package/lib/constants/coins/kava.js +0 -9
- package/lib/constants/coins/mantle.d.ts +0 -2
- package/lib/constants/coins/mantle.js +0 -5
- package/lib/constants/coins/moonbeam.d.ts +0 -3
- package/lib/constants/coins/moonbeam.js +0 -9
- package/lib/constants/coins/sonic.d.ts +0 -2
- package/lib/constants/coins/sonic.js +0 -5
- package/lib/constants/coins/xlayer.d.ts +0 -2
- package/lib/constants/coins/xlayer.js +0 -5
- package/lib/constants/coins/zksync.d.ts +0 -2
- package/lib/constants/coins/zksync.js +0 -6
- package/lib/constants/pools/aurora.d.ts +0 -2
- package/lib/constants/pools/aurora.js +0 -31
- package/lib/constants/pools/avalanche.d.ts +0 -2
- package/lib/constants/pools/avalanche.js +0 -166
- package/lib/constants/pools/celo.d.ts +0 -2
- package/lib/constants/pools/celo.js +0 -2
- package/lib/constants/pools/kava.d.ts +0 -2
- package/lib/constants/pools/kava.js +0 -2
- package/lib/constants/pools/mantle.d.ts +0 -2
- package/lib/constants/pools/mantle.js +0 -2
- package/lib/constants/pools/moonbeam.d.ts +0 -2
- package/lib/constants/pools/moonbeam.js +0 -31
- package/lib/constants/pools/sonic.d.ts +0 -2
- package/lib/constants/pools/sonic.js +0 -2
- package/lib/constants/pools/xlayer.d.ts +0 -2
- package/lib/constants/pools/xlayer.js +0 -2
- package/lib/constants/pools/zksync.d.ts +0 -2
- package/lib/constants/pools/zksync.js +0 -2
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 (
|
|
97
|
+
if (pool.gauge.address === this.constants.ZERO_ADDRESS) {
|
|
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 (
|
|
230
|
+
if (pool.gauge.address === this.constants.ZERO_ADDRESS) {
|
|
231
231
|
hasCrvReward.push(false);
|
|
232
232
|
continue;
|
|
233
233
|
}
|
|
@@ -383,11 +383,6 @@ 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()),
|
|
391
386
|
};
|
|
392
387
|
const implementations = (_a = vulnerableImplementations[chainId]) !== null && _a !== void 0 ? _a : [];
|
|
393
388
|
return implementations.includes((_b = implementation === null || implementation === void 0 ? void 0 : implementation.toLowerCase()) !== null && _b !== void 0 ? _b : "");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export function routeGraphWorker() {
|
|
2
2
|
const GRAPH_MAX_EDGES = 3;
|
|
3
|
-
const CELO_CHAIN_ID = 42220;
|
|
4
3
|
const ARC_CHAIN_ID = 5042; // native USDC is the same asset as its ERC-20 interface
|
|
5
4
|
// Pools excluded from router
|
|
6
5
|
const EXCLUDED_POOLS_FROM_ROUTER = {
|
|
@@ -11,8 +10,8 @@ export function routeGraphWorker() {
|
|
|
11
10
|
const routerGraph = {};
|
|
12
11
|
// Pool addresses we don't want to index when building routes
|
|
13
12
|
const blacklistedPools = new Set((blacklist !== null && blacklist !== void 0 ? blacklist : []).map((a) => a.toLowerCase()));
|
|
14
|
-
// ETH <-> WETH (exclude
|
|
15
|
-
if (chainId !==
|
|
13
|
+
// ETH <-> WETH (exclude Arc — native USDC = ERC-20 USDC)
|
|
14
|
+
if (chainId !== ARC_CHAIN_ID) {
|
|
16
15
|
const wrapperAddress = constants.NATIVE_TOKEN.wrapperAddress || constants.NATIVE_TOKEN.wrappedAddress;
|
|
17
16
|
routerGraph[constants.NATIVE_TOKEN.address] = {};
|
|
18
17
|
routerGraph[constants.NATIVE_TOKEN.address][constants.NATIVE_TOKEN.wrappedAddress] = [{
|
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,
|
|
13
|
+
import { _getCurveLiteNetworks, _getLiteNetworksData, _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,19 +354,10 @@ 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',
|
|
359
357
|
252: 'fraxtal',
|
|
360
|
-
324: 'zksync',
|
|
361
358
|
999: 'hyperliquid',
|
|
362
|
-
1284: 'moonbeam',
|
|
363
|
-
2222: 'kava',
|
|
364
|
-
5000: 'mantle',
|
|
365
359
|
8453: 'base',
|
|
366
|
-
42220: 'celo',
|
|
367
|
-
43114: 'avalanche',
|
|
368
360
|
42161: 'arbitrum-one',
|
|
369
|
-
1313161554: 'aurora',
|
|
370
361
|
}[this.chainId];
|
|
371
362
|
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 : {
|
|
372
363
|
1: 'ethereum',
|
|
@@ -374,19 +365,10 @@ export function _getUsdRate(assetId) {
|
|
|
374
365
|
56: 'binancecoin',
|
|
375
366
|
100: 'xdai',
|
|
376
367
|
137: 'matic-network',
|
|
377
|
-
146: 'sonic-3',
|
|
378
|
-
196: 'okb',
|
|
379
368
|
252: 'frax-share',
|
|
380
|
-
324: 'ethereum',
|
|
381
|
-
1284: 'moonbeam',
|
|
382
369
|
999: 'hyperliquid',
|
|
383
|
-
2222: 'kava',
|
|
384
|
-
5000: 'mantle',
|
|
385
370
|
8453: 'ethereum',
|
|
386
|
-
42220: 'celo',
|
|
387
|
-
43114: 'avalanche-2',
|
|
388
371
|
42161: 'ethereum',
|
|
389
|
-
1313161554: 'ethereum',
|
|
390
372
|
}[this.chainId];
|
|
391
373
|
if (chainName === undefined) {
|
|
392
374
|
throw Error('curve object is not initialized');
|
|
@@ -508,15 +490,6 @@ export function getGasPriceFromL2() {
|
|
|
508
490
|
if (this.chainId === 42161) {
|
|
509
491
|
return yield getBaseFeeByLastBlock.call(this);
|
|
510
492
|
}
|
|
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
|
-
}
|
|
520
493
|
if (L2Networks.includes(this.chainId)) {
|
|
521
494
|
const gasPrice = yield this.contracts[this.constants.ALIASES.gas_oracle_blob].contract.gasPrice({ "gasPrice": "0x2000000" });
|
|
522
495
|
return Number(gasPrice);
|
|
@@ -535,25 +508,6 @@ export function getGasInfoForL2() {
|
|
|
535
508
|
maxPriorityFeePerGas: 0.01,
|
|
536
509
|
};
|
|
537
510
|
}
|
|
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
|
-
}
|
|
557
511
|
else {
|
|
558
512
|
throw Error("This method exists only for L2 networks");
|
|
559
513
|
}
|
|
@@ -675,24 +629,18 @@ export function getTVL() {
|
|
|
675
629
|
}
|
|
676
630
|
export function getVolumeApiController(network) {
|
|
677
631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
678
|
-
if (this.isLiteChain
|
|
632
|
+
if (this.isLiteChain) {
|
|
679
633
|
throw Error('This method is not supported for the lite version');
|
|
680
634
|
}
|
|
681
635
|
if (volumeNetworks.getVolumes.includes(this.chainId)) {
|
|
682
636
|
return yield _getVolumes(network);
|
|
683
637
|
}
|
|
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
|
-
}
|
|
690
638
|
throw Error(`Can't get volume for network: ${network}`);
|
|
691
639
|
});
|
|
692
640
|
}
|
|
693
641
|
export function getVolume() {
|
|
694
642
|
return __awaiter(this, arguments, void 0, function* (chainId = this.chainId) {
|
|
695
|
-
if (this.isLiteChain
|
|
643
|
+
if (this.isLiteChain) {
|
|
696
644
|
throw Error('This method is not supported for the lite version');
|
|
697
645
|
}
|
|
698
646
|
const networkConstants = yield getNetworkConstants.call(this, chainId);
|