From 425277098cb4ebfc9fefa74e17568ef46c8f33c8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 10 Jun 2020 14:23:25 +0300 Subject: [PATCH] native: set ContractID for NEO & GAS contracts --- pkg/core/interop/context.go | 1 + pkg/core/native/native_gas.go | 2 ++ pkg/core/native/native_neo.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/pkg/core/interop/context.go b/pkg/core/interop/context.go index b1e400624..5d96a9493 100644 --- a/pkg/core/interop/context.go +++ b/pkg/core/interop/context.go @@ -82,6 +82,7 @@ type ContractMD struct { Manifest manifest.Manifest ServiceName string ServiceID uint32 + ContractID int32 Script []byte Hash util.Uint160 Methods map[string]MethodAndPrice diff --git a/pkg/core/native/native_gas.go b/pkg/core/native/native_gas.go index 109deceb3..ea98b80f3 100644 --- a/pkg/core/native/native_gas.go +++ b/pkg/core/native/native_gas.go @@ -20,6 +20,7 @@ type GAS struct { } const gasSyscallName = "Neo.Native.Tokens.GAS" +const gasContractID = -2 // GASFactor is a divisor for finding GAS integral value. const GASFactor = NEOTotalSupply @@ -35,6 +36,7 @@ func NewGAS() *GAS { nep5.factor = GASFactor nep5.onPersist = chainOnPersist(g.onPersist, g.OnPersist) nep5.incBalance = g.increaseBalance + nep5.ContractID = gasContractID g.nep5TokenNative = *nep5 diff --git a/pkg/core/native/native_neo.go b/pkg/core/native/native_neo.go index 84b85cf74..2dfd4b2f6 100644 --- a/pkg/core/native/native_neo.go +++ b/pkg/core/native/native_neo.go @@ -34,6 +34,7 @@ type keyWithVotes struct { const ( neoSyscallName = "Neo.Native.Tokens.NEO" + neoContractID = -2 // NEOTotalSupply is the total amount of NEO in the system. NEOTotalSupply = 100000000 // prefixValidator is a prefix used to store validator's data. @@ -69,6 +70,7 @@ func NewNEO() *NEO { nep5.factor = 1 nep5.onPersist = chainOnPersist(n.onPersist, n.OnPersist) nep5.incBalance = n.increaseBalance + nep5.ContractID = neoContractID n.nep5TokenNative = *nep5