diff --git a/pkg/core/native/native_gas.go b/pkg/core/native/native_gas.go index cdc0cd97b..1c5351ef0 100644 --- a/pkg/core/native/native_gas.go +++ b/pkg/core/native/native_gas.go @@ -28,21 +28,22 @@ const initialGAS = 30000000 // NewGAS returns GAS native contract. func NewGAS() *GAS { + g := &GAS{} nep5 := newNEP5Native(gasSyscallName) nep5.name = "GAS" nep5.symbol = "gas" nep5.decimals = 8 nep5.factor = GASFactor + nep5.onPersist = chainOnPersist(g.onPersist, g.OnPersist) + nep5.incBalance = g.increaseBalance - g := &GAS{nep5TokenNative: *nep5} + g.nep5TokenNative = *nep5 desc := newDescriptor("getSysFeeAmount", smartcontract.IntegerType, manifest.NewParameter("index", smartcontract.IntegerType)) md := newMethodAndPrice(g.getSysFeeAmount, 1, smartcontract.NoneFlag) g.AddMethod(md, desc, true) - g.onPersist = chainOnPersist(g.onPersist, g.OnPersist) - g.incBalance = g.increaseBalance return g } diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index cd35e942a..e4bcc4246 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -60,13 +60,16 @@ func makeValidatorKey(key *keys.PublicKey) []byte { // NewNEO returns NEO native contract. func NewNEO() *NEO { + n := &NEO{} nep5 := newNEP5Native(neoSyscallName) nep5.name = "NEO" nep5.symbol = "neo" nep5.decimals = 0 nep5.factor = 1 + nep5.onPersist = chainOnPersist(n.onPersist, n.OnPersist) + nep5.incBalance = n.increaseBalance - n := &NEO{nep5TokenNative: *nep5} + n.nep5TokenNative = *nep5 desc := newDescriptor("unclaimedGas", smartcontract.IntegerType, manifest.NewParameter("account", smartcontract.Hash160Type), @@ -97,9 +100,6 @@ func NewNEO() *NEO { md = newMethodAndPrice(n.getNextBlockValidators, 1, smartcontract.NoneFlag) n.AddMethod(md, desc, true) - n.onPersist = chainOnPersist(n.onPersist, n.OnPersist) - n.incBalance = n.increaseBalance - return n }