Skip to content

Commit

Permalink
Add fixes for CL pool burns. (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarid27 authored Nov 13, 2024
1 parent fc6c731 commit 2a32924
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/EventHandlers/CLPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ CLPool.Burn.handlerWithLoader({

const liquidityPoolDiff = {
reserve0:
liquidityPoolAggregator.reserve0 + tokenUpdateData.reserve0,
liquidityPoolAggregator.reserve0 - tokenUpdateData.reserve0,
reserve1:
liquidityPoolAggregator.reserve1 + tokenUpdateData.reserve1,
liquidityPoolAggregator.reserve1 - tokenUpdateData.reserve1,
totalLiquidityUSD:
liquidityPoolAggregator.totalLiquidityUSD +
liquidityPoolAggregator.totalLiquidityUSD -
tokenUpdateData.totalLiquidityUSD,
lastUpdatedTimestamp: new Date(event.block.timestamp * 1000),
};
Expand Down
8 changes: 4 additions & 4 deletions test/EventHandlers/CLPool/CLPool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ describe("CLPool Event Handlers", () => {
let eventData: any;

let expectations: any = {
amount0In: -100n * 10n ** 18n,
amount1In: -100n * 10n ** 6n,
amount0In: 100n * 10n ** 18n,
amount1In: 100n * 10n ** 6n,
totalLiquidity: 0n,
};

Expand Down Expand Up @@ -186,11 +186,11 @@ describe("CLPool Event Handlers", () => {

it("should update the reserves", () => {
expect(diff.reserve0).to.equal(
mockLiquidityPoolData.reserve0 +
mockLiquidityPoolData.reserve0 -
expectations.amount0In,
"Reserve 0 should be appropriately updated");
expect(diff.reserve1).to.equal(
mockLiquidityPoolData.reserve1 +
mockLiquidityPoolData.reserve1 -
expectations.amount1In,
"Reserve 1 should be appropriately updated");
});
Expand Down

0 comments on commit 2a32924

Please sign in to comment.