reward

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DelegateRewardPerLength = 1000

Variables

View Source
var (
	HistoryIncreasePrefix    = []byte("RewardHistory")
	LastYearEndBalancePrefix = []byte("RewardBalance")
	YearStartBlockNumberKey  = []byte("YearStartBlockNumberKey")
	YearStartTimeKey         = []byte("YearStartTimeKey")
	RemainingRewardKey       = []byte("RemainingRewardKey")
	NewBlockRewardKey        = []byte("NewBlockRewardKey")
	StakingRewardKey         = []byte("StakingRewardKey")
	ChainYearNumberKey       = []byte("ChainYearNumberKey")
)
View Source
var (
	ErrDelegationNotFound = common.NewBizError(305001, "Delegation info not found")
)

Functions

func DelegateRewardPerKey

func DelegateRewardPerKey(nodeID discover.NodeID, stakingNum, epoch uint64) []byte

func DelegateRewardPerKeys

func DelegateRewardPerKeys(nodeID discover.NodeID, stakingNum, fromEpoch, toEpoch uint64) [][]byte

func GetHistoryIncreaseKey

func GetHistoryIncreaseKey(year uint32) []byte

GetHistoryIncreaseKey used for search the balance of reward pool at last year

func HistoryBalancePrefix

func HistoryBalancePrefix(year uint32) []byte

Types

type DelegateRewardPer

type DelegateRewardPer struct {
	//this is the node total effective delegate  amount at this epoch,will Decrease when receive delegate reward
	Left  *big.Int
	Epoch uint64
	//this is the node total delegate reward per amount at this epoch
	Delegate *big.Int
	//this is the node total effective delegate  amount at this epoch
	Reward *big.Int
}

func NewDelegateRewardPer

func NewDelegateRewardPer(epoch uint64, totalReward, totalDelegate *big.Int) *DelegateRewardPer

func (*DelegateRewardPer) CalDelegateReward

func (d *DelegateRewardPer) CalDelegateReward(delegate *big.Int) *big.Int

type DelegateRewardPerList

type DelegateRewardPerList struct {
	Pers []*DelegateRewardPer
	// contains filtered or unexported fields
}

func NewDelegateRewardPerList

func NewDelegateRewardPerList() *DelegateRewardPerList

func (*DelegateRewardPerList) AppendDelegateRewardPer

func (d *DelegateRewardPerList) AppendDelegateRewardPer(per *DelegateRewardPer)

func (*DelegateRewardPerList) DecreaseTotalAmount

func (d *DelegateRewardPerList) DecreaseTotalAmount(receipt []DelegateRewardReceipt) int

func (*DelegateRewardPerList) IsChange

func (d *DelegateRewardPerList) IsChange() bool

func (*DelegateRewardPerList) ShouldDel

func (d *DelegateRewardPerList) ShouldDel() bool

func (DelegateRewardPerList) String

func (d DelegateRewardPerList) String() string

type DelegateRewardReceipt

type DelegateRewardReceipt struct {
	//this is the account  total effective delegate amount with the node  on this epoch
	Delegate *big.Int
	Epoch    uint64
}

type NodeDelegateReward

type NodeDelegateReward struct {
	NodeID     discover.NodeID `json:"nodeID"`
	StakingNum uint64          `json:"stakingNum"`
	Reward     *big.Int        `json:"reward" rlp:"nil"`
}

type NodeDelegateRewardPresenter

type NodeDelegateRewardPresenter struct {
	NodeID     discover.NodeID `json:"nodeID" `
	Reward     *hexutil.Big    `json:"reward" `
	StakingNum uint64          `json:"stakingNum"`
}

Jump to

Keyboard shortcuts

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