carrier

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Carrier

type Carrier interface {
	// BlockTimestamp returns the timestamp of a block
	BlockTimestamp(uint64) (time.Time, error)
	// SubscribeNewBlock callbacks on new block created
	SubscribeNewBlock(chan *TipInfo, chan error, chan bool)
	// Tip returns the latest height and its timestamp
	Tip() (*TipInfo, error)
	// Candidates returns the candidates on height
	Candidates(uint64, *big.Int, uint8) (*big.Int, []*types.Candidate, error)
	// Votes returns the votes on height
	Votes(uint64, *big.Int, uint8) (*big.Int, []*types.Vote, error)
	// Close closes carrier
	Close()
}

Carrier defines an interfact to fetch votes

func NewEthereumVoteCarrier

func NewEthereumVoteCarrier(
	clientURLs []string,
	registerContractAddress common.Address,
	stakingContractAddress common.Address,
) (Carrier, error)

NewEthereumVoteCarrier defines a carrier to fetch votes from ethereum contract

type EthClientPool added in v0.1.11

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

EthClientPool defines a set of ethereum clients with execute interface

func NewEthClientPool added in v0.1.11

func NewEthClientPool(urls []string) *EthClientPool

NewEthClientPool creates a new pool

func (*EthClientPool) Close added in v0.1.11

func (pool *EthClientPool) Close()

Close closes the current client if available

func (*EthClientPool) Execute added in v0.1.11

func (pool *EthClientPool) Execute(callback func(c *ethclient.Client) error) (err error)

Execute executes callback by rotating all client urls

type EthereumBucketsResult added in v0.1.1

type EthereumBucketsResult struct {
	Count           *big.Int
	Indexes         []*big.Int
	StakeStartTimes []*big.Int
	StakeDurations  []*big.Int
	Decays          []bool
	StakedAmounts   []*big.Int
	CanNames        [][12]byte
	Owners          []common.Address
}

EthereumBucketsResult defines the data structure the buckets api returns

type TipInfo added in v0.1.11

type TipInfo struct {
	Height    uint64
	BlockTime time.Time
}

TipInfo is the info of a tip block

Jump to

Keyboard shortcuts

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