Skip to content

Commit

Permalink
Merge branch 'master' into aburkut/back-1809-bebop-insert-from-amount…
Browse files Browse the repository at this point in the history
…-pos
  • Loading branch information
aburkut committed Dec 26, 2024
2 parents a4e4d2d + 720e9a4 commit 6655fb3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/dex/solidly/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const SolidlyConfig: DexConfigMap<DexParams> = {
// There is no subgraph for Aerodrome
factoryAddress: '0x420DD381b31aEf6683db6B902084cB0FFECe40Da',
router: '0xDCf4EE5B700e2a5Fec458e06B763A4a3E3004494',
subgraphURL: '7uEwiKmfbRQqV8Ec9nvdKrMFVFQv5qaM271gdBvHtywj',
initCode:
'0x1a8f01f7eab324003d9388f229ea17991eee9c9d14586f429799f3656790eba0',
poolGasCost: 180 * 1000,
Expand Down
20 changes: 16 additions & 4 deletions src/dex/solidly/solidly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,23 @@ export class Solidly extends UniswapV2 {
if (!this.subgraphURL) return [];

let stableFieldKey = '';
let skipReserveCheck = false;

if (this.dexKey.toLowerCase() === 'solidly') {
stableFieldKey = 'stable';
} else if (this.dexKey.toLowerCase() !== 'solidlyv2') {
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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 => ({
Expand All @@ -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(
Expand Down

0 comments on commit 6655fb3

Please sign in to comment.