github.com/cheng762/platon-go@v1.8.17-0.20190529111256-7deff2d7be26/cmd/wasm/main.go (about) 1 package main 2 3 import ( 4 "github.com/PlatONnetwork/PlatON-Go/cmd/utils" 5 "fmt" 6 "gopkg.in/urfave/cli.v1" 7 "os" 8 ) 9 10 var ( 11 app = utils.NewApp("", "the wasm command line interface") 12 13 DebugFlag = cli.BoolFlag{ 14 Name: "debug", 15 Usage: "output full trace logs", 16 } 17 MemProfileFlag = cli.StringFlag{ 18 Name: "memprofile", 19 Usage: "creates a memory profile at the given path", 20 } 21 TxTypeFlag = cli.Int64Flag{ 22 Name: "txtype", 23 Usage: "The transaction type", 24 } 25 StatDumpFlag = cli.BoolFlag{ 26 Name: "statdump", 27 Usage: "displays stack and heap memory information", 28 } 29 CodeFlag = cli.StringFlag{ 30 Name: "code", 31 Usage: "WASM code", 32 } 33 CodeFileFlag = cli.StringFlag{ 34 Name: "codefile", 35 Usage: "File containing WASM code. If '-' is specified, code is read from stdin", 36 } 37 AbiFlag = cli.StringFlag{ 38 Name: "abi", 39 Usage: "WASM abi", 40 } 41 AbiFileFlag = cli.StringFlag{ 42 Name: "abifile", 43 Usage: "File containing WASM abi. If '-' is specified, abi is read from stdin", 44 } 45 GasFlag = cli.Uint64Flag{ 46 Name: "gas", 47 Usage: "gas limit for the wasm", 48 } 49 GasPriceFlag = utils.BigFlag{ 50 Name: "gasPrice", 51 Usage: "price set for the wasm", 52 } 53 ValueFlag = utils.BigFlag{ 54 Name: "value", 55 Usage: "value set for the wasm", 56 } 57 InputFlag = cli.StringFlag{ 58 Name: "input", 59 Usage: "input for the wasm", 60 } 61 VerbosityFlag = cli.IntFlag{ 62 Name: "verbosity", 63 Usage: "sets the verbosity level", 64 } 65 CreateFlag = cli.BoolFlag{ 66 Name: "create", 67 Usage: "indicates the action should be create rather than call", 68 } 69 GenesisFlag = cli.StringFlag{ 70 Name: "prestate", 71 Usage: "JSON file with prestate (genesis) config", 72 } 73 MachineFlag = cli.BoolFlag{ 74 Name: "json", 75 Usage: "output trace logs in machin readable format(json)", 76 } 77 SenderFlag = cli.StringFlag{ 78 Name: "sender", 79 Usage: "The transaction origin", 80 } 81 ReceiverFlag = cli.StringFlag{ 82 Name: "receiver", 83 Usage: "The transaction receiver (execution context)", 84 } 85 86 ) 87 88 func init() { 89 app.Flags = []cli.Flag{ 90 CreateFlag, 91 DebugFlag, 92 VerbosityFlag, 93 CodeFlag, 94 CodeFileFlag, 95 GasFlag, 96 GasPriceFlag, 97 ValueFlag, 98 InputFlag, 99 MemProfileFlag, 100 StatDumpFlag, 101 GenesisFlag, 102 MachineFlag, 103 SenderFlag, 104 ReceiverFlag, 105 } 106 app.Commands = []cli.Command{ 107 runCommond, 108 unittestCommand, 109 benchmarkCommand, 110 } 111 } 112 113 func main() { 114 if err := app.Run(os.Args); err != nil { 115 fmt.Fprintln(os.Stderr, err) 116 os.Exit(1) 117 } 118 }