mirror of
https://github.com/GrassrootsEconomics/cic-dw.git
synced 2024-09-21 16:17:22 +02:00
Mohammed Sohail
05ab865c63
core: - add koanf for runtime config loading - cicnet connection must dial else panic - add db connection init - add goyesql for convenient querying - add async tasker processor (scheduler, processor) dev: - add redis server to dev docker-compose - update volume to prune-able local
30 lines
466 B
Go
30 lines
466 B
Go
package cicnet
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/lmittmann/w3"
|
|
)
|
|
|
|
type CicNet struct {
|
|
ethClient *w3.Client
|
|
tokenIndex common.Address
|
|
}
|
|
|
|
func NewCicNet(rpcEndpoint string, tokenIndex common.Address) *CicNet {
|
|
ethClient := w3.MustDial(rpcEndpoint)
|
|
|
|
return &CicNet{
|
|
ethClient: ethClient,
|
|
tokenIndex: tokenIndex,
|
|
}
|
|
}
|
|
|
|
func (c *CicNet) Close() error {
|
|
err := c.ethClient.Close()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|