diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-21 02:50:53 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-21 02:50:53 +0800 |
commit | c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a (patch) | |
tree | b824abb6ae17acc68801d58440929e57751c569b /ethchain/closure.go | |
parent | f21eb88ad1cf54b342187e8d3b55374a695cd524 (diff) | |
download | go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.gz go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.bz2 go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.lz go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.xz go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.zst go-tangerine-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.zip |
Fixed MSTORE and added some more commets
Diffstat (limited to 'ethchain/closure.go')
-rw-r--r-- | ethchain/closure.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ethchain/closure.go b/ethchain/closure.go index 4ef43a2da..204fbce06 100644 --- a/ethchain/closure.go +++ b/ethchain/closure.go @@ -21,15 +21,17 @@ type ClosureBody interface { type Closure struct { callee Callee object ClosureBody - state *State + State *State gas *big.Int val *big.Int + + args []byte } // Create a new closure for the given data items func NewClosure(callee Callee, object ClosureBody, state *State, gas, val *big.Int) *Closure { - return &Closure{callee, object, state, gas, val} + return &Closure{callee, object, state, gas, val, nil} } // Retuns the x element in data slice @@ -42,14 +44,20 @@ func (c *Closure) GetMem(x int64) *ethutil.Value { return m } +func (c *Closure) Call(vm *Vm, args []byte) []byte { + c.args = args + + return vm.RunClosure(c) +} + func (c *Closure) Return(ret []byte) []byte { // Return the remaining gas to the callee // If no callee is present return it to // the origin (i.e. contract or tx) if c.callee != nil { - c.callee.ReturnGas(c.gas, c.state) + c.callee.ReturnGas(c.gas, c.State) } else { - c.object.ReturnGas(c.gas, c.state) + c.object.ReturnGas(c.gas, c.State) // TODO incase it's a POST contract we gotta serialise the contract again. // But it's not yet defined } |