|
|
@ -21,9 +21,11 @@ import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
|
|
|
|
"path/filepath" |
|
|
|
"regexp" |
|
|
|
"regexp" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/accounts/abi" |
|
|
|
"github.com/ethereum/go-ethereum/accounts/abi/bind" |
|
|
|
"github.com/ethereum/go-ethereum/accounts/abi/bind" |
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils" |
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils" |
|
|
|
"github.com/ethereum/go-ethereum/common/compiler" |
|
|
|
"github.com/ethereum/go-ethereum/common/compiler" |
|
|
@ -193,10 +195,22 @@ func abigen(c *cli.Context) error { |
|
|
|
utils.Fatalf("Failed to build Solidity contract: %v", err) |
|
|
|
utils.Fatalf("Failed to build Solidity contract: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
case c.GlobalIsSet(vyFlag.Name): |
|
|
|
case c.GlobalIsSet(vyFlag.Name): |
|
|
|
contracts, err = compiler.CompileVyper(c.GlobalString(vyperFlag.Name), c.GlobalString(vyFlag.Name)) |
|
|
|
output, err := compiler.CompileVyper(c.GlobalString(vyperFlag.Name), c.GlobalString(vyFlag.Name)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
utils.Fatalf("Failed to build Vyper contract: %v", err) |
|
|
|
utils.Fatalf("Failed to build Vyper contract: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
contracts = make(map[string]*compiler.Contract) |
|
|
|
|
|
|
|
for n, contract := range output { |
|
|
|
|
|
|
|
name := n |
|
|
|
|
|
|
|
// Sanitize the combined json names to match the
|
|
|
|
|
|
|
|
// format expected by solidity.
|
|
|
|
|
|
|
|
if !strings.Contains(n, ":") { |
|
|
|
|
|
|
|
// Remove extra path components
|
|
|
|
|
|
|
|
name = abi.ToCamelCase(strings.TrimSuffix(filepath.Base(name), ".vy")) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
contracts[name] = contract |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case c.GlobalIsSet(jsonFlag.Name): |
|
|
|
case c.GlobalIsSet(jsonFlag.Name): |
|
|
|
jsonOutput, err := ioutil.ReadFile(c.GlobalString(jsonFlag.Name)) |
|
|
|
jsonOutput, err := ioutil.ReadFile(c.GlobalString(jsonFlag.Name)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|