Skip to content

Commit

Permalink
Merge pull request #460 from paraswap/fix/1223-log-negative-liquidity
Browse files Browse the repository at this point in the history
BACK-1223: Add error logging for UniswapV3 like negative liquidity issues
  • Loading branch information
Verisana authored Aug 8, 2023
2 parents 1f7c07c + 0984bf8 commit 7c4c43b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
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": "2.28.1",
"version": "2.28.2",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
5 changes: 5 additions & 0 deletions src/dex/algebra/algebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
const zeroForOne = token0 === _srcAddress ? true : false;

if (state.liquidity <= 0n) {
if (state.liquidity < 0) {
this.logger.error(
`${this.dexKey}-${this.network}: ${pool.poolAddress} pool has negative liquidity: ${state.liquidity}. Find with key: ${pool.mapKey}`,
);
}
this.logger.trace(`pool have 0 liquidity`);
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions src/dex/pancakeswap-v3/pancakeswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ export class PancakeswapV3
const state = states[i];

if (state.liquidity <= 0n) {
if (state.liquidity < 0) {
this.logger.error(
`${this.dexKey}-${this.network}: ${pool.poolAddress} pool has negative liquidity: ${state.liquidity}. Find with key: ${pool.mapKey}`,
);
}
this.logger.trace(`pool have 0 liquidity`);
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions src/dex/uniswap-v3/uniswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@ export class UniswapV3
const state = states[i];

if (state.liquidity <= 0n) {
if (state.liquidity < 0) {
this.logger.error(
`${this.dexKey}-${this.network}: ${pool.poolAddress} pool has negative liquidity: ${state.liquidity}. Find with key: ${pool.mapKey}`,
);
}
this.logger.trace(`pool have 0 liquidity`);
return null;
}
Expand Down

0 comments on commit 7c4c43b

Please sign in to comment.