2017-11-13 15:58:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
|
2017-11-14 15:14:34 +00:00
|
|
|
"fmt"
|
|
|
|
|
2017-11-13 15:58:36 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/cmd"
|
2017-12-04 21:36:11 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/contract_summary"
|
2017-11-27 15:21:21 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/geth"
|
2017-11-13 15:58:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
environment := flag.String("environment", "", "Environment name")
|
|
|
|
contractHash := flag.String("contract-hash", "", "Contract hash to show summary")
|
2017-12-04 18:54:33 +00:00
|
|
|
_blockNumber := flag.Int64("block-number", -1, "Block number of summary")
|
2017-11-13 15:58:36 +00:00
|
|
|
flag.Parse()
|
|
|
|
config := cmd.LoadConfig(*environment)
|
2018-01-05 17:55:00 +00:00
|
|
|
blockchain := geth.NewBlockchain(config.Client.IPCPath)
|
2017-12-07 19:32:16 +00:00
|
|
|
repository := cmd.LoadPostgres(config.Database, blockchain.Node())
|
2017-12-11 21:08:00 +00:00
|
|
|
blockNumber := cmd.RequestedBlockNumber(_blockNumber)
|
2017-12-04 18:54:33 +00:00
|
|
|
|
2017-12-04 21:36:11 +00:00
|
|
|
contractSummary, err := contract_summary.NewSummary(blockchain, repository, *contractHash, blockNumber)
|
2017-11-13 15:58:36 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatalln(err)
|
|
|
|
}
|
2017-12-04 21:36:11 +00:00
|
|
|
output := contract_summary.GenerateConsoleOutput(contractSummary)
|
2017-11-14 15:14:34 +00:00
|
|
|
fmt.Println(output)
|
2017-11-13 15:58:36 +00:00
|
|
|
}
|