Documentation
¶
Overview ¶
Package reward implements the Klaytn reward system.
Index ¶
Constants ¶
View Source
const (
AddrNotFoundInCouncilNodes = -1
)
View Source
const (
DefaultGiniCoefficient = -1.0
)
Variables ¶
This section is empty.
Functions ¶
func DistributeBlockReward ¶
func DistributeBlockReward(b BalanceAdder, header *types.Header, pocAddr common.Address, kirAddr common.Address, config *params.ChainConfig)
DistributeBlockReward distributes block reward to proposer, kirAddr and pocAddr.
func MintKLAY ¶
func MintKLAY(b BalanceAdder, header *types.Header, gov *governance.Governance) error
MintKLAY mints KLAY and gives the KLAY to the block proposer
func Subscribe ¶
func Subscribe(bc *blockchain.BlockChain)
Subscribe setups a channel to listen chain head event and starts a goroutine to update staking cache.
Types ¶
type Reward ¶
type Reward struct { *contract.KlaytnRewardSession // contains filtered or unexported fields }
func DeployReward ¶
func DeployReward(transactOpts *bind.TransactOpts, contractBackend bind.ContractBackend) (common.Address, *Reward, error)
func NewReward ¶
func NewReward(transactOpts *bind.TransactOpts, contractAddr common.Address, contractBackend bind.ContractBackend) (*Reward, error)
type StakingInfo ¶
type StakingInfo struct { BlockNum uint64 // Block number where staking information of Council is fetched // Information retrieved from AddressBook smart contract CouncilNodeIds []common.Address // NodeIds of Council CouncilStakingdAddrs []common.Address // Address of Staking account which holds staking balance CouncilRewardAddrs []common.Address // Address of Council account which will get block reward KIRAddr common.Address // Address of KIR contract PoCAddr common.Address // Address of PoC contract UseGini bool Gini float64 // gini coefficient // Derived from CouncilStakingAddrs CouncilStakingAmounts []uint64 // Staking amounts of Council }
StakingInfo contains staking information.
func GetStakingInfoFromStakingCache ¶
func GetStakingInfoFromStakingCache(blockNum uint64) *StakingInfo
GetStakingInfoFromStakingCache returns corresponding staking information for a block of blockNum.
func (*StakingInfo) CalcGiniCoefficientOfValidators ¶
func (s *StakingInfo) CalcGiniCoefficientOfValidators(validators []istanbul.Validator)
func (*StakingInfo) GetIndexByNodeId ¶
func (s *StakingInfo) GetIndexByNodeId(nodeId common.Address) int
func (*StakingInfo) GetStakingAmountByNodeId ¶
func (s *StakingInfo) GetStakingAmountByNodeId(nodeId common.Address) uint64
func (*StakingInfo) String ¶
func (s *StakingInfo) String() string
Click to show internal directories.
Click to hide internal directories.