Skip to content

Commit

Permalink
Added OwnableERC721 example
Browse files Browse the repository at this point in the history
Tested deployment. It is working!
  • Loading branch information
Neeraj Kashyap committed Feb 4, 2024
1 parent a5eb448 commit 2f583f8
Show file tree
Hide file tree
Showing 5 changed files with 1,568 additions and 1 deletion.
9 changes: 8 additions & 1 deletion evm/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func AddCLI(sourceCode, structName string) (string, error) {
case *ast.GenDecl:
// Add additional imports:
// - context
// - encoding/hex
// - fmt
// - os
// - time
Expand All @@ -382,6 +383,7 @@ func AddCLI(sourceCode, structName string) (string, error) {
t.Specs = append(
t.Specs,
&ast.ImportSpec{Path: &ast.BasicLit{Value: `"context"`}},
&ast.ImportSpec{Path: &ast.BasicLit{Value: `"encoding/hex"`}},
&ast.ImportSpec{Path: &ast.BasicLit{Value: `"fmt"`}},
&ast.ImportSpec{Path: &ast.BasicLit{Value: `"os"`}},
&ast.ImportSpec{Path: &ast.BasicLit{Value: `"time"`}},
Expand Down Expand Up @@ -584,6 +586,10 @@ func Create{{.StructName}}Command() *cobra.Command {
}
cmd.AddGroup(DeployGroup, ViewGroup, TransactGroup)
cmd{{.DeployHandler.MethodName}} := {{.DeployHandler.HandlerName}}()
cmd{{.DeployHandler.MethodName}}.GroupID = DeployGroup.ID
cmd.AddCommand(cmd{{.DeployHandler.MethodName}})
return cmd
}
`
Expand Down Expand Up @@ -672,8 +678,9 @@ func {{.DeployHandler.HandlerName}}() *cobra.Command {
if transactionBinaryErr != nil {
return transactionBinaryErr
}
transactionBinaryHex := hex.EncodeToString(transactionBinary)
cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinary, gasEstimate)
cmd.Printf("Transaction: %s\nEstimated gas: %d\n", transactionBinaryHex, gasEstimate)
} else {
cmd.Println("Transaction submitted")
}
Expand Down
Loading

0 comments on commit 2f583f8

Please sign in to comment.