Skip to content

Commit 4262452

Browse files
committed
Skipping snapshots when the user is null
1 parent 96bb7ed commit 4262452

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/mappings/helpers.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,26 @@ export function createLiquiditySnapshot(position: LiquidityPosition, event: Ethe
174174
let token0 = Token.load(pair.token0)
175175
let token1 = Token.load(pair.token1)
176176

177+
let user = User.load(position.user)
178+
if (user === null) {
179+
log.error(
180+
'Null user during snapshot creation. User id: '
181+
.concat(position.user)
182+
.concat(' position id: ')
183+
.concat(position.id)
184+
.concat(' tx hash: ')
185+
.concat(event.transaction.hash.toHexString())
186+
.concat(' --> SKIPPING SNAPSHOT CREATION'),
187+
[]
188+
)
189+
return
190+
}
191+
177192
// create new snapshot
178193
let id = position.id
179-
.concat("-")
194+
.concat('-')
180195
.concat(event.transaction.hash.toHexString())
181-
.concat("-")
196+
.concat('-')
182197
.concat(event.logIndex.toString())
183198
let snapshot = new LiquidityPositionSnapshot(id)
184199
snapshot.liquidityPosition = position.id

0 commit comments

Comments
 (0)