ensure holderCount is always not null

This commit is contained in:
Barry Gitarts 2021-03-17 11:23:22 -04:00
parent cc7d6ef42a
commit 71849f783f
3 changed files with 3 additions and 1 deletions

View File

@ -248,3 +248,5 @@ type PauseEvent implements TokenEvent @entity {
" Transaction hash "
transaction: Bytes!
}

View File

@ -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()

View File

@ -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