forked from TrueCloudLab/neoneo-go
native: use Hash160 method parameters where appropriate
Partially reverts 33386065bc
, see
neo-project/neo#2183.
This commit is contained in:
parent
cbbaadde88
commit
4fa1476c03
4 changed files with 14 additions and 15 deletions
|
@ -64,7 +64,7 @@ func newManagement() *Management {
|
|||
}
|
||||
|
||||
desc := newDescriptor("getContract", smartcontract.ArrayType,
|
||||
manifest.NewParameter("hash", smartcontract.ByteArrayType))
|
||||
manifest.NewParameter("hash", smartcontract.Hash160Type))
|
||||
md := newMethodAndPrice(m.getContract, 1000000, smartcontract.ReadStates)
|
||||
m.AddMethod(md, desc)
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ func newNEO() *NEO {
|
|||
n.committeeHash.Store(util.Uint160{})
|
||||
|
||||
desc := newDescriptor("unclaimedGas", smartcontract.IntegerType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType),
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("end", smartcontract.IntegerType))
|
||||
md := newMethodAndPrice(n.unclaimedGas, 3000000, smartcontract.ReadStates)
|
||||
n.AddMethod(md, desc)
|
||||
|
@ -124,7 +124,7 @@ func newNEO() *NEO {
|
|||
n.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("vote", smartcontract.BoolType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType),
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("pubkey", smartcontract.ByteArrayType))
|
||||
md = newMethodAndPrice(n.vote, 5000000, smartcontract.WriteStates)
|
||||
n.AddMethod(md, desc)
|
||||
|
|
|
@ -59,23 +59,22 @@ func newNEP17Native(name string) *nep17TokenNative {
|
|||
n.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("balanceOf", smartcontract.IntegerType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType))
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type))
|
||||
md = newMethodAndPrice(n.balanceOf, 1000000, smartcontract.ReadStates)
|
||||
n.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("transfer", smartcontract.BoolType,
|
||||
manifest.NewParameter("from", smartcontract.ByteArrayType),
|
||||
manifest.NewParameter("to", smartcontract.ByteArrayType),
|
||||
transferParams := []manifest.Parameter{
|
||||
manifest.NewParameter("from", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("to", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("amount", smartcontract.IntegerType),
|
||||
manifest.NewParameter("data", smartcontract.AnyType),
|
||||
}
|
||||
desc = newDescriptor("transfer", smartcontract.BoolType,
|
||||
append(transferParams, manifest.NewParameter("data", smartcontract.AnyType))...,
|
||||
)
|
||||
md = newMethodAndPrice(n.Transfer, 9000000, smartcontract.WriteStates|smartcontract.AllowCall|smartcontract.AllowNotify)
|
||||
n.AddMethod(md, desc)
|
||||
|
||||
n.AddEvent("Transfer",
|
||||
manifest.NewParameter("from", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("to", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("amount", smartcontract.IntegerType))
|
||||
n.AddEvent("Transfer", transferParams...)
|
||||
|
||||
return n
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func newPolicy() *Policy {
|
|||
p.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("isBlocked", smartcontract.BoolType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType))
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type))
|
||||
md = newMethodAndPrice(p.isBlocked, 1000000, smartcontract.ReadStates)
|
||||
p.AddMethod(md, desc)
|
||||
|
||||
|
@ -144,12 +144,12 @@ func newPolicy() *Policy {
|
|||
p.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("blockAccount", smartcontract.BoolType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType))
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type))
|
||||
md = newMethodAndPrice(p.blockAccount, 3000000, smartcontract.WriteStates)
|
||||
p.AddMethod(md, desc)
|
||||
|
||||
desc = newDescriptor("unblockAccount", smartcontract.BoolType,
|
||||
manifest.NewParameter("account", smartcontract.ByteArrayType))
|
||||
manifest.NewParameter("account", smartcontract.Hash160Type))
|
||||
md = newMethodAndPrice(p.unblockAccount, 3000000, smartcontract.WriteStates)
|
||||
p.AddMethod(md, desc)
|
||||
|
||||
|
|
Loading…
Reference in a new issue