diff --git a/src/mappings/helpers.ts b/src/mappings/helpers.ts index e412c867..d88e1c58 100644 --- a/src/mappings/helpers.ts +++ b/src/mappings/helpers.ts @@ -174,11 +174,26 @@ export function createLiquiditySnapshot(position: LiquidityPosition, event: Ethe let token0 = Token.load(pair.token0) let token1 = Token.load(pair.token1) + let user = User.load(position.user) + if (user === null) { + log.error( + 'Null user during snapshot creation. User id: ' + .concat(position.user) + .concat(' position id: ') + .concat(position.id) + .concat(' tx hash: ') + .concat(event.transaction.hash.toHexString()) + .concat(' --> SKIPPING SNAPSHOT CREATION'), + [] + ) + return + } + // create new snapshot let id = position.id - .concat("-") + .concat('-') .concat(event.transaction.hash.toHexString()) - .concat("-") + .concat('-') .concat(event.logIndex.toString()) let snapshot = new LiquidityPositionSnapshot(id) snapshot.liquidityPosition = position.id