From 71849f783f39d3202d959606736d49cf4b40714d Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Wed, 17 Mar 2021 11:23:22 -0400 Subject: [PATCH] ensure holderCount is always not null --- schema.graphql | 2 ++ src/mappings/account.ts | 1 - src/mappings/token.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index 26dd059..af30a16 100644 --- a/schema.graphql +++ b/schema.graphql @@ -248,3 +248,5 @@ type PauseEvent implements TokenEvent @entity { " Transaction hash " transaction: Bytes! } + + diff --git a/src/mappings/account.ts b/src/mappings/account.ts index 0dcb033..e7b6e89 100644 --- a/src/mappings/account.ts +++ b/src/mappings/account.ts @@ -30,7 +30,6 @@ function getOrCreateAccountBalance(account: Account, token: Token): AccountBalan newBalance.account = account.id newBalance.token = token.id newBalance.amount = ZERO.toBigDecimal() - // increment token count token.holderCount = token.holderCount.plus(ONE) token.save() diff --git a/src/mappings/token.ts b/src/mappings/token.ts index 031d328..af90f9e 100644 --- a/src/mappings/token.ts +++ b/src/mappings/token.ts @@ -44,6 +44,7 @@ export function handleTransfer(event: Transfer): void { token.flags = decodeFlags(0) token.eventCount = ZERO + token.holderCount = ZERO token.burnEventCount = ZERO token.mintEventCount = ZERO token.transferEventCount = ZERO