Skip to content

Commit

Permalink
Merge pull request #26 from curvefi/fix/factory-spam
Browse files Browse the repository at this point in the history
Fix/factory spam
  • Loading branch information
Macket authored Mar 4, 2022
2 parents 68781ca + 30ec20c commit c65282a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 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": "1.20.0",
"version": "1.20.1",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"scripts": {
Expand Down
11 changes: 10 additions & 1 deletion src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ const basePoolAddressZapDictPolygon: DictInterface<string> = {
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(), // ren
}

const blackListPolygon: string[] = [
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
];

const blackListEthereum: string[] = [];

interface CurveInterface {
provider: ethers.providers.Web3Provider | ethers.providers.JsonRpcProvider,
multicallProvider: MulticallProvider,
Expand Down Expand Up @@ -182,7 +190,8 @@ async function getFactorySwapAddresses(this: CurveInterface): Promise<string[]>
const factorySwapAddresses: string[] = (await this.multicallProvider.all(calls) as string[]).map((addr) => addr.toLowerCase());
const swapAddresses = Object.values(this.constants.POOLS_DATA as PoolDataInterface).map((pool: PoolDataInterface) => pool.swap_address.toLowerCase());

return factorySwapAddresses.filter((addr) => !swapAddresses.includes(addr));
const blacklist = this.chainId === 137 ? blackListPolygon : blackListEthereum;
return factorySwapAddresses.filter((addr) => !swapAddresses.includes(addr) && !blacklist.includes(addr));
}

async function getFactorySwapABIs(this: CurveInterface, factorySwapAddresses: string[]): Promise<any[]> {
Expand Down

0 comments on commit c65282a

Please sign in to comment.