Documentation
¶
Index ¶
- Variables
- type Interval
- type Options
- type RewardCumulativeStore
- func (rws *RewardCumulativeStore) AddMaturedBalance(validator keys.Address, amount *balance.Amount) error
- func (rws *RewardCumulativeStore) CalcBlockRewards(blockHeight int64, bftTime time.Time)
- 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) GetWithdrawnRewards(validator keys.Address) (amt *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 RewardMasterStore
- 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) GetWithHeight(address keys.Address, height int64) (amount *balance.Amount, err error)
- func (rs *RewardStore) Iterate(addr keys.Address, fn func(c string, amt balance.Amount) bool) 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
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UnableToGetMaturedAmount = codes.ProtocolError{codes.RewardsUnableToGetMaturedAmount, "failed to get matured balance"} UnableToWithdraw = codes.ProtocolError{codes.RewardsUnableToWithdraw, "Unable to withdraw"} )
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
RewardInterval int64 `json:"rewardInterval"`
RewardPoolAddress string `json:"rewardPoolAddress"`
RewardCurrency string `json:"rewardCurrency"`
CalculateInterval int64 `json:"calculateInterval"`
AnnualSupply balance.Amount `json:"annualSupply"`
YearsOfSupply int64 `json:"yearsOfSupply"`
}
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) CalcBlockRewards ¶
func (rws *RewardCumulativeStore) CalcBlockRewards(blockHeight int64, bftTime time.Time)
Calculate combined rewards for all voting validators for given block
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) GetWithdrawnRewards ¶
func (rws *RewardCumulativeStore) GetWithdrawnRewards(validator keys.Address) (amt *balance.Amount, err error)
Get total rewards withdrawn till now
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 RewardMasterStore ¶
type RewardMasterStore struct {
Reward *RewardStore
RewardCm *RewardCumulativeStore
}
func NewRewardMasterStore ¶
func NewRewardMasterStore(rwz *RewardStore, rwzc *RewardCumulativeStore) *RewardMasterStore
func (*RewardMasterStore) GetOptions ¶
func (rwz *RewardMasterStore) GetOptions() *Options
func (*RewardMasterStore) SetOptions ¶
func (rwz *RewardMasterStore) SetOptions(options *Options)
func (*RewardMasterStore) WithState ¶
func (rwz *RewardMasterStore) WithState(state *storage.State) *RewardMasterStore
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) GetWithHeight ¶
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
Click to show internal directories.
Click to hide internal directories.