carrier

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: GPL-3.0 Imports: 12 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 uint64, chan error, chan bool)
	// HasStakingEvents returns true if there is any staking related events or error
	HasStakingEvents(*big.Int, *big.Int) bool
	// Tip returns the latest height and its timestamp
	Tip() (uint64, error)
	// Registrations returns the candidate registrations on height
	Registrations(uint64, *big.Int, uint8) (*big.Int, []*types.Registration, error)
	// Buckets returns the buckets on height
	Buckets(uint64, *big.Int, uint8) (*big.Int, []*types.Bucket, error)
	// Close closes carrier
	Close()
}

Carrier defines an interfact to fetch votes

func NewEthereumVoteCarrier

func NewEthereumVoteCarrier(
	confirmHeight uint64,
	tickerDuration time.Duration,
	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

Jump to

Keyboard shortcuts

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