native: specify call flags for native contract methods

This commit is contained in:
Evgenii Stratonikov 2020-06-10 17:32:35 +03:00
parent 0dd00a49f5
commit a3b876d55c
2 changed files with 9 additions and 9 deletions

View file

@ -77,30 +77,30 @@ func NewNEO() *NEO {
desc := newDescriptor("unclaimedGas", smartcontract.IntegerType,
manifest.NewParameter("account", smartcontract.Hash160Type),
manifest.NewParameter("end", smartcontract.IntegerType))
md := newMethodAndPrice(n.unclaimedGas, 1, smartcontract.NoneFlag)
md := newMethodAndPrice(n.unclaimedGas, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
desc = newDescriptor("registerValidator", smartcontract.BoolType,
manifest.NewParameter("pubkey", smartcontract.PublicKeyType))
md = newMethodAndPrice(n.registerValidator, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.registerValidator, 1, smartcontract.AllowModifyStates)
n.AddMethod(md, desc, false)
desc = newDescriptor("vote", smartcontract.BoolType,
manifest.NewParameter("account", smartcontract.Hash160Type),
manifest.NewParameter("pubkeys", smartcontract.ArrayType))
md = newMethodAndPrice(n.vote, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.vote, 1, smartcontract.AllowModifyStates)
n.AddMethod(md, desc, false)
desc = newDescriptor("getRegisteredValidators", smartcontract.ArrayType)
md = newMethodAndPrice(n.getRegisteredValidatorsCall, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.getRegisteredValidatorsCall, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
desc = newDescriptor("getValidators", smartcontract.ArrayType)
md = newMethodAndPrice(n.getValidators, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.getValidators, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
desc = newDescriptor("getNextBlockValidators", smartcontract.ArrayType)
md = newMethodAndPrice(n.getNextBlockValidators, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.getNextBlockValidators, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
return n

View file

@ -61,12 +61,12 @@ func newNEP5Native(name string) *nep5TokenNative {
n.AddMethod(md, desc, true)
desc = newDescriptor("totalSupply", smartcontract.IntegerType)
md = newMethodAndPrice(n.TotalSupply, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.TotalSupply, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
desc = newDescriptor("balanceOf", smartcontract.IntegerType,
manifest.NewParameter("account", smartcontract.Hash160Type))
md = newMethodAndPrice(n.balanceOf, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.balanceOf, 1, smartcontract.AllowStates)
n.AddMethod(md, desc, true)
desc = newDescriptor("transfer", smartcontract.BoolType,
@ -74,7 +74,7 @@ func newNEP5Native(name string) *nep5TokenNative {
manifest.NewParameter("to", smartcontract.Hash160Type),
manifest.NewParameter("amount", smartcontract.IntegerType),
)
md = newMethodAndPrice(n.Transfer, 1, smartcontract.NoneFlag)
md = newMethodAndPrice(n.Transfer, 1, smartcontract.AllowModifyStates)
n.AddMethod(md, desc, false)
n.AddEvent("Transfer", desc.Parameters...)