gitlab.com/flarenetwork/coreth@v0.1.1/plugin/main.go (about)

     1  // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package main
     5  
     6  import (
     7  	"fmt"
     8  	"os"
     9  
    10  	"github.com/ethereum/go-ethereum/log"
    11  	"github.com/hashicorp/go-plugin"
    12  
    13  	"github.com/ava-labs/avalanchego/vms/rpcchainvm"
    14  
    15  	"gitlab.com/flarenetwork/coreth/plugin/evm"
    16  )
    17  
    18  func main() {
    19  	version, err := PrintVersion()
    20  	if err != nil {
    21  		fmt.Printf("couldn't get config: %s", err)
    22  		os.Exit(1)
    23  	}
    24  	if version {
    25  		fmt.Println(evm.Version)
    26  		os.Exit(0)
    27  	}
    28  	// Set the Ethereum logger to debug by default
    29  	log.Root().SetHandler(log.LvlFilterHandler(log.LvlDebug, log.StreamHandler(os.Stderr, log.TerminalFormat(false))))
    30  	plugin.Serve(&plugin.ServeConfig{
    31  		HandshakeConfig: rpcchainvm.Handshake,
    32  		Plugins: map[string]plugin.Plugin{
    33  			"vm": rpcchainvm.New(&evm.VM{}),
    34  		},
    35  
    36  		// A non-nil value here enables gRPC serving for this plugin...
    37  		GRPCServer: plugin.DefaultGRPCServer,
    38  	})
    39  }