diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-19 07:18:52 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-19 07:18:52 +0800 |
commit | 59ef6e36931c980ba15babfb3680514635faebf6 (patch) | |
tree | 4c0b9b36a6419eb790171c82b86b19ecc1192d01 /vm/closure.go | |
parent | a7f4ade7114ee962110cb7c140e7ce7bd3f6664f (diff) | |
download | dexon-59ef6e36931c980ba15babfb3680514635faebf6.tar.gz dexon-59ef6e36931c980ba15babfb3680514635faebf6.tar.zst dexon-59ef6e36931c980ba15babfb3680514635faebf6.zip |
Cleaned up objects
Diffstat (limited to 'vm/closure.go')
-rw-r--r-- | vm/closure.go | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/vm/closure.go b/vm/closure.go index bd5268f96..97b31ada0 100644 --- a/vm/closure.go +++ b/vm/closure.go @@ -3,7 +3,6 @@ package vm import ( "math/big" - "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" ) @@ -11,8 +10,6 @@ type ClosureRef interface { ReturnGas(*big.Int, *big.Int) Address() []byte SetCode([]byte) - GetStorage(*big.Int) *ethutil.Value - SetStorage(*big.Int, *ethutil.Value) } type Closure struct { @@ -41,10 +38,6 @@ func NewClosure(msg *state.Message, caller ClosureRef, object ClosureRef, code [ return c } -func (c *Closure) GetValue(x uint64) *ethutil.Value { - return c.GetRangeValue(x, 1) -} - func (c *Closure) GetOp(x uint64) OpCode { return OpCode(c.GetByte(x)) } @@ -65,30 +58,12 @@ func (c *Closure) GetBytes(x, y int) []byte { return c.Code[x : x+y] } -func (c *Closure) GetRangeValue(x, y uint64) *ethutil.Value { +func (c *Closure) GetRangeValue(x, y uint64) []byte { if x >= uint64(len(c.Code)) || y >= uint64(len(c.Code)) { - return ethutil.NewValue(0) - } - - partial := c.Code[x : x+y] - - return ethutil.NewValue(partial) -} - -/* - * State storage functions - */ -func (c *Closure) SetStorage(x *big.Int, val *ethutil.Value) { - c.object.SetStorage(x, val) -} - -func (c *Closure) GetStorage(x *big.Int) *ethutil.Value { - m := c.object.GetStorage(x) - if m == nil { - return ethutil.EmptyValue() + return nil } - return m + return c.Code[x : x+y] } func (c *Closure) Return(ret []byte) []byte { @@ -123,10 +98,6 @@ func (c *Closure) ReturnGas(gas, price *big.Int) { /* * Set / Get */ -func (c *Closure) Caller() ClosureRef { - return c.caller -} - func (c *Closure) Address() []byte { return c.object.Address() } |