Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BACK-1274: Cache invalidation on pool creation (bug with local state) #523

Merged
merged 6 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.37.3",
"version": "2.37.4-cache-invalidation-fix.2",
"main": "build/index.js",
"types": "build/index.d.ts",
"repository": "https://github.com/paraswap/paraswap-dex-lib",
Expand Down
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
Loading