remove accounts with less than 1 snt from holderCount

This commit is contained in:
Barry Gitarts 2021-03-17 16:49:21 -04:00
parent 71849f783f
commit a6242eea25
1 changed files with 3 additions and 0 deletions

View File

@ -46,6 +46,9 @@ export function increaseAccountBalance(account: Account, token: Token, amount: B
export function decreaseAccountBalance(account: Account, token: Token, amount: BigDecimal): AccountBalance { export function decreaseAccountBalance(account: Account, token: Token, amount: BigDecimal): AccountBalance {
let balance = getOrCreateAccountBalance(account, token) let balance = getOrCreateAccountBalance(account, token)
balance.amount = balance.amount.minus(amount) balance.amount = balance.amount.minus(amount)
if (balance.amount.lt(ONE.toBigDecimal())) {
token.holderCount = token.holderCount.minus(ONE)
}
return balance return balance
} }