diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-31 00:02:43 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-31 00:02:43 +0800 |
commit | 34e937c9761f963ac4d3c9781d72ae92e54c0761 (patch) | |
tree | 9a4c78944acd6ee924eb86916f32d508de0b66a6 /utils | |
parent | 2f5c95610feb77dd714bf9295d6127bef58f31bc (diff) | |
parent | 834803f1e8ce45040045359185c8b8d75f63de2c (diff) | |
download | dexon-34e937c9761f963ac4d3c9781d72ae92e54c0761.tar.gz dexon-34e937c9761f963ac4d3c9781d72ae92e54c0761.tar.zst dexon-34e937c9761f963ac4d3c9781d72ae92e54c0761.zip |
merge upstream
Diffstat (limited to 'utils')
-rw-r--r-- | utils/vm_env.go | 33 |
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 } |