aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/closure.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-21 02:50:53 +0800
committerobscuren <geffobscura@gmail.com>2014-03-21 02:50:53 +0800
commitc68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a (patch)
treeb824abb6ae17acc68801d58440929e57751c569b /ethchain/closure.go
parentf21eb88ad1cf54b342187e8d3b55374a695cd524 (diff)
downloaddexon-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.gz
dexon-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.tar.zst
dexon-c68ff9886bdd59294bc2bf0a6b8bf9b83645cc9a.zip
Fixed MSTORE and added some more commets
Diffstat (limited to 'ethchain/closure.go')
-rw-r--r--ethchain/closure.go16
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
}