Skip to content

Commit

Permalink
fix: set initial values for non nullable fields
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
  • Loading branch information
tmigone authored and juanmardefago committed Feb 16, 2023
1 parent f63fb17 commit 3daf635
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mappings/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ export function createEpoch(startBlock: i32, epochLength: i32, epochNumber: i32)
epoch.totalRewards = BigInt.fromI32(0)
epoch.totalIndexerRewards = BigInt.fromI32(0)
epoch.totalDelegatorRewards = BigInt.fromI32(0)
epoch.totalQueryFees = BigInt.fromI32(0)
epoch.taxedQueryFees = BigInt.fromI32(0)
epoch.save()
return epoch
}
Expand Down Expand Up @@ -520,6 +522,7 @@ export function createOrLoadGraphNetwork(
graphNetwork.epochLength = 0
graphNetwork.lastRunEpoch = 0
graphNetwork.lastLengthUpdateEpoch = 0
graphNetwork.lastLengthUpdateBlock = 0
if (addresses.isL1) {
graphNetwork.lastLengthUpdateBlock = blockNumber.toI32() // Use chain native block
} else {
Expand Down Expand Up @@ -552,6 +555,11 @@ export function createOrLoadGraphNetwork(
graphNetwork.minimumDisputeDeposit = BigInt.fromI32(0)
graphNetwork.fishermanRewardPercentage = 0

graphNetwork.totalGRTDeposited = BigInt.fromI32(0)
graphNetwork.totalGRTDepositedConfirmed = BigInt.fromI32(0)
graphNetwork.totalGRTWithdrawn = BigInt.fromI32(0)
graphNetwork.totalGRTWithdrawnConfirmed = BigInt.fromI32(0)

graphNetwork.save()
}
if (!addresses.isL1) {
Expand Down

0 comments on commit 3daf635

Please # to comment.