ipld-eth-server/cmd/watch_contract/main.go
Matt K 70cfa20c68 Watch contact updates (#127)
* Downcase all arguments for contact watching

* ABI retrieval from test networks
2018-01-08 15:59:47 -06:00

32 lines
904 B
Go

package main
import (
"flag"
"strings"
"github.com/8thlight/vulcanizedb/cmd"
"github.com/8thlight/vulcanizedb/pkg/core"
"github.com/8thlight/vulcanizedb/pkg/geth"
)
func main() {
environment := flag.String("environment", "", "Environment name")
contractHash := flag.String("contract-hash", "", "contract-hash=x1234")
abiFilepath := flag.String("abi-filepath", "", "path/to/abifile.json")
network := flag.String("network", "", "ropsten")
flag.Parse()
contractHashLowered := strings.ToLower(*contractHash)
contractAbiString := cmd.GetAbi(*abiFilepath, contractHashLowered, *network)
config := cmd.LoadConfig(*environment)
blockchain := geth.NewBlockchain(config.Client.IPCPath)
repository := cmd.LoadPostgres(config.Database, blockchain.Node())
watchedContract := core.Contract{
Abi: contractAbiString,
Hash: contractHashLowered,
}
repository.CreateContract(watchedContract)
}