aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-25 23:26:34 +0800
committerobscuren <geffobscura@gmail.com>2014-06-25 23:26:34 +0800
commitb0dc50c2a0e25bf88901f3dd481f14bc3375adc5 (patch)
tree1516e87f662a432fa2696028d0f31df3cc1339a9 /ethutil
parent6d32bef65a899e74ee66334a917a2f6d7b44945a (diff)
downloaddexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar.gz
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar.bz2
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar.lz
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar.xz
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.tar.zst
dexon-b0dc50c2a0e25bf88901f3dd481f14bc3375adc5.zip
New mutan implementation
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/script.go23
1 files changed, 4 insertions, 19 deletions
diff --git a/ethutil/script.go b/ethutil/script.go
index c8b1da51c..235498df2 100644
--- a/ethutil/script.go
+++ b/ethutil/script.go
@@ -3,6 +3,7 @@ package ethutil
import (
"fmt"
"github.com/obscuren/mutan"
+ "github.com/obscuren/mutan/backends"
"github.com/obscuren/serpent-go"
"strings"
)
@@ -19,7 +20,9 @@ func Compile(script string) (ret []byte, err error) {
return byteCode, nil
} else {
- byteCode, errors := mutan.Compile(strings.NewReader(script), false)
+ compiler := mutan.NewCompiler(backend.NewEthereumBackend())
+ byteCode, errors := compiler.Compile(strings.NewReader(script))
+ //byteCode, errors := mutan.Compile(strings.NewReader(script), false)
if len(errors) > 0 {
var errs string
for _, er := range errors {
@@ -33,21 +36,3 @@ func Compile(script string) (ret []byte, err error) {
return byteCode, nil
}
}
-
-func CompileScript(script string) ([]byte, []byte, error) {
- // Preprocess
- mainInput, initInput := mutan.PreParse(script)
- // Compile main script
- mainScript, err := Compile(mainInput)
- if err != nil {
- return nil, nil, err
- }
-
- // Compile init script
- initScript, err := Compile(initInput)
- if err != nil {
- return nil, nil, err
- }
-
- return mainScript, initScript, nil
-}