aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-23 21:54:34 +0800
committerobscuren <geffobscura@gmail.com>2014-04-23 21:54:34 +0800
commit43f1214f97e52863b1f1ef7913991bef3d00c58e (patch)
tree247b4739b26f00f2f912f23592ca3ff4b2ed38ec /utils
parentb962779a1318138e08c6e84a537fdbc6c9ebfd97 (diff)
downloaddexon-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.gz
dexon-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.zst
dexon-43f1214f97e52863b1f1ef7913991bef3d00c58e.zip
Refactored code
Diffstat (limited to 'utils')
-rw-r--r--utils/compile.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/compile.go b/utils/compile.go
index e5ea50ad4..894fc2d09 100644
--- a/utils/compile.go
+++ b/utils/compile.go
@@ -22,3 +22,21 @@ func Compile(script string) ([]byte, error) {
return ethutil.Assemble(asm...), nil
}
+
+func CompileScript(script string) ([]byte, []byte, error) {
+ // Preprocess
+ mainInput, initInput := ethutil.PreProcess(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
+}