rewards

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolID is the ID of protocol
	ProtocolID = "rewards"
	// RewardHistoryTableName is the table name of reward history
	RewardHistoryTableName = "reward_history"
	// AccountRewardTableName is the table name of account rewards
	AccountRewardTableName = "account_reward"
	// EpochCandidateIndexName is the index name of epoch number and candidate name on account reward view
	EpochCandidateIndexName = "epoch_candidate_index"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountReward

type AccountReward struct {
	EpochNumber     uint64
	CandidateName   string
	BlockReward     string
	EpochReward     string
	FoundationBonus string
}

AccountReward defines the schema of "account reward" view

type Protocol

type Protocol struct {
	Store                 s.Store
	NumDelegates          uint64
	NumCandidateDelegates uint64
	NumSubEpochs          uint64
	RewardAddrToName      map[string]string
}

Protocol defines the protocol of indexing blocks

func NewProtocol

func NewProtocol(store s.Store, numDelegates uint64, numSubEpochs uint64) *Protocol

NewProtocol creates a new protocol

func (*Protocol) CreateTables

func (p *Protocol) CreateTables(ctx context.Context) error

CreateTables creates tables

func (*Protocol) HandleBlock

func (p *Protocol) HandleBlock(ctx context.Context, tx *sql.Tx, blk *block.Block) error

HandleBlock handles blocks

func (*Protocol) Initialize

func (p *Protocol) Initialize(context.Context, *sql.Tx, *indexprotocol.Genesis) error

Initialize initializes rewards protocol

type RewardHistory

type RewardHistory struct {
	EpochNumber     uint64
	ActionHash      string
	RewardAddress   string
	CandidateName   string
	BlockReward     string
	EpochReward     string
	FoundationBonus string
}

RewardHistory defines the schema of "reward history" table

type RewardInfo

type RewardInfo struct {
	BlockReward     *big.Int
	EpochReward     *big.Int
	FoundationBonus *big.Int
}

RewardInfo indicates the amount of different reward types

Jump to

Keyboard shortcuts

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