github.com/linapex/ethereum-go-chinese@v0.0.0-20190316121929-f8b7a73c3fa1/core/vm/runtime/env.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 19:16:36</date> 10 //</624450083156398080> 11 12 13 package runtime 14 15 import ( 16 "github.com/ethereum/go-ethereum/common" 17 "github.com/ethereum/go-ethereum/core" 18 "github.com/ethereum/go-ethereum/core/vm" 19 ) 20 21 func NewEnv(cfg *Config) *vm.EVM { 22 context := vm.Context{ 23 CanTransfer: core.CanTransfer, 24 Transfer: core.Transfer, 25 GetHash: func(uint64) common.Hash { return common.Hash{} }, 26 27 Origin: cfg.Origin, 28 Coinbase: cfg.Coinbase, 29 BlockNumber: cfg.BlockNumber, 30 Time: cfg.Time, 31 Difficulty: cfg.Difficulty, 32 GasLimit: cfg.GasLimit, 33 GasPrice: cfg.GasPrice, 34 } 35 36 return vm.NewEVM(context, cfg.State, cfg.ChainConfig, cfg.EVMConfig) 37 } 38