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:
Anna Shaleva 2020-11-19 18:40:36 +03:00
parent 97069a05d5
commit 2fee69f26f
6 changed files with 22 additions and 11 deletions

View file

@ -97,7 +97,7 @@ func newNEO() *NEO {
nep17.symbol = "neo"
nep17.decimals = 0
nep17.factor = 1
nep17.onPersist = chainOnPersist(nep17.OnPersist, n.OnPersist)
nep17.onPersist = chainOnPersist(onPersistBase, n.OnPersist)
nep17.postPersist = chainOnPersist(nep17.postPersist, n.PostPersist)
nep17.incBalance = n.increaseBalance
nep17.ContractID = neoContractID