mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-23 11:39:05 +00:00
Fix asserts for nullable values in uni-info-watcher mapping code (#320)
This commit is contained in:
parent
cfd293f11b
commit
01fa6e2184
@ -904,7 +904,8 @@ export class Indexer implements IndexerInterface {
|
|||||||
assert(token0 && token1, 'Pool tokens not found.');
|
assert(token0 && token1, 'Pool tokens not found.');
|
||||||
|
|
||||||
const oldTick = pool.tick;
|
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.
|
// Amounts - 0/1 are token deltas. Can be positive or negative.
|
||||||
const amount0 = convertTokenToDecimal(BigInt(swapEvent.amount0), BigInt(token0.decimals));
|
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.
|
// Update inner vars of current or crossed ticks.
|
||||||
const newTick = pool.tick;
|
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 tickSpacing = feeTierToTickSpacing(pool.feeTier);
|
||||||
const modulo = newTick % tickSpacing;
|
const modulo = newTick % tickSpacing;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user