native: set ContractID for NEO & GAS contracts

This commit is contained in:
Evgenii Stratonikov 2020-06-10 14:23:25 +03:00
parent c044bdc731
commit 425277098c
3 changed files with 5 additions and 0 deletions

View file

@ -82,6 +82,7 @@ type ContractMD struct {
Manifest manifest.Manifest Manifest manifest.Manifest
ServiceName string ServiceName string
ServiceID uint32 ServiceID uint32
ContractID int32
Script []byte Script []byte
Hash util.Uint160 Hash util.Uint160
Methods map[string]MethodAndPrice Methods map[string]MethodAndPrice

View file

@ -20,6 +20,7 @@ type GAS struct {
} }
const gasSyscallName = "Neo.Native.Tokens.GAS" const gasSyscallName = "Neo.Native.Tokens.GAS"
const gasContractID = -2
// GASFactor is a divisor for finding GAS integral value. // GASFactor is a divisor for finding GAS integral value.
const GASFactor = NEOTotalSupply const GASFactor = NEOTotalSupply
@ -35,6 +36,7 @@ func NewGAS() *GAS {
nep5.factor = GASFactor nep5.factor = GASFactor
nep5.onPersist = chainOnPersist(g.onPersist, g.OnPersist) nep5.onPersist = chainOnPersist(g.onPersist, g.OnPersist)
nep5.incBalance = g.increaseBalance nep5.incBalance = g.increaseBalance
nep5.ContractID = gasContractID
g.nep5TokenNative = *nep5 g.nep5TokenNative = *nep5

View file

@ -34,6 +34,7 @@ type keyWithVotes struct {
const ( const (
neoSyscallName = "Neo.Native.Tokens.NEO" neoSyscallName = "Neo.Native.Tokens.NEO"
neoContractID = -2
// NEOTotalSupply is the total amount of NEO in the system. // NEOTotalSupply is the total amount of NEO in the system.
NEOTotalSupply = 100000000 NEOTotalSupply = 100000000
// prefixValidator is a prefix used to store validator's data. // prefixValidator is a prefix used to store validator's data.
@ -69,6 +70,7 @@ func NewNEO() *NEO {
nep5.factor = 1 nep5.factor = 1
nep5.onPersist = chainOnPersist(n.onPersist, n.OnPersist) nep5.onPersist = chainOnPersist(n.onPersist, n.OnPersist)
nep5.incBalance = n.increaseBalance nep5.incBalance = n.increaseBalance
nep5.ContractID = neoContractID
n.nep5TokenNative = *nep5 n.nep5TokenNative = *nep5