aboutsummaryrefslogtreecommitdiffstats
path: root/ethpipe/vm_env.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-21 21:46:26 +0800
committerobscuren <geffobscura@gmail.com>2014-08-21 21:46:26 +0800
commit0af0f0d890120e007ce42f072e1ee179a62115d3 (patch)
tree5ae9ecafbb729d1636fadfcfa49fd9100959560c /ethpipe/vm_env.go
parentd761af84c83ae8d9d723e6766abb7950ff59cdf3 (diff)
parentc173e9f4ab463cf3a44d35215bc29d846d6f6b02 (diff)
downloaddexon-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.gz
dexon-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.zst
dexon-0af0f0d890120e007ce42f072e1ee179a62115d3.zip
Merge branch 'release/0.6.3'
Diffstat (limited to 'ethpipe/vm_env.go')
-rw-r--r--ethpipe/vm_env.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/ethpipe/vm_env.go b/ethpipe/vm_env.go
new file mode 100644
index 000000000..822a9e5c7
--- /dev/null
+++ b/ethpipe/vm_env.go
@@ -0,0 +1,34 @@
+package ethpipe
+
+import (
+ "math/big"
+
+ "github.com/ethereum/eth-go/ethchain"
+ "github.com/ethereum/eth-go/ethstate"
+)
+
+type VMEnv struct {
+ state *ethstate.State
+ block *ethchain.Block
+ value *big.Int
+ sender []byte
+}
+
+func NewEnv(state *ethstate.State, block *ethchain.Block, value *big.Int, sender []byte) *VMEnv {
+ return &VMEnv{
+ state: state,
+ block: block,
+ value: value,
+ sender: sender,
+ }
+}
+
+func (self *VMEnv) Origin() []byte { return self.sender }
+func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number }
+func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
+func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase }
+func (self *VMEnv) Time() int64 { return self.block.Time }
+func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty }
+func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
+func (self *VMEnv) Value() *big.Int { return self.value }
+func (self *VMEnv) State() *ethstate.State { return self.state }