2022-04-29 10:09:10 +02:00
|
|
|
package cicnet
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/lmittmann/w3"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CicNet struct {
|
|
|
|
ethClient *w3.Client
|
|
|
|
tokenIndex common.Address
|
|
|
|
}
|
|
|
|
|
2022-05-03 17:54:51 +02:00
|
|
|
func NewCicNet(rpcEndpoint string, tokenIndex common.Address) *CicNet {
|
|
|
|
ethClient := w3.MustDial(rpcEndpoint)
|
2022-04-29 10:09:10 +02:00
|
|
|
|
|
|
|
return &CicNet{
|
|
|
|
ethClient: ethClient,
|
|
|
|
tokenIndex: tokenIndex,
|
2022-05-03 17:54:51 +02:00
|
|
|
}
|
2022-04-29 10:09:10 +02:00
|
|
|
}
|
|
|
|
|
2022-04-29 10:12:47 +02:00
|
|
|
func (c *CicNet) Close() error {
|
|
|
|
err := c.ethClient.Close()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
2022-04-29 10:09:10 +02:00
|
|
|
}
|