diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-25 19:24:35 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:21 +0800 |
commit | 24819d5eb4c2f58a8b63fccfc0d32044f5676e14 (patch) | |
tree | 5f8b1924a89667c75d4116c9dd46511864f77692 /core/vm/evm.go | |
parent | 4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607 (diff) | |
download | go-tangerine-24819d5eb4c2f58a8b63fccfc0d32044f5676e14.tar.gz go-tangerine-24819d5eb4c2f58a8b63fccfc0d32044f5676e14.tar.zst go-tangerine-24819d5eb4c2f58a8b63fccfc0d32044f5676e14.zip |
core: vm: refactor governance and add node info oracle (#174)
Diffstat (limited to 'core/vm/evm.go')
-rw-r--r-- | core/vm/evm.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/vm/evm.go b/core/vm/evm.go index 2eba9c2cb..422d52ccb 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -48,8 +48,8 @@ type ( // run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter. func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) { if contract.CodeAddr != nil { - if *contract.CodeAddr == GovernanceContractAddress { - return RunGovernanceContract(evm, input, contract) + if o := OracleContracts[*contract.CodeAddr]; o != nil { + return RunOracleContract(o, evm, input, contract) } precompiles := PrecompiledContractsHomestead if evm.ChainConfig().IsByzantium(evm.BlockNumber) { @@ -216,7 +216,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas if evm.ChainConfig().IsByzantium(evm.BlockNumber) { precompiles = PrecompiledContractsByzantium } - if precompiles[addr] == nil && evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 && addr != GovernanceContractAddress { + if precompiles[addr] == nil && OracleContracts[addr] == nil && + evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 { // Calling a non existing account, don't do anything, but ping the tracer if evm.vmConfig.Debug && evm.depth == 0 { evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) |