good morning!!!!

Skip to content
Snippets Groups Projects
Select Git revision
  • 206672db5e2fe99892013e80ce4b5fa60ba8a196
  • master default protected
  • v0.2.16-candidate
  • shivam/rpcAddBorTx
  • default-cli-config
  • shivam/minerRecommitFix
  • vcastellm/pos-296-bump-go-version-in-bor-and-heimdall
  • shivam/ethstats-backend-fix
  • v0.2.16-beta1-candidate
  • v0.2.15-beta3-candidate
  • shivam/newCli-IPC
  • v0.3.0-dev
  • checkpoint-whitelist-master
  • shivam/codecov
  • jdkanani/fix-typo-log
  • shivam/hardcoded-spans-v0.2.14
  • shivam/hardcoded-spans
  • shivam/fast-state-sync
  • shivam/fast-state-sync-master
  • gethv1.10.15-merge
  • fix-txpool-2
  • v0.2.14-tmp-span-hotfix
  • v0.2.15-beta2
  • v0.2.15-beta1
  • v0.3.0-beta3
  • v0.3.0-beta2
  • v0.3.0-beta1
  • v0.2.14
  • v0.2.13
  • v0.2.13-beta2
  • v0.2.13-beta1
  • v0.2.12
  • v0.2.12-beta3
  • v0.2.12-beta1
  • v0.2.12-beta2
  • v0.2.11
  • v0.2.10
  • v0.2.10-beta2
  • v0.2.9
  • v0.2.9-beta1
  • v0.2.8
41 results

script.go

Blame
  • Forked from github / maticnetwork / bor
    11877 commits behind the upstream repository.
    user avatar
    Nick Savers authored
    c5828905
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    script.go 936 B
    // +build !windows !cgo
    
    package ethutil
    
    import (
    	"fmt"
    	"strings"
    
    	"github.com/obscuren/mutan"
    	"github.com/obscuren/mutan/backends"
    	"github.com/obscuren/serpent-go"
    )
    
    // General compile function
    func Compile(script string, silent bool) (ret []byte, err error) {
    	if len(script) > 2 {
    		line := strings.Split(script, "\n")[0]
    
    		if len(line) > 1 && line[0:2] == "#!" {
    			switch line {
    			case "#!serpent":
    				byteCode, err := serpent.Compile(script)
    				if err != nil {
    					return nil, err
    				}
    
    				return byteCode, nil
    			}
    		} else {
    
    			compiler := mutan.NewCompiler(backend.NewEthereumBackend())
    			compiler.Silent = silent
    			byteCode, errors := compiler.Compile(strings.NewReader(script))
    			if len(errors) > 0 {
    				var errs string
    				for _, er := range errors {
    					if er != nil {
    						errs += er.Error()
    					}
    				}
    				return nil, fmt.Errorf("%v", errs)
    			}
    
    			return byteCode, nil
    		}
    	}
    
    	return nil, nil
    }