Skip to content

Commit

Permalink
Merge pull request #341 from curvefi/fix/fixed-x-layer-fetch
Browse files Browse the repository at this point in the history
fix: fixed x-layer fetch useApi = false
  • Loading branch information
fedorovdg authored May 22, 2024
2 parents 0565942 + 48e2f2d commit 8989889
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.58.10",
"version": "2.58.11",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
6 changes: 3 additions & 3 deletions src/curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ class Curve implements ICurve {
}

fetchFactoryPools = async (useApi = true): Promise<void> => {
if ([252, 1313161554].includes(this.chainId)) return;
if ([196, 252, 1313161554].includes(this.chainId)) return;

if (useApi) {
this.constants.FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory"));
Expand Down Expand Up @@ -886,7 +886,7 @@ class Curve implements ICurve {
}

fetchNewFactoryPools = async (): Promise<string[]> => {
if ([252,1313161554].includes(this.chainId)) return [];
if ([196,252,1313161554].includes(this.chainId)) return [];

const currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
Expand Down Expand Up @@ -944,7 +944,7 @@ class Curve implements ICurve {
}

fetchRecentlyDeployedFactoryPool = async (poolAddress: string): Promise<string> => {
if ([252,1313161554].includes(this.chainId)) return '';
if ([196,252,1313161554].includes(this.chainId)) return '';

const poolData = lowerCasePoolDataAddresses(await getFactoryPoolData.call(this, 0, poolAddress));
this.constants.FACTORY_POOLS_DATA = { ...this.constants.FACTORY_POOLS_DATA, ...poolData };
Expand Down
8 changes: 8 additions & 0 deletions src/factory/constants-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const lpTokenBasePoolIdDictBsc: IDict<string> = lowerCaseKeys({});

export const lpTokenBasePoolIdDictFraxtal: IDict<string> = lowerCaseKeys({});

export const lpTokenBasePoolIdDictXLayer: IDict<string> = lowerCaseKeys({});

export const basePoolIdZapDictEthereum: IDict<{ address: string, ABI: any }> = {
'3pool': {
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
Expand Down Expand Up @@ -80,6 +82,8 @@ export const basePoolIdZapDictBsc: IDict<{ address: string, ABI: any }> = {};

export const basePoolIdZapDictFraxtal: IDict<{ address: string, ABI: any }> = {};

export const basePoolIdZapDictXLayer: IDict<{ address: string, ABI: any }> = {};

export const CRYPTO_FACTORY_CONSTANTS: { [index: number]: { lpTokenBasePoolIdDict: IDict<string>, basePoolIdZapDict: IDict<{ address: string, ABI: any }> } } = {
1: { // ETH
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictEthereum,
Expand All @@ -101,6 +105,10 @@ export const CRYPTO_FACTORY_CONSTANTS: { [index: number]: { lpTokenBasePoolIdDic
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictPolygon,
basePoolIdZapDict: basePoolIdZapDictPolygon,
},
196: { // X-LAYER
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictXLayer,
basePoolIdZapDict: basePoolIdZapDictXLayer,
},
250: { // FANTOM
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictFantom,
basePoolIdZapDict: basePoolIdZapDictFantom,
Expand Down

0 comments on commit 8989889

Please sign in to comment.