diff --git a/cli/testdata/verify.go b/cli/testdata/verify.go index 6a3ed7b6a..4abc927d5 100644 --- a/cli/testdata/verify.go +++ b/cli/testdata/verify.go @@ -4,5 +4,5 @@ func Verify() bool { return true } -func OnPayment(from []byte, amount int, data interface{}) { +func OnNEP17Payment(from []byte, amount int, data interface{}) { } diff --git a/cli/testdata/verify.manifest.json b/cli/testdata/verify.manifest.json index 103a744a8..47bf7b91a 100755 --- a/cli/testdata/verify.manifest.json +++ b/cli/testdata/verify.manifest.json @@ -1 +1 @@ -{"name":"verify","abi":{"methods":[{"name":"verify","offset":0,"parameters":[],"returntype":"Boolean","safe":false},{"name":"onPayment","offset":5,"parameters":[{"name":"from","type":"ByteArray"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false}],"events":[{"name":"Hello world!","parameters":[{"name":"args","type":"Array"}]}]},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null} \ No newline at end of file +{"name":"verify","abi":{"methods":[{"name":"verify","offset":0,"parameters":[],"returntype":"Boolean","safe":false},{"name":"onNEP17Payment","offset":5,"parameters":[{"name":"from","type":"ByteArray"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false}],"events":[{"name":"Hello world!","parameters":[{"name":"args","type":"Array"}]}]},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null} diff --git a/pkg/core/interop_system_test.go b/pkg/core/interop_system_test.go index 2ada38325..574a7d3ad 100644 --- a/pkg/core/interop_system_test.go +++ b/pkg/core/interop_system_test.go @@ -456,7 +456,7 @@ func getTestContractState(bc *Blockchain) (*state.Contract, *state.Contract) { ReturnType: smartcontract.VoidType, }, { - Name: "onPayment", + Name: manifest.MethodOnNEP17Payment, Offset: onPaymentOff, Parameters: []manifest.Parameter{ manifest.NewParameter("from", smartcontract.Hash160Type), diff --git a/pkg/core/native/native_nep17.go b/pkg/core/native/native_nep17.go index 7ba55dd6c..ca092bd8b 100644 --- a/pkg/core/native/native_nep17.go +++ b/pkg/core/native/native_nep17.go @@ -143,7 +143,7 @@ func (c *nep17TokenNative) postTransfer(ic *interop.Context, from, to *util.Uint stackitem.NewBigInteger(amount), data, } - if err := contract.CallFromNative(ic, c.Hash, cs, manifest.MethodOnPayment, args, false); err != nil { + if err := contract.CallFromNative(ic, c.Hash, cs, manifest.MethodOnNEP17Payment, args, false); err != nil { panic(err) } } diff --git a/pkg/core/native/notary.go b/pkg/core/native/notary.go index 0a27a5dec..d891acd05 100644 --- a/pkg/core/native/notary.go +++ b/pkg/core/native/notary.go @@ -55,7 +55,7 @@ var maxNotValidBeforeDeltaKey = []byte{10} func newNotary() *Notary { n := &Notary{ContractMD: *interop.NewContractMD(nativenames.Notary, notaryContractID)} - desc := newDescriptor("onPayment", smartcontract.VoidType, + desc := newDescriptor("onNEP17Payment", smartcontract.VoidType, manifest.NewParameter("from", smartcontract.Hash160Type), manifest.NewParameter("amount", smartcontract.IntegerType), manifest.NewParameter("data", smartcontract.AnyType)) diff --git a/pkg/smartcontract/manifest/manifest.go b/pkg/smartcontract/manifest/manifest.go index e65175e85..dc9a07640 100644 --- a/pkg/smartcontract/manifest/manifest.go +++ b/pkg/smartcontract/manifest/manifest.go @@ -21,8 +21,8 @@ const ( // MethodVerify is a name for default verification method. MethodVerify = "verify" - // MethodOnPayment is name of the method which is called when contract receives funds. - MethodOnPayment = "onPayment" + // MethodOnNEP17Payment is name of the method which is called when contract receives NEP-17 tokens. + MethodOnNEP17Payment = "onNEP17Payment" // NEP10StandardName represents the name of NEP10 smartcontract standard. NEP10StandardName = "NEP-10"