-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.go
More file actions
54 lines (45 loc) · 1.05 KB
/
build.go
File metadata and controls
54 lines (45 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"context"
"fmt"
cli "github.com/jawher/mow.cli"
log "github.com/xlab/suplog"
"github.com/InjectiveLabs/etherman/deployer"
)
func onBuild(cmd *cli.Cmd) {
standardJSON := cmd.BoolOpt("j standard-json", false, "Output standard JSON for use in --standard-json of solc, also Etherscan verification")
cmd.Action = func() {
d, err := deployer.New(
// only options applicable to build
deployer.OptionNoCache(*noCache),
deployer.OptionBuildCacheDir(*buildCacheDir),
deployer.OptionSolcAllowedPaths(*solAllowedPaths),
deployer.OptionEnableCoverage(*coverage),
)
if err != nil {
log.WithError(err).Fatalln("failed to init deployer")
}
contract, err := d.Build(
context.Background(),
*solSource,
*contractName,
)
if err != nil {
log.Fatalln(err)
}
if *standardJSON {
out, err := collectPathsToStandardJSON(
contract.AllPaths,
true,
200,
EVMVersionIstanbul,
)
if err != nil {
log.Fatalln(err)
}
fmt.Println(string(out))
return
}
fmt.Println(contract.Bin)
}
}