mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
core: remove NEP17BalanceState if balance is null [addTokens]
Affects states.
This commit is contained in:
parent
0f1473897b
commit
4893faa374
1 changed files with 8 additions and 2 deletions
|
@ -258,13 +258,19 @@ func (c *nep17TokenNative) addTokens(ic *interop.Context, h util.Uint160, amount
|
|||
if err := c.incBalance(ic, h, si, amount); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := ic.DAO.PutStorageItem(c.ID, key, si); err != nil {
|
||||
var err error
|
||||
if si.Value == nil {
|
||||
err = ic.DAO.DeleteStorageItem(c.ID, key)
|
||||
} else {
|
||||
err = ic.DAO.PutStorageItem(c.ID, key, si)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
supply := c.getTotalSupply(ic.DAO)
|
||||
supply.Add(supply, amount)
|
||||
err := c.saveTotalSupply(ic.DAO, supply)
|
||||
err = c.saveTotalSupply(ic.DAO, supply)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue