+func handleCompiled(args []string) error {
+ contractFile, err := os.Open(args[0])
+ if err != nil {
+ fmt.Printf("An error [%v] occurred on opening the file, please check whether the file exists or can be accessed.\n", err)
+ return err
+ }
+ defer contractFile.Close()
+
+ reader := bufio.NewReader(contractFile)
+ contracts, err := compiler.Compile(reader)
+ if err != nil {
+ fmt.Println("Compile contract failed:", err)
+ return err
+ }
+
+ // Print the result for all contracts
+ for i, contract := range contracts {
+ fmt.Printf("======= %v =======\n", contract.Name)
+ if bin {
+ fmt.Println("Binary:")
+ fmt.Printf("%v\n\n", hex.EncodeToString(contract.Body))