From c57972d0a761a61851327d2405d7c0f36824792d Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Thu, 11 Feb 2021 17:51:44 +0300 Subject: [PATCH] examples: add `onNEP17Payment` invocation --- examples/token/nep17/nep17.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/token/nep17/nep17.go b/examples/token/nep17/nep17.go index a962d19d3..b52bcd05b 100644 --- a/examples/token/nep17/nep17.go +++ b/examples/token/nep17/nep17.go @@ -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 }