Fix asserts for nullable values in uni-info-watcher mapping code (#320)

This commit is contained in:
prathamesh0 2021-12-17 11:57:32 +05:30 committed by GitHub
parent cfd293f11b
commit 01fa6e2184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -904,7 +904,8 @@ export class Indexer implements IndexerInterface {
assert(token0 && token1, 'Pool tokens not found.');
const oldTick = pool.tick;
assert(oldTick);
// Check that the tick value is not null (can be zero).
assert(oldTick !== null);
// Amounts - 0/1 are token deltas. Can be positive or negative.
const amount0 = convertTokenToDecimal(BigInt(swapEvent.amount0), BigInt(token0.decimals));
@ -1098,7 +1099,9 @@ export class Indexer implements IndexerInterface {
// Update inner vars of current or crossed ticks.
const newTick = pool.tick;
assert(newTick);
// Check that the tick value is not null (can be zero).
assert(newTick !== null);
const tickSpacing = feeTierToTickSpacing(pool.feeTier);
const modulo = newTick % tickSpacing;