native: rename onPayment into onNEP17Payment

Follow neo-project/neo#2287.
This commit is contained in:
Roman Khimov 2021-02-05 16:09:51 +03:00
parent b1977ea4e3
commit a442e1530d
6 changed files with 7 additions and 7 deletions

View file

@ -4,5 +4,5 @@ func Verify() bool {
return true return true
} }
func OnPayment(from []byte, amount int, data interface{}) { func OnNEP17Payment(from []byte, amount int, data interface{}) {
} }

View file

@ -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} {"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}

View file

@ -456,7 +456,7 @@ func getTestContractState(bc *Blockchain) (*state.Contract, *state.Contract) {
ReturnType: smartcontract.VoidType, ReturnType: smartcontract.VoidType,
}, },
{ {
Name: "onPayment", Name: manifest.MethodOnNEP17Payment,
Offset: onPaymentOff, Offset: onPaymentOff,
Parameters: []manifest.Parameter{ Parameters: []manifest.Parameter{
manifest.NewParameter("from", smartcontract.Hash160Type), manifest.NewParameter("from", smartcontract.Hash160Type),

View file

@ -143,7 +143,7 @@ func (c *nep17TokenNative) postTransfer(ic *interop.Context, from, to *util.Uint
stackitem.NewBigInteger(amount), stackitem.NewBigInteger(amount),
data, 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) panic(err)
} }
} }

View file

@ -55,7 +55,7 @@ var maxNotValidBeforeDeltaKey = []byte{10}
func newNotary() *Notary { func newNotary() *Notary {
n := &Notary{ContractMD: *interop.NewContractMD(nativenames.Notary, notaryContractID)} 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("from", smartcontract.Hash160Type),
manifest.NewParameter("amount", smartcontract.IntegerType), manifest.NewParameter("amount", smartcontract.IntegerType),
manifest.NewParameter("data", smartcontract.AnyType)) manifest.NewParameter("data", smartcontract.AnyType))

View file

@ -21,8 +21,8 @@ const (
// MethodVerify is a name for default verification method. // MethodVerify is a name for default verification method.
MethodVerify = "verify" MethodVerify = "verify"
// MethodOnPayment is name of the method which is called when contract receives funds. // MethodOnNEP17Payment is name of the method which is called when contract receives NEP-17 tokens.
MethodOnPayment = "onPayment" MethodOnNEP17Payment = "onNEP17Payment"
// NEP10StandardName represents the name of NEP10 smartcontract standard. // NEP10StandardName represents the name of NEP10 smartcontract standard.
NEP10StandardName = "NEP-10" NEP10StandardName = "NEP-10"