| 
									
										
										
										
											2016-04-14 18:18:24 +02:00
										 |  |  | // Copyright 2015 The go-ethereum Authors | 
					
						
							| 
									
										
										
										
											2015-10-09 14:56:12 +02:00
										 |  |  | // This file is part of the go-ethereum library. | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | // The go-ethereum library is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  | // it under the terms of the GNU Lesser General Public License as published by | 
					
						
							|  |  |  | // the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  | // (at your option) any later version. | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | // The go-ethereum library is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
					
						
							|  |  |  | // GNU Lesser General Public License for more details. | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | // You should have received a copy of the GNU Lesser General Public License | 
					
						
							|  |  |  | // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package runtime | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/core" | 
					
						
							|  |  |  | 	"github.com/ethereum/go-ethereum/core/vm" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-11 07:29:32 -04:00
										 |  |  | func NewEnv(cfg *Config) *vm.EVM { | 
					
						
							| 
									
										
										
										
											2020-11-13 13:42:19 +01:00
										 |  |  | 	txContext := vm.TxContext{ | 
					
						
							|  |  |  | 		Origin:   cfg.Origin, | 
					
						
							|  |  |  | 		GasPrice: cfg.GasPrice, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	blockContext := vm.BlockContext{ | 
					
						
							| 
									
										
										
										
											2016-12-06 02:16:03 +01:00
										 |  |  | 		CanTransfer: core.CanTransfer, | 
					
						
							|  |  |  | 		Transfer:    core.Transfer, | 
					
						
							| 
									
										
										
										
											2020-02-04 11:32:31 +01:00
										 |  |  | 		GetHash:     cfg.GetHashFn, | 
					
						
							| 
									
										
										
										
											2016-12-06 02:16:03 +01:00
										 |  |  | 		Coinbase:    cfg.Coinbase, | 
					
						
							|  |  |  | 		BlockNumber: cfg.BlockNumber, | 
					
						
							|  |  |  | 		Time:        cfg.Time, | 
					
						
							|  |  |  | 		Difficulty:  cfg.Difficulty, | 
					
						
							| 
									
										
										
										
											2017-11-13 13:47:27 +02:00
										 |  |  | 		GasLimit:    cfg.GasLimit, | 
					
						
							| 
									
										
										
										
											2021-06-16 08:53:27 +02:00
										 |  |  | 		BaseFee:     cfg.BaseFee, | 
					
						
							| 
									
										
										
										
											2015-10-09 14:56:12 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-11-27 15:40:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-13 13:42:19 +01:00
										 |  |  | 	return vm.NewEVM(blockContext, txContext, cfg.State, cfg.ChainConfig, cfg.EVMConfig) | 
					
						
							| 
									
										
										
										
											2015-10-09 14:56:12 +02:00
										 |  |  | } |