Skip to content

Commit

Permalink
refactor: Only return active TVL
Browse files Browse the repository at this point in the history
  • Loading branch information
Apegurus committed Apr 10, 2024
1 parent 05ed186 commit ed7e2e9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions adapters/lynex/src/sdk/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,8 @@ const getV3PositionReserves = (position: V3Position) => {
const sqrtRatioB = Math.sqrt(1.0001 ** tickUpper);
const sqrtPrice = _sqrtPrice / 2 ** 96;

// Onlye return active TVL
if (currentTick < tickLower) {
reserve0 = BigInt(
Math.floor(
liquidity * ((sqrtRatioB - sqrtRatioA) / (sqrtRatioA * sqrtRatioB))
)
);
} else if (currentTick >= tickUpper) {
reserve1 = BigInt(Math.floor(liquidity * (sqrtRatioB - sqrtRatioA)));
} else if (currentTick >= tickLower && currentTick < tickUpper) {
// Only return active TVL
if (currentTick >= tickLower && currentTick < tickUpper) {
reserve0 = BigInt(
Math.floor(
liquidity * ((sqrtRatioB - sqrtPrice) / (sqrtPrice * sqrtRatioB))
Expand Down

0 comments on commit ed7e2e9

Please sign in to comment.