forked from TrueCloudLab/neoneo-go
examples: add onNEP17Payment
invocation
This commit is contained in:
parent
2ee755e09f
commit
c57972d0a7
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,8 @@ package nep17
|
|||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/util"
|
||||
|
@ -64,6 +66,9 @@ func (t Token) Transfer(ctx storage.Context, from, to interop.Hash160, amount in
|
|||
totalAmountTo := amountTo + amount
|
||||
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)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue