aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-24 18:30:41 +0800
committerobscuren <geffobscura@gmail.com>2014-07-24 18:30:41 +0800
commita06a84d19b24da4005bc4d150f071ec4a703521b (patch)
tree68b5ff4d60831d278cea13ea2a95de8af04ff3ed /utils
parente7a80ec68165755678647f2d3e9b475d492a70dd (diff)
downloaddexon-a06a84d19b24da4005bc4d150f071ec4a703521b.tar.gz
dexon-a06a84d19b24da4005bc4d150f071ec4a703521b.tar.zst
dexon-a06a84d19b24da4005bc4d150f071ec4a703521b.zip
Refactored to reflect the new VM and State
Diffstat (limited to 'utils')
-rw-r--r--utils/vm_env.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/utils/vm_env.go b/utils/vm_env.go
new file mode 100644
index 000000000..2c40dd7b8
--- /dev/null
+++ b/utils/vm_env.go
@@ -0,0 +1,33 @@
+package utils
+
+import (
+ "github.com/ethereum/eth-go/ethchain"
+ "github.com/ethereum/eth-go/ethstate"
+ "math/big"
+)
+
+type VMEnv struct {
+ state *ethstate.State
+ block *ethchain.Block
+
+ transactor []byte
+ value *big.Int
+}
+
+func NewEnv(state *ethstate.State, block *ethchain.Block, transactor []byte, value *big.Int) *VMEnv {
+ return &VMEnv{
+ state: state,
+ block: block,
+ transactor: transactor,
+ value: value,
+ }
+}
+
+func (self *VMEnv) Origin() []byte { return self.transactor }
+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) Value() *big.Int { return self.value }
+func (self *VMEnv) State() *ethstate.State { return self.state }