From 71da4671563f19965807b13990146ee29fb1d09f Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 15:18:35 +0200 Subject: [PATCH 1/6] feat: add subgraph for Aerodrome on Base --- src/dex/solidly/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dex/solidly/config.ts b/src/dex/solidly/config.ts index 574499f00..e86c34fd0 100644 --- a/src/dex/solidly/config.ts +++ b/src/dex/solidly/config.ts @@ -84,6 +84,7 @@ export const SolidlyConfig: DexConfigMap = { // There is no subgraph for Aerodrome factoryAddress: '0x420DD381b31aEf6683db6B902084cB0FFECe40Da', router: '0xDCf4EE5B700e2a5Fec458e06B763A4a3E3004494', + subgraphURL: '7uEwiKmfbRQqV8Ec9nvdKrMFVFQv5qaM271gdBvHtywj', initCode: '0x1a8f01f7eab324003d9388f229ea17991eee9c9d14586f429799f3656790eba0', poolGasCost: 180 * 1000, From 375ca73400c073d5c5d9177bacb48cd5310bd5c4 Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 15:19:28 +0200 Subject: [PATCH 2/6] 4.0.11-aerodrome.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ac38a9e8..5b7842c7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "4.0.10", + "version": "4.0.11-aerodrome.0", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", From 4fe9e26f54a13b76d52c8e68b45df2c4d8b0ebe2 Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 16:00:49 +0200 Subject: [PATCH 3/6] feat: add skipReserveCheck for aerodrome on Base --- src/dex/solidly/solidly.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/dex/solidly/solidly.ts b/src/dex/solidly/solidly.ts index 369b2b21d..f406aa957 100644 --- a/src/dex/solidly/solidly.ts +++ b/src/dex/solidly/solidly.ts @@ -445,6 +445,7 @@ export class Solidly extends UniswapV2 { if (!this.subgraphURL) return []; let stableFieldKey = ''; + let skipReserveCheck = false; if (this.dexKey.toLowerCase() === 'solidly') { stableFieldKey = 'stable'; @@ -452,8 +453,14 @@ export class Solidly extends UniswapV2 { stableFieldKey = 'isStable'; } + if (this.dexKey.toLowerCase() === 'aerodrome') { + skipReserveCheck = true; + } + const query = `query ($token: Bytes!, $count: Int) { - pools0: pairs(first: $count, orderBy: reserveUSD, orderDirection: desc, where: {token0: $token, reserve0_gt: 1, reserve1_gt: 1}) { + pools0: pairs(first: $count, orderBy: reserveUSD, orderDirection: desc, where: {token0: $token ${ + skipReserveCheck ? '' : ', reserve0_gt: 1, reserve1_gt: 1' + }}) { id ${stableFieldKey} token0 { @@ -466,7 +473,9 @@ export class Solidly extends UniswapV2 { } reserveUSD } - pools1: pairs(first: $count, orderBy: reserveUSD, orderDirection: desc, where: {token1: $token, reserve0_gt: 1, reserve1_gt: 1}) { + pools1: pairs(first: $count, orderBy: reserveUSD, orderDirection: desc, where: {token1: $token ${ + skipReserveCheck ? '' : ', reserve0_gt: 1, reserve1_gt: 1' + }}) { id ${stableFieldKey} token0 { @@ -502,7 +511,8 @@ export class Solidly extends UniswapV2 { decimals: parseInt(pool.token1.decimals), }, ], - liquidityUSD: parseFloat(pool.reserveUSD), + liquidityUSD: + parseFloat(pool.reserveUSD) || (skipReserveCheck ? 10e5 : 0), })); const pools1 = _.map(data.pools1, pool => ({ @@ -515,7 +525,8 @@ export class Solidly extends UniswapV2 { decimals: parseInt(pool.token0.decimals), }, ], - liquidityUSD: parseFloat(pool.reserveUSD), + liquidityUSD: + parseFloat(pool.reserveUSD) || (skipReserveCheck ? 10e5 : 0), })); return _.slice( From 49a9e8f76c83fae96344551ef14dab27cca2ddfb Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 16:01:23 +0200 Subject: [PATCH 4/6] 4.0.11-aerodrome.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b7842c7c..189c0e6b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "4.0.11-aerodrome.0", + "version": "4.0.11-aerodrome.1", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", From 4c6bab0af0ed73607d3a93e1b709a07bf777dbc5 Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 16:08:20 +0200 Subject: [PATCH 5/6] 4.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 189c0e6b6..2df83f3ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "4.0.11-aerodrome.1", + "version": "4.0.11", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", From e32e77d3c0b5d13a79f0f0310d85a2a19c860855 Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Thu, 26 Dec 2024 16:12:17 +0200 Subject: [PATCH 6/6] chore: add comment on skipping reserve check for Aerodrome --- src/dex/solidly/solidly.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dex/solidly/solidly.ts b/src/dex/solidly/solidly.ts index f406aa957..2721bb204 100644 --- a/src/dex/solidly/solidly.ts +++ b/src/dex/solidly/solidly.ts @@ -453,6 +453,7 @@ export class Solidly extends UniswapV2 { stableFieldKey = 'isStable'; } + // aerodrome subgraph has broken reserve and other volume fields with all 0s if (this.dexKey.toLowerCase() === 'aerodrome') { skipReserveCheck = true; }