Skip to content

Commit

Permalink
temp: nullify uniV3 pool state
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNazarii committed Dec 5, 2024
1 parent e27d524 commit e2f78a8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/dex/uniswap-v3/uniswap-v3-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,26 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
this.poolInitCodeHash,
);
}

// todo: remove
// nullify the state for specific pool for testing purposes
async update(
logs: Readonly<Log>[],
blockHeaders: Readonly<{ [p: number]: Readonly<BlockHeader> }>,
) {
await super.update(logs, blockHeaders);

// PIRATE - WETH Mainnet UniswapV3 Pool
if (this.poolAddress === '0x7f74c86cd8ba48be647d541b3e7f5a2184a3afa4') {
const blockNumber = this.dexHelper.blockManager.getLatestBlockNumber();

// every 5 blocks on mainnet with 12s block time = every 1 min
if (!(blockNumber % 5)) {
this.logger.info(
`Nullifying state for pool ${this.poolAddress} at block ${blockNumber}`,
);
this._setState(null, blockNumber);
}
}
}
}

0 comments on commit e2f78a8

Please sign in to comment.