mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 19:29:39 +00:00
Merge pull request #2245 from nspcc-dev/examples/nep17
examples: adjust NEP17 and token-sale examples
This commit is contained in:
commit
173bf0be62
2 changed files with 7 additions and 2 deletions
|
@ -186,7 +186,9 @@ func Transfer(from, to interop.Hash160, amount int, _ interface{}) bool {
|
|||
}
|
||||
amountTo := getIntFromDB(ctx, to)
|
||||
totalAmountTo := amountTo + amount
|
||||
storage.Put(ctx, to, totalAmountTo)
|
||||
if totalAmountTo != 0 {
|
||||
storage.Put(ctx, to, totalAmountTo)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,10 @@ func (t Token) Transfer(ctx storage.Context, from, to interop.Hash160, amount in
|
|||
|
||||
amountTo := getIntFromDB(ctx, to)
|
||||
totalAmountTo := amountTo + amount
|
||||
storage.Put(ctx, to, totalAmountTo)
|
||||
if totalAmountTo != 0 {
|
||||
storage.Put(ctx, to, totalAmountTo)
|
||||
}
|
||||
|
||||
runtime.Notify("Transfer", from, to, amount)
|
||||
if to != nil && management.GetContract(to) != nil {
|
||||
contract.Call(to, "onNEP17Payment", contract.All, from, amount, data)
|
||||
|
|
Loading…
Reference in a new issue