diff --git a/package.json b/package.json index 5ac38a9e8..2df83f3ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "4.0.10", + "version": "4.0.11", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", 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, diff --git a/src/dex/solidly/solidly.ts b/src/dex/solidly/solidly.ts index 369b2b21d..2721bb204 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,15 @@ 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; + } + 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 +474,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 +512,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 +526,8 @@ export class Solidly extends UniswapV2 { decimals: parseInt(pool.token0.decimals), }, ], - liquidityUSD: parseFloat(pool.reserveUSD), + liquidityUSD: + parseFloat(pool.reserveUSD) || (skipReserveCheck ? 10e5 : 0), })); return _.slice(