tokenrate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ETHUSDRate

type ETHUSDRate struct {
	Timestamp   time.Time
	Rate        float64
	Provider    string
	BlockNumber uint64
}

ETHUSDRate represent rate for usd

type ETHUSDRateFetcher

type ETHUSDRateFetcher struct {
	// contains filtered or unexported fields
}

ETHUSDRateFetcher represent fetcher for ETH-USD rate

func NewETHUSDRateFetcher

func NewETHUSDRateFetcher(sugar *zap.SugaredLogger, dbName string, client client.Client, rateProvider tokenrate.ETHUSDRateProvider) (*ETHUSDRateFetcher, error)

NewETHUSDRateFetcher return new instance of ETHUSDFetcher

func (*ETHUSDRateFetcher) FetchRates

func (ef *ETHUSDRateFetcher) FetchRates(blockNumber uint64, timestamp time.Time) (ETHUSDRate, error)

FetchRates fetch ETH-USD rate and save to db

func (ETHUSDRateFetcher) SaveTokenRate

func (ef ETHUSDRateFetcher) SaveTokenRate(rate ETHUSDRate) error

SaveTokenRate into influx

type Mock

type Mock struct{}

Mock is a mock tokenrate.Provider to use in tests.

func NewMock

func NewMock() *Mock

NewMock returns a new Mock instance.

func (*Mock) Name

func (m *Mock) Name() string

Name is a mock method to satisfy the tokenrate.USDRatePrivder interface.

func (*Mock) Rate

func (m *Mock) Rate(_, _ string, _ time.Time) (float64, error)

Rate is a mock method to satisfy the tokenrate.Provider interface.

func (*Mock) USDRate

func (m *Mock) USDRate(_ time.Time) (float64, error)

USDRate is a mock method to satisfy the tokenrate.USDRateProvider interface.

Jump to

Keyboard shortcuts

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