Skip to content

Commit

Permalink
Preserve globals of smart contracts into account state. (#151)
Browse files Browse the repository at this point in the history
* Revert "Changed to urfave/cli for the shell, added autocompletion, some 80 col changes. (#121)"

This reverts commit 67033d2.

* sys/const, contract, db: Preserve globals for contracts.
  • Loading branch information
losfair authored and iwasaki-kenta committed Aug 6, 2019
1 parent 3f92943 commit 0c18e67
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 530 deletions.
245 changes: 0 additions & 245 deletions cmd/wavelet/cli.go

This file was deleted.

41 changes: 0 additions & 41 deletions cmd/wavelet/completion.go

This file was deleted.

34 changes: 11 additions & 23 deletions cmd/wavelet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ type Config struct {
}

func main() {
log.SetWriter(
log.LoggerWavelet,
log.NewConsoleWriter(nil, log.FilterFor(
log.ModuleNode,
log.ModuleNetwork,
log.ModuleSync,
log.ModuleConsensus,
log.ModuleContract,
)),
)

log.SetWriter(log.LoggerWavelet, log.NewConsoleWriter(nil, log.FilterFor(log.ModuleNode, log.ModuleNetwork, log.ModuleSync, log.ModuleConsensus, log.ModuleContract)))
logger := log.Node()

app := cli.NewApp()
Expand Down Expand Up @@ -176,15 +166,13 @@ func main() {
}

// apply the toml before processing the flags
app.Before = altsrc.InitInputSourceWithContext(
app.Flags, func(c *cli.Context) (altsrc.InputSourceContext, error) {
filePath := c.String("config")
if len(filePath) > 0 {
return altsrc.NewTomlSourceFromFile(filePath)
}
return &altsrc.MapInputSource{}, nil
},
)
app.Before = altsrc.InitInputSourceWithContext(app.Flags, func(c *cli.Context) (altsrc.InputSourceContext, error) {
filePath := c.String("config")
if len(filePath) > 0 {
return altsrc.NewTomlSourceFromFile(filePath)
}
return &altsrc.MapInputSource{}, nil
})

cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("Version: %s\n", c.App.Version)
Expand Down Expand Up @@ -228,9 +216,9 @@ func main() {
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.CommandsByName(app.Commands))

if err := app.Run(os.Args); err != nil {
logger.Fatal().Err(err).
Msg("Failed to parse configuration/command-line arguments.")
err := app.Run(os.Args)
if err != nil {
logger.Fatal().Err(err).Msg("Failed to parse configuration/command-line arguments.")
}
}

Expand Down
Loading

0 comments on commit 0c18e67

Please sign in to comment.