diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-27 22:50:44 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-27 22:53:35 +0800 |
commit | 16e52327a4baa5547c38965fce53b3ff40b98173 (patch) | |
tree | 27fb43512c802e2c3c0fe8bd8d97a55aa2499758 /ethchain/closure.go | |
parent | 05d2d8f27d0bea5b20be9bc3b4a259a12298ecab (diff) | |
download | go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.gz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.bz2 go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.lz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.xz go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.tar.zst go-tangerine-16e52327a4baa5547c38965fce53b3ff40b98173.zip |
Upped version number
Diffstat (limited to 'ethchain/closure.go')
-rw-r--r-- | ethchain/closure.go | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/ethchain/closure.go b/ethchain/closure.go index f8135c514..57abaa91e 100644 --- a/ethchain/closure.go +++ b/ethchain/closure.go @@ -8,21 +8,24 @@ import ( ) type Callee interface { - ReturnGas(*big.Int, *big.Int, *State) - Address() []byte } type Reference interface { Callee - ethutil.RlpEncodable +} + +type ClosureRef interface { + ReturnGas(*big.Int, *big.Int, *State) + Address() []byte GetMem(*big.Int) *ethutil.Value SetMem(*big.Int, *ethutil.Value) + N() *big.Int } // Basic inline closure object which implement the 'closure' interface type Closure struct { - callee Callee - object Reference + callee ClosureRef + object ClosureRef Script []byte State *State @@ -34,7 +37,7 @@ type Closure struct { } // Create a new closure for the given data items -func NewClosure(callee Callee, object Reference, script []byte, state *State, gas, price, val *big.Int) *Closure { +func NewClosure(callee, object ClosureRef, script []byte, state *State, gas, price, val *big.Int) *Closure { c := &Closure{callee: callee, object: object, Script: script, State: state, Args: nil} // In most cases gas, price and value are pointers to transaction objects @@ -105,10 +108,14 @@ func (c *Closure) ReturnGas(gas, price *big.Int, state *State) { c.Gas.Add(c.Gas, gas) } -func (c *Closure) Object() Reference { +func (c *Closure) Object() ClosureRef { return c.object } -func (c *Closure) Callee() Callee { +func (c *Closure) Callee() ClosureRef { return c.callee } + +func (c *Closure) N() *big.Int { + return c.object.N() +} |