Documentation ¶
Index ¶
- Variables
- type Interval
- type IntervalReward
- type Options
- type RewardAmount
- type RewardCached
- type RewardCalculator
- func (calc *RewardCalculator) Burnedout() bool
- func (calc *RewardCalculator) Calculate() (amt *balance.Amount, err error)
- func (calc *RewardCalculator) Init(blockStore *tmstore.BlockStore)
- func (calc *RewardCalculator) Reset(height int64, rewardYears RewardYears)
- func (rws *RewardCalculator) SetOptions(options *Options)
- type RewardCumuState
- type RewardCumulativeStore
- func (rws *RewardCumulativeStore) AddMaturedBalance(validator keys.Address, amount *balance.Amount) error
- func (rws *RewardCumulativeStore) ConsumeRewards(consumed *balance.Amount) error
- func (rws *RewardCumulativeStore) GetMaturedBalance(validator keys.Address) (amt *balance.Amount, err error)
- func (rws *RewardCumulativeStore) GetMaturedRewards(validator keys.Address) (amt *balance.Amount, err error)
- func (rws *RewardCumulativeStore) GetOptions() *Options
- func (rws *RewardCumulativeStore) GetTotalDistributedRewards() (amt *balance.Amount, err error)
- func (rws *RewardCumulativeStore) GetWithdrawnRewards(validator keys.Address) (amt *balance.Amount, err error)
- func (rws *RewardCumulativeStore) GetYearDistributedRewards() (rewardYears RewardYears, err error)
- func (rws *RewardCumulativeStore) Init(blockStore *tmstore.BlockStore)
- func (rws *RewardCumulativeStore) PullRewards(height int64, poolAmt *balance.Amount) (amount *balance.Amount, err error)
- func (rws *RewardCumulativeStore) SetOptions(options *Options)
- func (rws *RewardCumulativeStore) WithState(state *storage.State) *RewardCumulativeStore
- func (rws *RewardCumulativeStore) WithdrawRewards(validator keys.Address, amount *balance.Amount) error
- type RewardMasterState
- type RewardMasterStore
- func (rwz *RewardMasterStore) DumpState() (masterState *RewardMasterState, succeed bool)
- func (rwz *RewardMasterStore) GetOptions() *Options
- func (rwz *RewardMasterStore) LoadState(masterState RewardMasterState) (succeed bool)
- func (rwz *RewardMasterStore) SetOptions(options *Options)
- func (rwz *RewardMasterStore) WithState(state *storage.State) *RewardMasterStore
- type RewardState
- type RewardStore
- func (rs *RewardStore) AddAddressToList(address keys.Address)
- func (rs *RewardStore) AddToAddress(address keys.Address, height int64, amount *balance.Amount) error
- func (rs *RewardStore) Get(key storage.StoreKey) (amount *balance.Amount, err error)
- func (rs *RewardStore) GetInterval(height int64) *Interval
- func (rs *RewardStore) GetLastTwoChunks(address keys.Address) (*balance.Amount, error)
- func (rs *RewardStore) GetMaturedAmount(address keys.Address, height int64) (*balance.Amount, error)
- func (rs *RewardStore) GetOptions() *Options
- func (rs *RewardStore) GetState() *storage.State
- func (rs *RewardStore) GetWithHeight(address keys.Address, height int64) (amount *balance.Amount, err error)
- func (rs *RewardStore) Iterate(addr keys.Address, ...) bool
- func (rs *RewardStore) IterateAddrList(fn func(key keys.Address) bool) bool
- func (rs *RewardStore) SetInterval(height int64) error
- func (rs *RewardStore) SetOptions(options *Options)
- func (rs *RewardStore) SetWithHeight(address keys.Address, height int64, amount *balance.Amount) error
- func (rs *RewardStore) UpdateOptions(height int64, options *Options) error
- func (rs *RewardStore) WithState(state *storage.State) *RewardStore
- type RewardYear
- type RewardYears
Constants ¶
This section is empty.
Variables ¶
var ( UnableToGetMaturedAmount = codes.ProtocolError{codes.RewardsUnableToGetMaturedAmount, "failed to get matured balance"} UnableToWithdraw = codes.ProtocolError{codes.RewardsUnableToWithdraw, "Unable to withdraw"} YearRewardsMissing = codes.ProtocolError{codes.RewardsYearRewardsMissing, "Year rewards missing"} )
Functions ¶
This section is empty.
Types ¶
type IntervalReward ¶ added in v0.14.4
type IntervalReward struct { Address keys.Address `json:"address"` Index int64 `json:"index"` Amount *balance.Amount `json:"amount"` }
-----------------------------Dump/Load chain state
type Options ¶
type Options struct { RewardInterval int64 `json:"rewardInterval"` RewardPoolAddress string `json:"rewardPoolAddress"` RewardCurrency string `json:"rewardCurrency"` EstimatedSecondsPerCycle int64 `json:"estimatedSecondsPerCycle"` BlockSpeedCalculateCycle int64 `json:"blockSpeedCalculateCycle"` YearCloseWindow int64 `json:"yearCloseWindow"` BurnoutRate balance.Amount `json:"burnoutRate"` }
type RewardAmount ¶ added in v0.14.4
type RewardAmount struct { Address keys.Address `json:"address"` Amount *balance.Amount `json:"amount"` }
-----------------------------Dump/Load chain state
type RewardCached ¶ added in v0.14.4
type RewardCached struct {
// contains filtered or unexported fields
}
func NewRewardCached ¶ added in v0.14.4
func NewRewardCached() RewardCached
cached data updates at every cycle
type RewardCalculator ¶ added in v0.14.4
type RewardCalculator struct {
// contains filtered or unexported fields
}
func NewRewardCalculator ¶ added in v0.14.4
func NewRewardCalculator() *RewardCalculator
func (*RewardCalculator) Burnedout ¶ added in v0.14.4
func (calc *RewardCalculator) Burnedout() bool
func (*RewardCalculator) Calculate ¶ added in v0.14.4
func (calc *RewardCalculator) Calculate() (amt *balance.Amount, err error)
func (*RewardCalculator) Init ¶ added in v0.14.4
func (calc *RewardCalculator) Init(blockStore *tmstore.BlockStore)
func (*RewardCalculator) Reset ¶ added in v0.14.4
func (calc *RewardCalculator) Reset(height int64, rewardYears RewardYears)
func (*RewardCalculator) SetOptions ¶ added in v0.14.4
func (rws *RewardCalculator) SetOptions(options *Options)
type RewardCumuState ¶ added in v0.14.4
type RewardCumuState struct { TotalDistributed *balance.Amount `json:"totalDistributed"` YearsDistributed RewardYears `json:"yearsDistributed"` MaturedBalances []RewardAmount `json:"maturedBalances"` WithdrawnAmounts []RewardAmount `json:"withdrawnAmounts"` }
func NewRewardCumuState ¶ added in v0.14.4
func NewRewardCumuState() *RewardCumuState
type RewardCumulativeStore ¶
type RewardCumulativeStore struct {
// contains filtered or unexported fields
}
func NewRewardCumulativeStore ¶
func NewRewardCumulativeStore(prefix string, state *storage.State) *RewardCumulativeStore
func (*RewardCumulativeStore) AddMaturedBalance ¶
func (rws *RewardCumulativeStore) AddMaturedBalance(validator keys.Address, amount *balance.Amount) error
Add an 'amount' of matured rewards to rewards balance
func (*RewardCumulativeStore) ConsumeRewards ¶ added in v0.14.4
func (rws *RewardCumulativeStore) ConsumeRewards(consumed *balance.Amount) error
Deduct actual distributed rewards from total/year supply
func (*RewardCumulativeStore) GetMaturedBalance ¶
func (rws *RewardCumulativeStore) GetMaturedBalance(validator keys.Address) (amt *balance.Amount, err error)
Get matured rewards balance, the widrawable rewards, till now.
func (*RewardCumulativeStore) GetMaturedRewards ¶
func (rws *RewardCumulativeStore) GetMaturedRewards(validator keys.Address) (amt *balance.Amount, err error)
Get total matured rewards till now, including withdrawn amount. This number is calculated on the fly
func (*RewardCumulativeStore) GetOptions ¶
func (rws *RewardCumulativeStore) GetOptions() *Options
func (*RewardCumulativeStore) GetTotalDistributedRewards ¶ added in v0.14.4
func (rws *RewardCumulativeStore) GetTotalDistributedRewards() (amt *balance.Amount, err error)
Get total distributed rewards till now.
func (*RewardCumulativeStore) GetWithdrawnRewards ¶
func (rws *RewardCumulativeStore) GetWithdrawnRewards(validator keys.Address) (amt *balance.Amount, err error)
Get total rewards withdrawn till now
func (*RewardCumulativeStore) GetYearDistributedRewards ¶ added in v0.14.4
func (rws *RewardCumulativeStore) GetYearDistributedRewards() (rewardYears RewardYears, err error)
Get a list of each year's distributed rewards till now
func (*RewardCumulativeStore) Init ¶ added in v0.14.4
func (rws *RewardCumulativeStore) Init(blockStore *tmstore.BlockStore)
func (*RewardCumulativeStore) PullRewards ¶ added in v0.14.4
func (rws *RewardCumulativeStore) PullRewards(height int64, poolAmt *balance.Amount) (amount *balance.Amount, err error)
Pull a combined block rewards from total supply for all voting validators for given block height
func (*RewardCumulativeStore) SetOptions ¶
func (rws *RewardCumulativeStore) SetOptions(options *Options)
func (*RewardCumulativeStore) WithState ¶
func (rws *RewardCumulativeStore) WithState(state *storage.State) *RewardCumulativeStore
func (*RewardCumulativeStore) WithdrawRewards ¶
func (rws *RewardCumulativeStore) WithdrawRewards(validator keys.Address, amount *balance.Amount) error
Withdraw an 'amount' of rewards from rewards balance
type RewardMasterState ¶ added in v0.14.4
type RewardMasterState struct { RewardState *RewardState `json:"rewardState"` CumuState *RewardCumuState `json:"cumuState"` }
func NewRewardMasterState ¶ added in v0.14.4
func NewRewardMasterState() *RewardMasterState
type RewardMasterStore ¶
type RewardMasterStore struct { Reward *RewardStore RewardCm *RewardCumulativeStore }
func NewRewardMasterStore ¶
func NewRewardMasterStore(rwz *RewardStore, rwzc *RewardCumulativeStore) *RewardMasterStore
func (*RewardMasterStore) DumpState ¶ added in v0.14.4
func (rwz *RewardMasterStore) DumpState() (masterState *RewardMasterState, succeed bool)
func (*RewardMasterStore) GetOptions ¶
func (rwz *RewardMasterStore) GetOptions() *Options
func (*RewardMasterStore) LoadState ¶ added in v0.14.4
func (rwz *RewardMasterStore) LoadState(masterState RewardMasterState) (succeed bool)
func (*RewardMasterStore) SetOptions ¶
func (rwz *RewardMasterStore) SetOptions(options *Options)
func (*RewardMasterStore) WithState ¶
func (rwz *RewardMasterStore) WithState(state *storage.State) *RewardMasterStore
type RewardState ¶ added in v0.14.4
type RewardState struct { Rewards []IntervalReward `json:"rewards"` Intervals []Interval `json:"intervals"` AddrList []keys.Address `json:"addrList"` }
func NewRewardState ¶ added in v0.14.4
func NewRewardState() *RewardState
type RewardStore ¶
func NewRewardStore ¶
func (*RewardStore) AddAddressToList ¶
func (rs *RewardStore) AddAddressToList(address keys.Address)
func (*RewardStore) AddToAddress ¶
func (*RewardStore) GetInterval ¶
func (rs *RewardStore) GetInterval(height int64) *Interval
func (*RewardStore) GetLastTwoChunks ¶
func (*RewardStore) GetMaturedAmount ¶
func (*RewardStore) GetOptions ¶
func (rs *RewardStore) GetOptions() *Options
func (*RewardStore) GetState ¶ added in v0.14.4
func (rs *RewardStore) GetState() *storage.State
func (*RewardStore) GetWithHeight ¶
func (*RewardStore) Iterate ¶
func (rs *RewardStore) Iterate(addr keys.Address, fn func(addr keys.Address, index int64, amt *balance.Amount) bool) bool
Iterate through all reward records for a given Address
func (*RewardStore) IterateAddrList ¶
func (rs *RewardStore) IterateAddrList(fn func(key keys.Address) bool) bool
func (*RewardStore) SetInterval ¶
func (rs *RewardStore) SetInterval(height int64) error
func (*RewardStore) SetOptions ¶
func (rs *RewardStore) SetOptions(options *Options)
func (*RewardStore) SetWithHeight ¶
func (*RewardStore) UpdateOptions ¶
func (rs *RewardStore) UpdateOptions(height int64, options *Options) error
func (*RewardStore) WithState ¶
func (rs *RewardStore) WithState(state *storage.State) *RewardStore
type RewardYear ¶ added in v0.14.4
type RewardYears ¶ added in v0.14.4
type RewardYears struct {
Years []RewardYear
}