forked from cerc-io/ipld-eth-server
70cfa20c68
* Downcase all arguments for contact watching * ABI retrieval from test networks
32 lines
904 B
Go
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)
|
|
}
|