github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/cmd/evm/main.go (about) 1 2 // evm executes EVM code snippets. 3 package main 4 5 import ( 6 "fmt" 7 "math/big" 8 "os" 9 10 "github.com/quickchainproject/quickchain/cmd/utils" 11 "gopkg.in/urfave/cli.v1" 12 ) 13 14 var gitCommit = "" // Git SHA1 commit hash of the release (set via linker flags) 15 16 var ( 17 app = utils.NewApp(gitCommit, "the evm command line interface") 18 19 DebugFlag = cli.BoolFlag{ 20 Name: "debug", 21 Usage: "output full trace logs", 22 } 23 MemProfileFlag = cli.StringFlag{ 24 Name: "memprofile", 25 Usage: "creates a memory profile at the given path", 26 } 27 CPUProfileFlag = cli.StringFlag{ 28 Name: "cpuprofile", 29 Usage: "creates a CPU profile at the given path", 30 } 31 StatDumpFlag = cli.BoolFlag{ 32 Name: "statdump", 33 Usage: "displays stack and heap memory information", 34 } 35 CodeFlag = cli.StringFlag{ 36 Name: "code", 37 Usage: "EVM code", 38 } 39 CodeFileFlag = cli.StringFlag{ 40 Name: "codefile", 41 Usage: "File containing EVM code. If '-' is specified, code is read from stdin ", 42 } 43 GasFlag = cli.Uint64Flag{ 44 Name: "gas", 45 Usage: "gas limit for the evm", 46 Value: 10000000000, 47 } 48 PriceFlag = utils.BigFlag{ 49 Name: "price", 50 Usage: "price set for the evm", 51 Value: new(big.Int), 52 } 53 ValueFlag = utils.BigFlag{ 54 Name: "value", 55 Usage: "value set for the evm", 56 Value: new(big.Int), 57 } 58 DumpFlag = cli.BoolFlag{ 59 Name: "dump", 60 Usage: "dumps the state after the run", 61 } 62 InputFlag = cli.StringFlag{ 63 Name: "input", 64 Usage: "input for the EVM", 65 } 66 VerbosityFlag = cli.IntFlag{ 67 Name: "verbosity", 68 Usage: "sets the verbosity level", 69 } 70 CreateFlag = cli.BoolFlag{ 71 Name: "create", 72 Usage: "indicates the action should be create rather than call", 73 } 74 GenesisFlag = cli.StringFlag{ 75 Name: "prestate", 76 Usage: "JSON file with prestate (genesis) config", 77 } 78 MachineFlag = cli.BoolFlag{ 79 Name: "json", 80 Usage: "output trace logs in machine readable format (json)", 81 } 82 SenderFlag = cli.StringFlag{ 83 Name: "sender", 84 Usage: "The transaction origin", 85 } 86 ReceiverFlag = cli.StringFlag{ 87 Name: "receiver", 88 Usage: "The transaction receiver (execution context)", 89 } 90 DisableMemoryFlag = cli.BoolFlag{ 91 Name: "nomemory", 92 Usage: "disable memory output", 93 } 94 DisableStackFlag = cli.BoolFlag{ 95 Name: "nostack", 96 Usage: "disable stack output", 97 } 98 ) 99 100 func init() { 101 app.Flags = []cli.Flag{ 102 CreateFlag, 103 DebugFlag, 104 VerbosityFlag, 105 CodeFlag, 106 CodeFileFlag, 107 GasFlag, 108 PriceFlag, 109 ValueFlag, 110 DumpFlag, 111 InputFlag, 112 MemProfileFlag, 113 CPUProfileFlag, 114 StatDumpFlag, 115 GenesisFlag, 116 MachineFlag, 117 SenderFlag, 118 ReceiverFlag, 119 DisableMemoryFlag, 120 DisableStackFlag, 121 } 122 app.Commands = []cli.Command{ 123 compileCommand, 124 disasmCommand, 125 runCommand, 126 stateTestCommand, 127 } 128 } 129 130 func main() { 131 if err := app.Run(os.Args); err != nil { 132 fmt.Fprintln(os.Stderr, err) 133 os.Exit(1) 134 } 135 }