core: add missing onPersist and postPersist methods to natives
Although not every contract is persisted (see https://github.com/neo-project/neo/blob/master/src/neo/Ledger/Blockchain.cs#L94) we have to add `onPersist` and `postPersist` methods to every native contract in order to display them in manifest for users and follow C# behaviour. In C# there are `onPersist` and `postPersist` methods in base native contract class, see https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L141 and https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L148
This commit is contained in:
parent
97069a05d5
commit
2fee69f26f
6 changed files with 22 additions and 11 deletions
|
@ -137,6 +137,10 @@ func newOracle() *Oracle {
|
|||
md = newMethodAndPrice(getOnPersistWrapper(pp), 0, smartcontract.AllowModifyStates)
|
||||
o.AddMethod(md, desc, false)
|
||||
|
||||
desc = newDescriptor("onPersist", smartcontract.VoidType)
|
||||
md = newMethodAndPrice(getOnPersistWrapper(onPersistBase), 0, smartcontract.AllowModifyStates)
|
||||
o.AddMethod(md, desc, false)
|
||||
|
||||
o.AddEvent("OracleRequest", manifest.NewParameter("Id", smartcontract.IntegerType),
|
||||
manifest.NewParameter("RequestContract", smartcontract.Hash160Type),
|
||||
manifest.NewParameter("Url", smartcontract.StringType),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue