client

package
v0.0.0-...-23a414b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartsDAIDaemonTaskLoop

func StartsDAIDaemonTaskLoop(
	ctx context.Context,
	c *Client,
	ticker *time.Ticker,
	stop <-chan bool,
	s SubTaskRunner,
	ethClient *ethclient.Client,
	queryClient ethqueryclienttypes.EthQueryClient,
	serviceClient api.SDAIServiceClient,
)

StartsDAIDaemonTaskLoop operates the continuous loop that runs the sDAI daemon. It receives as arguments a ticker and a stop channel that are used to control and halt the loop.

Types

type Client

type Client struct {
	daemontypes.HealthCheckable
	// contains filtered or unexported fields
}

Client encapsulates the logic and interface for the sDAI daemon. The sDAI daemon periodically queries the Ethereum blockchain for new sDAI conversion rate and relays them to the Cosmos gRPC server.

func NewClient

func NewClient(logger log.Logger) *Client

func (*Client) Start

func (c *Client) Start(
	ctx context.Context,
	flags daemonflags.DaemonFlags,
	appFlags appflags.Flags,
	grpcClient daemontypes.GrpcClient,
) error

Start begins a job that periodically runs the RunSDAIDaemonTaskLoop function.

func (*Client) Stop

func (c *Client) Stop()

Stop signals the daemon to stop.

type SubTaskRunner

type SubTaskRunner interface {
	RunsDAIDaemonTaskLoop(
		ctx context.Context,
		logger log.Logger,
		ethClient *ethclient.Client,
		queryClient ethqueryclienttypes.EthQueryClient,
		serviceClient api.SDAIServiceClient,
	) error
}

type SubTaskRunnerImpl

type SubTaskRunnerImpl struct{}

func (*SubTaskRunnerImpl) RunsDAIDaemonTaskLoop

func (s *SubTaskRunnerImpl) RunsDAIDaemonTaskLoop(
	ctx context.Context,
	logger log.Logger,
	ethClient *ethclient.Client,
	queryClient ethqueryclienttypes.EthQueryClient,
	serviceClient api.SDAIServiceClient,
) error

RunsDAIDaemonTaskLoop does the following: 1) Fetches sDAI conversion rate from a configured Ethereum client. 2) Sends sDAI conversion rate to the gRPC server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL