diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-23 21:54:34 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-23 21:54:34 +0800 |
commit | 43f1214f97e52863b1f1ef7913991bef3d00c58e (patch) | |
tree | 247b4739b26f00f2f912f23592ca3ff4b2ed38ec /utils | |
parent | b962779a1318138e08c6e84a537fdbc6c9ebfd97 (diff) | |
download | go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.gz go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.bz2 go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.lz go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.xz go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.tar.zst go-tangerine-43f1214f97e52863b1f1ef7913991bef3d00c58e.zip |
Refactored code
Diffstat (limited to 'utils')
-rw-r--r-- | utils/compile.go | 18 |
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 +} |