Skip to content

Commit

Permalink
fix: bug in deleting the pool from local state
Browse files Browse the repository at this point in the history
  • Loading branch information
JackieJoo committed Oct 9, 2023
1 parent 360a035 commit 15b7a88
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/dex/algebra/algebra-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export class AlgebraFactory extends StatefulEventSubscriber<FactoryState> {
}

async handleNewPool(event: LogDescription) {
const token0 = event.args.token0;
const token1 = event.args.token1;
const token0 = event.args.token0.toLowerCase();
const token1 = event.args.token1.toLowerCase();

await this.onPoolCreated({ token0, token1 });
}
Expand Down
2 changes: 1 addition & 1 deletion src/dex/algebra/algebra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class Algebra extends SimpleExchange implements IDex<AlgebraData> {
}) => {
const logPrefix = '[Algebra.onPoolCreatedDeleteFromNonExistingSet]';
const [_token0, _token1] = this._sortTokens(token0, token1);
const poolKey = `${_token0}_${_token1}`.toLowerCase();
const poolKey = `${_token0}_${_token1}`;

// consider doing it only from master pool for less calls to distant cache

Expand Down
4 changes: 2 additions & 2 deletions src/dex/pancakeswap-v3/pancakeswap-v3-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export class PancakeswapV3Factory extends StatefulEventSubscriber<FactoryState>
}

async handleNewPool(event: LogDescription) {
const token0 = event.args.token0;
const token1 = event.args.token1;
const token0 = event.args.token0.toLowerCase();
const token1 = event.args.token1.toLowerCase();
const fee = event.args.fee;

await this.onPoolCreated({ token0, token1, fee });
Expand Down
2 changes: 1 addition & 1 deletion src/dex/pancakeswap-v3/pancakeswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class PancakeswapV3
}) => {
const logPrefix = '[PancakeV3.onPoolCreatedDeleteFromNonExistingSet]';
const [_token0, _token1] = this._sortTokens(token0, token1);
const poolKey = `${_token0}_${_token1}_${fee}`.toLowerCase();
const poolKey = `${_token0}_${_token1}_${fee}`;

// consider doing it only from master pool for less calls to distant cache

Expand Down
4 changes: 2 additions & 2 deletions src/dex/uniswap-v3/uniswap-v3-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export class UniswapV3Factory extends StatefulEventSubscriber<FactoryState> {
}

async handleNewPool(event: LogDescription) {
const token0 = event.args.token0;
const token1 = event.args.token1;
const token0 = event.args.token0.toLowerCase();
const token1 = event.args.token1.toLowerCase();
const fee = event.args.fee;

await this.onPoolCreated({ token0, token1, fee });
Expand Down
2 changes: 1 addition & 1 deletion src/dex/uniswap-v3/uniswap-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class UniswapV3
}) => {
const logPrefix = '[UniswapV3.onPoolCreatedDeleteFromNonExistingSet]';
const [_token0, _token1] = this._sortTokens(token0, token1);
const poolKey = `${_token0}_${_token1}_${fee}`.toLowerCase();
const poolKey = `${_token0}_${_token1}_${fee}`;

// consider doing it only from master pool for less calls to distant cache

Expand Down

0 comments on commit 15b7a88

Please sign in to comment.