block

package
v0.0.0-...-19da55a Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EVENT_ContractRewardCalculationEvent = "archway.gastracker.v1.ContractRewardCalculationEvent"
	EVENT_RewardDistributionEvent        = "archway.gastracker.v1.RewardDistributionEvent"

	EVENT_ContractRewardCalculationEvent_CONTRACT_ADDRESS  = EVENT_ContractRewardCalculationEvent + ".contract_address"
	EVENT_ContractRewardCalculationEvent_CONTRACT_REWARDS  = EVENT_ContractRewardCalculationEvent + ".contract_rewards"
	EVENT_ContractRewardCalculationEvent_GAS_CONSUMED      = EVENT_ContractRewardCalculationEvent + ".gas_consumed"
	EVENT_ContractRewardCalculationEvent_INFLATION_REWARDS = EVENT_ContractRewardCalculationEvent + ".inflation_rewards"
	EVENT_ContractRewardCalculationEvent_METADATA          = EVENT_ContractRewardCalculationEvent + ".metadata"
	EVENT_RewardDistributionEvent_CONTRACT_REWARDS         = EVENT_RewardDistributionEvent + ".contract_rewards"
	EVENT_RewardDistributionEvent_LEFTOVER_REWARDS         = EVENT_RewardDistributionEvent + ".leftover_rewards"
	EVENT_RewardDistributionEvent_REWARD_ADDRESS           = EVENT_RewardDistributionEvent + ".reward_address"

	EVENT_FIELD_DENOM                      = "denom"
	EVENT_FIELD_AMOUNT                     = "amount"
	EVENT_FIELD_DEVELOPER_ADDRESS          = "developer_address"
	EVENT_FIELD_REWARD_ADDRESS             = "reward_address"
	EVENT_FIELD_GAS_REBATE_TO_USER         = "gas_rebate_to_user"
	EVENT_FIELD_COLLECT_PREMIUM            = "collect_premium"
	EVENT_FIELD_PREMIUM_PERCENTAGE_CHARGED = "premium_percentage_charged"
)

Variables

This section is empty.

Functions

func GetLatestBlockHeight

func GetLatestBlockHeight(db *database.Database) (uint64, error)

func GetTotalBlocksByRange

func GetTotalBlocksByRange(start, end uint64, db *database.Database) (uint64, error)

func ProcessContractEvents

func ProcessContractEvents(grpcCnn *grpc.ClientConn, evr *coretypes.ResultEvent, db *database.Database, insertQueue *database.InsertQueue) error

func ProcessEvents

func ProcessEvents(grpcCnn *grpc.ClientConn, evr *coretypes.ResultEvent, db *database.Database, insertQueue *database.InsertQueue) error

func Start

func Start(cli *tmClient.HTTP, grpcCnn *grpc.ClientConn, db *database.Database, insertQueue *database.InsertQueue)

Types

type BlockRecord

type BlockRecord struct {
	BlockHash        string
	Height           uint64
	NumOfTxs         uint64
	Time             time.Time
	LastBlockSigners []BlockSignersRecord
}

type BlockSignersRecord

type BlockSignersRecord struct {
	BlockHeight uint64
	ValConsAddr string
	Time        time.Time
	Signature   string
}

type ContractRecord

type ContractRecord struct {
	ContractAddress  string
	RewardAddress    string
	DeveloperAddress string
	BlockHeight      uint64

	GasConsumed      uint64
	ContractRewards  GasTrackerReward // For sake of simplicity, we consider only one denom per record
	InflationRewards GasTrackerReward
	LeftoverRewards  GasTrackerReward

	CollectPremium           bool
	GasRebateToUser          bool
	PremiumPercentageCharged uint64

	MetadataJson string
}

type GasTrackerReward

type GasTrackerReward struct {
	Denom  string  `json:"denom"`
	Amount float64 `json:"amount"`
}

Jump to

Keyboard shortcuts

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