Skip to content

Commit

Permalink
short code
Browse files Browse the repository at this point in the history
  • Loading branch information
vuonghuuhung committed Aug 14, 2024
1 parent 5a5890a commit 98f9d47
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/oraiswap-v3/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,13 @@ export class OraiswapV3Handler {
return await Promise.all(promises);
}

public async getPairLiquidityValues(pool: PoolWithPoolKey, positionList?: Position[]): Promise<{ liquidityX: bigint; liquidityY: bigint }> {
let positions: Position[];
if (!positionList) {
const allPositions = await this.allPositions();
positions = allPositions.filter((pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key));
} else {
positions = positionList.filter((pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key));
}
public async getPairLiquidityValues(
pool: PoolWithPoolKey,
positionList?: Position[]
): Promise<{ liquidityX: bigint; liquidityY: bigint }> {
const positions = (positionList || (await this.allPositions())).filter(
(pos) => poolKeyToString(pos.pool_key) === poolKeyToString(pool.pool_key)
);

let liquidityX = 0n;
let liquidityY = 0n;
Expand Down

0 comments on commit 98f9d47

Please sign in to comment.