keeper

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const DAOAddress1 = "dx18tay9ayumxjun9sexlq4t3nvt7zts5typnyjdr"
View Source
const DAOAddress2 = "dx1w54s4wq8atjmmu4snv0tt72qpvtg38megw5ngn"
View Source
const DAOAddress3 = "dx19ws36j00axpk0ytumc20l9wyv0ae26zygk2z0f"
View Source
const DevelopAddress1 = "dx1fpjhs2wlaz6dd95d0lmxj5tfrmncwg437jh0y3"
View Source
const DevelopAddress2 = "dx1lfleqkc39pt2jkyhr7m845x207kh5d9av3423z"
View Source
const DevelopAddress3 = "dx1f46tyn4wmnvuxfj9cu5yn6vn939spfzt3yhxey"

Variables

View Source
var DAOCommission = sdk.NewDec(5).QuoInt64(100)
View Source
var DevelopCommission = sdk.NewDec(5).QuoInt64(100)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k Keeper, req abci.RequestBeginBlock)

BeginBlocker will persist the current header and validator set as a historical entry and prune the oldest entry based on the HistoricalEntries parameter

func DelegationsCounterInvariant added in v0.1.0

func DelegationsCounterInvariant(k Keeper) sdk.Invariant

func EndBlocker

func EndBlocker(ctx sdk.Context, k Keeper, req abci.RequestEndBlock) []abci.ValidatorUpdate

Called every block, update validator set

func NewDecreasingFactors

func NewDecreasingFactors() *decreasingFactors

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the validator MsgServer interface for the provided Keeper.

func NewSlashesAccumulator

func NewSlashesAccumulator(k Keeper, ctx sdk.Context, slashFactor sdk.Dec, factors *decreasingFactors) *slashesAccumulator

func RegisterInvariants added in v0.1.0

func RegisterInvariants(registry sdk.InvariantRegistry, k Keeper)

func StakedCustomCoinInvariant added in v0.1.0

func StakedCustomCoinInvariant(k Keeper) sdk.Invariant

StakedCustomCoinInvariant checks that helper amounts of custom coins is equal to sum of delegation/undelegations/redelegations

func TokensFromConsensusPower

func TokensFromConsensusPower(power int64) sdkmath.Int

TokensFromConsensusPower - convert input power to tokens

func TokensToConsensusPower

func TokensToConsensusPower(tokens sdkmath.Int) int64

TokensToConsensusPower converts input tokens to potential consensus-engine power

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine.

func NewKeeper

NewKeeper creates new Keeper instance.

func (*Keeper) AddAccumRewards

func (k *Keeper) AddAccumRewards(ctx sdk.Context, valAddr sdk.ValAddress, r sdkmath.Int) error

func (Keeper) AddCustomCoinStaked added in v0.1.0

func (k Keeper) AddCustomCoinStaked(ctx sdk.Context, coin sdk.Coin)

func (Keeper) AddMissedBlock

func (k Keeper) AddMissedBlock(ctx sdk.Context, addr sdk.ConsAddress, height int64)

func (Keeper) AfterDelegationModified

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

AfterDelegationModified - call hook if registered

func (Keeper) AfterValidatorBeginUnbonding

func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

AfterValidatorBeginUnbonding - call hook if registered

func (Keeper) AfterValidatorBonded

func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

AfterValidatorBonded - call hook if registered

func (Keeper) AfterValidatorCreated

func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error

AfterValidatorCreated - call hook if registered

func (Keeper) AfterValidatorRemoved

func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

AfterValidatorRemoved - call hook if registered

func (Keeper) ApplyAndReturnValidatorSetUpdates

func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate, err error)

ApplyAndReturnValidatorSetUpdates applies and return accumulated updates to the bonded validator set. Also, * Updates the active valset as keyed by LastValidatorPowerKey. * Updates the total power as keyed by LastTotalPowerKey. * Updates validator status' according to updated powers. * Updates the fee pool bonded vs not-bonded tokens. * Updates relevant indices. It gets called once after genesis, another time maybe after genesis transactions, then once at every EndBlock.

CONTRACT: Only validators with non-zero power or zero-power that were bonded at the previous block height or were removed from the validator set entirely are returned to Tendermint.

func (Keeper) BaseDenom

func (k Keeper) BaseDenom(ctx sdk.Context) (res string)

func (Keeper) BeforeDelegationCreated

func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

BeforeDelegationCreated - call hook if registered

func (Keeper) BeforeDelegationRemoved

func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

BeforeDelegationRemoved - call hook if registered

func (Keeper) BeforeDelegationSharesModified

func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

BeforeDelegationSharesModified - call hook if registered

func (Keeper) BeforeValidatorModified

func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error

BeforeValidatorModified - call hook if registered

func (Keeper) BeforeValidatorSlashed

func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error

BeforeValidatorSlashed - call hook if registered

func (Keeper) BeginRedelegation

func (k Keeper) BeginRedelegation(
	ctx sdk.Context, delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress, stake types.Stake, remainStake types.Stake,
) (completionTime time.Time, err error)

BeginRedelegation begins unbonding / redelegation and creates a redelegation record. stake and remainStake MUST BE calculated before by ValidateUnbondStake

func (Keeper) BlockValidatorUpdates

func (k Keeper) BlockValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate

BlockValidatorUpdates calculates the ValidatorUpdates for the current block Called in each EndBlock

func (Keeper) BondedRatio

func (k Keeper) BondedRatio(ctx sdk.Context, denom string) sdk.Dec

BondedRatio returns the fraction of the staking coin which are currently bonded.

func (Keeper) BondedTotal

func (k Keeper) BondedTotal(ctx sdk.Context, denom string) sdkmath.Int

BondedTotal returns the total staking coin supply which is bonded.

func (Keeper) CalculateCustomCoinPrices

func (k Keeper) CalculateCustomCoinPrices(ctx sdk.Context, ccs map[string]sdkmath.Int) map[string]sdk.Dec

func (Keeper) CalculateRemainStake

func (k Keeper) CalculateRemainStake(
	ctx sdk.Context, source, stake types.Stake,
) (types.Stake, error)

CalculateRemainStake validates that a given stake can be substracted from source. If the stake is valid, the remain stake is returned, otherwise an error is returned.

func (Keeper) CalculateTotalPowerWithDelegationsAndPrices

func (k Keeper) CalculateTotalPowerWithDelegationsAndPrices(ctx sdk.Context, validator sdk.ValAddress, delegations types.Delegations, ccp map[string]sdk.Dec) (sdkmath.Int, error)

func (Keeper) CheckDelegations

func (k Keeper) CheckDelegations(ctx sdk.Context, validator types.Validator)

func (Keeper) CompleteRedelegation

func (k Keeper) CompleteRedelegation(
	ctx sdk.Context, delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress,
) (err error)

CompleteRedelegation completes the redelegations of all mature entries in the retrieved redelegation object and returns the total redelegation (initial) balance or an error upon failure.

func (Keeper) CompleteUnbonding

func (k Keeper) CompleteUnbonding(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress) (err error)

CompleteUnbonding completes the unbonding of all mature entries in the retrieved unbonding delegation object and returns the total unbonding balance or an error upon failure.

func (Keeper) CreateValidator

func (k Keeper) CreateValidator(ctx sdk.Context, validator types.Validator)

func (Keeper) DecrementDelegationsCount added in v0.1.0

func (k Keeper) DecrementDelegationsCount(ctx sdk.Context, valAddr sdk.ValAddress)

func (Keeper) Delegate

func (k Keeper) Delegate(
	ctx sdk.Context, delegator sdk.AccAddress, validator types.Validator, stake types.Stake,
) error

Delegate performs a delegation, set/update everything necessary within the store. tokenSrc indicates the bond status of the incoming funds. NFT subtoken ownership MUST BE checked before

func (Keeper) Delegation

func (k Keeper) Delegation(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, denom string) types.DelegationI

Delegation get the delegation interface for a particular set of delegator and validator addresses.

func (Keeper) DeleteHistoricalInfo

func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)

DeleteHistoricalInfo deletes the historical info at a given height.

func (Keeper) DeleteLastValidatorPower

func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress)

Delete the last validator power.

func (Keeper) DeleteStartHeight

func (k Keeper) DeleteStartHeight(ctx sdk.Context, addr sdk.ConsAddress)

func (Keeper) DeleteValidatorByPowerIndex

func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) DeleteValidatorQueue

func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator)

DeleteValidatorQueue removes a validator by address from the unbonding queue indexed by a given height and time.

func (Keeper) DeleteValidatorQueueTimeSlice

func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, endTime time.Time, endHeight int64)

DeleteValidatorQueueTimeSlice deletes all entries in the queue indexed by a given height and time.

func (Keeper) DequeueAllMatureRedelegationQueue

func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context) (matureRedelegations []stakingtypes.DVVTriplet)

DequeueAllMatureRedelegationQueue returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue.

func (Keeper) DequeueAllMatureUBDQueue

func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []stakingtypes.DVPair)

DequeueAllMatureUBDQueue returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, params, validators, and bonds found in the keeper.

func (Keeper) GetAllCustomCoinsStaked

func (k Keeper) GetAllCustomCoinsStaked(ctx sdk.Context) map[string]sdkmath.Int

func (Keeper) GetAllDelegations

func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation)

GetAllDelegations returns all delegations (used during genesis dump).

func (Keeper) GetAllDelegationsByValidator

func (k Keeper) GetAllDelegationsByValidator(ctx sdk.Context) (delegations map[string][]types.Delegation)

GetAllDelegationsByValidator returns all delegations by validator stored in the application state.

func (Keeper) GetAllDelegationsCount added in v0.1.0

func (k Keeper) GetAllDelegationsCount(ctx sdk.Context) map[string]uint32

func (Keeper) GetAllDelegatorDelegations

func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation

return all delegations for a delegator

func (Keeper) GetAllHistoricalInfo

func (k Keeper) GetAllHistoricalInfo(ctx sdk.Context) []types.HistoricalInfo

GetAllHistoricalInfo returns all stored HistoricalInfo objects.

func (Keeper) GetAllRedelegations

func (k Keeper) GetAllRedelegations(
	ctx sdk.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress,
) []types.Redelegation

return all redelegations for a delegator

func (Keeper) GetAllSDKDelegations

func (k Keeper) GetAllSDKDelegations(ctx sdk.Context) (delegations []types.Delegation)

return all delegations used during genesis dump TODO: remove this func, change all usage for iterate functionality

func (Keeper) GetAllUndelegations

func (k Keeper) GetAllUndelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Undelegation

return all unbonding-delegations for a delegator

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator)

get the set of all validators with no limits, used during genesis dump

func (Keeper) GetAllValidatorsByPowerIndex

func (k Keeper) GetAllValidatorsByPowerIndex(ctx sdk.Context) (types.Validators, []int64, sdkmath.Int)

func (Keeper) GetAllValidatorsByPowerIndexReversed

func (k Keeper) GetAllValidatorsByPowerIndexReversed(ctx sdk.Context) []types.Validator

func (Keeper) GetBondedPool

func (k Keeper) GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI)

GetBondedPool returns the bonded coins pool's module account.

func (Keeper) GetBondedValidatorsByPower

func (k Keeper) GetBondedValidatorsByPower(ctx sdk.Context) []types.Validator

get the current group of bonded validators sorted by power-rank

func (Keeper) GetCustomCoinStaked

func (k Keeper) GetCustomCoinStaked(ctx sdk.Context, denom string) sdkmath.Int

func (Keeper) GetDelegation

func (k Keeper) GetDelegation(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, denom string) (delegation types.Delegation, found bool)

GetDelegation returns specific delegation by the given delegator address, validator and staked coin's denom.

func (Keeper) GetDelegationsCount added in v0.1.0

func (k Keeper) GetDelegationsCount(ctx sdk.Context, valAddr sdk.ValAddress) uint32

func (Keeper) GetDelegatorBonded

func (k Keeper) GetDelegatorBonded(ctx sdk.Context, delegator sdk.AccAddress) sdkmath.Int

GetDelegatorBonded returs the total amount a delegator has bonded.

func (Keeper) GetDelegatorDelegations

func (k Keeper) GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []types.Delegation)

GetDelegatorDelegations returns a given amount of all the delegations from a delegator.

func (Keeper) GetDelegatorUnbonding

func (k Keeper) GetDelegatorUnbonding(ctx sdk.Context, delegator sdk.AccAddress) sdkmath.Int

GetDelegatorUnbonding returns the total amount a delegator has unbonding.

func (Keeper) GetDelegatorValidator

func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress) (v types.Validator, err error)

return a validator that a delegator is bonded to

func (Keeper) GetDelegatorValidatorDelegations

func (k Keeper) GetDelegatorValidatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, maxRetrieve uint16) (delegations []types.Delegation)

GetDelegatorValidatorDelegations returns a given amount of all the delegations between the validator and the delegator.

func (Keeper) GetDelegatorValidators

func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint32) types.Validators

Return all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned.

func (Keeper) GetHistoricalInfo

func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height. compatible for IBCKeeper

func (Keeper) GetHistoricalInfoDecimal

func (k Keeper) GetHistoricalInfoDecimal(ctx sdk.Context, height int64) (types.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height.

func (Keeper) GetLastTotalPower

func (k Keeper) GetLastTotalPower(ctx sdk.Context) sdkmath.Int

GetLastTotalPower loads the last total validators power.

func (Keeper) GetLastValidatorPower

func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64)

Load the last validator power. Returns zero if the operator was not a validator last block.

func (Keeper) GetLastValidators

func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator)

get the group of the bonded validators

func (Keeper) GetNotBondedPool

func (k Keeper) GetNotBondedPool(ctx sdk.Context) (notBondedPool authtypes.ModuleAccountI)

GetNotBondedPool returns the not bonded coins pool's module account.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams returns all parameters as types.Params.

func (Keeper) GetRedelegation

func (k Keeper) GetRedelegation(ctx sdk.Context, delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress) (red types.Redelegation, found bool)

GetRedelegation returns a redelegation.

func (Keeper) GetRedelegationQueueTimeSlice

func (k Keeper) GetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvvTriplets []stakingtypes.DVVTriplet)

GetRedelegationQueueTimeSlice gets a specific redelegation queue timeslice. A timeslice is a slice of DVVTriplets corresponding to redelegations that expire at a certain time.

func (Keeper) GetRedelegations

func (k Keeper) GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (redelegations []types.Redelegation)

GetRedelegations returns a given amount of all the delegator redelegations.

func (Keeper) GetRedelegationsFromSrcValidator

func (k Keeper) GetRedelegationsFromSrcValidator(ctx sdk.Context, validatorSrc sdk.ValAddress) (reds []types.Redelegation)

GetRedelegationsFromSrcValidator returns all redelegations from a particular validator.

func (Keeper) GetStartHeight

func (k Keeper) GetStartHeight(ctx sdk.Context, addr sdk.ConsAddress) int64

func (Keeper) GetUBDQueueTimeSlice

func (k Keeper) GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []stakingtypes.DVPair)

GetUBDQueueTimeSlice gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs corresponding to unbonding delegations that expire at a certain time.

func (Keeper) GetUnbondingValidators

func (k Keeper) GetUnbondingValidators(ctx sdk.Context, endTime time.Time, endHeight int64) []string

GetUnbondingValidators returns a slice of mature validator addresses that complete their unbonding at a given time and height.

func (Keeper) GetUndelegation

func (k Keeper) GetUndelegation(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress) (ubd types.Undelegation, found bool)

GetUndelegation returns a unbonding delegation.

func (Keeper) GetUndelegations

func (k Keeper) GetUndelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (undelegations []types.Undelegation)

GetUndelegations returns a given amount of all the delegator unbonding-delegations.

func (Keeper) GetUndelegationsFromValidator

func (k Keeper) GetUndelegationsFromValidator(ctx sdk.Context, validator sdk.ValAddress) (ubds []types.Undelegation)

GetUndelegationsFromValidator returns all unbonding delegations from a particular validator.

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator types.Validator, found bool)

func (Keeper) GetValidatorByConsAddr

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool)

compatible for StakingKeeper for Ethermint

func (Keeper) GetValidatorByConsAddrDecimal

func (k Keeper) GetValidatorByConsAddrDecimal(ctx sdk.Context, consAddr sdk.ConsAddress) (validator types.Validator, found bool)

func (Keeper) GetValidatorByPowerIndexKey

func (k Keeper) GetValidatorByPowerIndexKey(validator types.Validator) []byte

GetValidatorByPowerIndexKey creates the validator by power index. Power index is the key used in the power-store, and represents the relative power ranking of the validator.

func (Keeper) GetValidatorDelegations

func (k Keeper) GetValidatorDelegations(ctx sdk.Context, validator sdk.ValAddress) (delegations []types.Delegation)

GetValidatorDelegations returns all delegations to a specific validator. Useful for querier.

func (Keeper) GetValidatorRS

func (k Keeper) GetValidatorRS(ctx sdk.Context, valAddr sdk.ValAddress) (rewards types.ValidatorRS, err error)

func (Keeper) GetValidatorSigningInfo

func (k Keeper) GetValidatorSigningInfo(ctx sdk.Context, addr sdk.ConsAddress, fromHeight, toHeight int64) types.ValidatorSigningInfo

fromHeight must bee less toHeight [fromHeight, toHeight]

func (Keeper) GetValidators

func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint32) (validators []types.Validator)

return a given amount of all the validators

func (Keeper) HandleDoubleSign

func (k Keeper) HandleDoubleSign(ctx sdk.Context, addr crypto.Address, infractionHeight int64, timestamp time.Time, power int64, params types.Params)

handle a validator signing two blocks at the same height power: power of the double-signing validator at the height of infraction

func (Keeper) HandleValidatorSignature

func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Address, power int64, signed bool, params types.Params)

HandleValidatorSignature handles a validator signature, must be called once per validator per block.

func (Keeper) HasDelegations added in v0.1.0

func (k Keeper) HasDelegations(ctx sdk.Context, validator sdk.ValAddress) bool

func (Keeper) HasMaxRedelegationEntries

func (k Keeper) HasMaxRedelegationEntries(ctx sdk.Context, delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress) bool

HasMaxRedelegationEntries checks if redelegation has maximum number of entries.

func (Keeper) HasMaxUndelegationEntries

func (k Keeper) HasMaxUndelegationEntries(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress) bool

HasMaxUndelegationEntries - check if unbonding delegation has maximum number of entries.

func (Keeper) HasReceivingRedelegation

func (k Keeper) HasReceivingRedelegation(ctx sdk.Context, delegator sdk.AccAddress, validatorDst sdk.ValAddress) bool

HasReceivingRedelegation checks if validator is receiving a redelegation.

func (Keeper) HasRedelegations added in v0.1.0

func (k Keeper) HasRedelegations(ctx sdk.Context, validator sdk.ValAddress) bool

func (Keeper) HasUndelegations added in v0.1.0

func (k Keeper) HasUndelegations(ctx sdk.Context, validator sdk.ValAddress) bool

func (Keeper) HasValidatorByPowerIndex added in v0.1.0

func (k Keeper) HasValidatorByPowerIndex(ctx sdk.Context, validator types.Validator) bool

TODO: remove

func (Keeper) HistoricalEntries

func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32)

HistoricalEntries returns number of historical info entries to persist in store.

func (Keeper) IncrementDelegationsCount added in v0.1.0

func (k Keeper) IncrementDelegationsCount(ctx sdk.Context, valAddr sdk.ValAddress)

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) (res []abci.ValidatorUpdate)

InitGenesis sets the pool and parameters for the provided keeper. For each validator in data, it sets that validator in the keeper along with manually setting the indexes. In addition, it also sets any delegations found in data. Finally, it updates the bonded validators. Returns final validator set after applying all declaration and delegations

func (Keeper) InsertRedelegationQueue

func (k Keeper) InsertRedelegationQueue(ctx sdk.Context, red types.Redelegation, completionTime time.Time)

InsertRedelegationQueue insert an redelegation delegation to the appropriate timeslice in the redelegation queue.

func (Keeper) InsertUBDQueue

func (k Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.Undelegation, completionTime time.Time)

InsertUBDQueue inserts an unbonding delegation to the appropriate timeslice in the unbonding queue.

func (Keeper) InsertUnbondingValidatorQueue

func (k Keeper) InsertUnbondingValidatorQueue(ctx sdk.Context, val types.Validator)

InsertUnbondingValidatorQueue inserts a given unbonding validator address into the unbonding validator queue for a given height and time.

func (Keeper) IterateAllCustomCoinStaked

func (k Keeper) IterateAllCustomCoinStaked(ctx sdk.Context, cb func(denom string, amount sdkmath.Int) bool)

func (Keeper) IterateAllDelegations

func (k Keeper) IterateAllDelegations(ctx sdk.Context, cb func(delegation types.Delegation) (stop bool))

IterateAllDelegations iterates through all of the delegations.

func (Keeper) IterateBondedValidatorsByPower

func (k Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))

iterate through the bonded validator set and perform the provided function Compatible for cosmos gov keeper TODO: implement

func (Keeper) IterateDelegations

func (k Keeper) IterateDelegations(ctx sdk.Context, delAddr sdk.AccAddress,
	fn func(index int64, del stakingtypes.DelegationI) (stop bool),
)

iterate through all of the delegations from a delegator

func (Keeper) IterateDelegatorDelegations

func (k Keeper) IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation types.Delegation) (stop bool))

IterateDelegatorDelegations iterates through one delegator's delegations.

func (Keeper) IterateDelegatorRedelegations

func (k Keeper) IterateDelegatorRedelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(red types.Redelegation) (stop bool))

IterateDelegatorRedelegations iterates through one delegator's redelegations.

func (Keeper) IterateDelegatorUndelegations

func (k Keeper) IterateDelegatorUndelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(ubd types.Undelegation) (stop bool))

IterateDelegatorUndelegations iterates through a delegator's unbonding delegations.

func (Keeper) IterateHistoricalInfo

func (k Keeper) IterateHistoricalInfo(ctx sdk.Context, cb func(types.HistoricalInfo) bool)

IterateHistoricalInfo provides an iterator over all stored HistoricalInfo objects. For each HistoricalInfo object, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IterateLastValidatorPowers

func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operator sdk.ValAddress, power int64) (stop bool))

Iterate over last validator powers.

func (Keeper) IterateLastValidators

func (k Keeper) IterateLastValidators(ctx sdk.Context, fn func(index int64, validator types.ValidatorI) (stop bool))

iterate through the active validator set and perform the provided function

func (Keeper) IterateRedelegations

func (k Keeper) IterateRedelegations(ctx sdk.Context, fn func(index int64, red types.Redelegation) (stop bool))

IterateRedelegations iterates through all redelegations.

func (Keeper) IterateUndelegations

func (k Keeper) IterateUndelegations(ctx sdk.Context, fn func(index int64, ubd types.Undelegation) (stop bool))

IterateUndelegations iterates through all of the unbonding delegations.

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator types.ValidatorI) (stop bool))

iterate through the validator set and perform the provided function

func (Keeper) Jail

func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)

jail a validator

func (Keeper) LastValidatorsIterator

func (k Keeper) LastValidatorsIterator(ctx sdk.Context) (iterator sdk.Iterator)

returns an iterator for the consensus validators in the last block

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MaxDelegations

func (k Keeper) MaxDelegations(ctx sdk.Context) (res uint32)

MaxDelegations returns maximum number of delegations.

func (Keeper) MaxEntries

func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32)

MaxEntries returns maximum number of simultaneous redelegations/undelegations (per trio/pair).

func (Keeper) MaxValidators

func (k Keeper) MaxValidators(ctx sdk.Context) (res uint32)

MaxValidators returns maximum number of validators.

func (Keeper) MinSignedPerWindow

func (k Keeper) MinSignedPerWindow(ctx sdk.Context) (res sdk.Dec)

func (Keeper) MustGetValidatorRS

func (k Keeper) MustGetValidatorRS(ctx sdk.Context, validator *types.Validator)

func (Keeper) PayRewards

func (k Keeper) PayRewards(ctx sdk.Context) error

func (Keeper) PayValidators

func (k Keeper) PayValidators(ctx sdk.Context)

func (Keeper) RedelegationQueueIterator

func (k Keeper) RedelegationQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

RedelegationQueueIterator returns all the redelegation queue timeslices from time 0 until endTime.

func (Keeper) RedelegationTime

func (k Keeper) RedelegationTime(ctx sdk.Context) (res time.Duration)

RedelegationTime returns time duration needed to redelegate a stake.

func (Keeper) RemoveDelegation

func (k Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation) error

RemoveDelegation removes a delegation

func (Keeper) RemoveRedelegation

func (k Keeper) RemoveRedelegation(ctx sdk.Context, red types.Redelegation)

RemoveRedelegation removes a redelegation object and associated index.

func (Keeper) RemoveUndelegation

func (k Keeper) RemoveUndelegation(ctx sdk.Context, ubd types.Undelegation)

RemoveUndelegation removes the unbonding delegation object and associated index.

func (Keeper) RemoveValidator

func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress)

remove the validator record and associated indexes except for the bonded validator index which is only handled in ApplyAndReturnTendermintUpdates TODO, this function panics, and it's not good.

func (Keeper) SetCustomCoinStaked

func (k Keeper) SetCustomCoinStaked(ctx sdk.Context, denom string, amount sdkmath.Int)

func (Keeper) SetDelegation

func (k Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation)

SetDelegation sets a delegation.

func (Keeper) SetHistoricalInfo

func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi *types.HistoricalInfo)

SetHistoricalInfo sets the historical info at a given height.

func (Keeper) SetLastTotalPower

func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdkmath.Int)

SetLastTotalPower sets the last total validators power.

func (Keeper) SetLastValidatorPower

func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64)

Set the last validator power.

func (Keeper) SetNewValidatorByPowerIndex

func (k Keeper) SetNewValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

set the params

func (Keeper) SetRedelegation

func (k Keeper) SetRedelegation(ctx sdk.Context, red types.Redelegation)

SetRedelegation set a redelegation and associated index.

func (Keeper) SetRedelegationEntry

func (k Keeper) SetRedelegationEntry(
	ctx sdk.Context,
	delegator sdk.AccAddress,
	validatorSrc sdk.ValAddress,
	validatorDst sdk.ValAddress,
	creationHeight int64,
	minTime time.Time,
	stake types.Stake,
) types.Redelegation

SetRedelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the undelegation if it does not exist.

func (Keeper) SetRedelegationQueueTimeSlice

func (k Keeper) SetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []stakingtypes.DVVTriplet)

SetRedelegationQueueTimeSlice sets a specific redelegation queue timeslice.

func (Keeper) SetStartHeight

func (k Keeper) SetStartHeight(ctx sdk.Context, addr sdk.ConsAddress, height int64)

func (Keeper) SetUBDQueueTimeSlice

func (k Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []stakingtypes.DVPair)

SetUBDQueueTimeSlice sets a specific unbonding queue timeslice.

func (Keeper) SetUnbondingValidatorsQueue

func (k Keeper) SetUnbondingValidatorsQueue(ctx sdk.Context, endTime time.Time, endHeight int64, addrs []string)

SetUnbondingValidatorsQueue sets a given slice of validator addresses into the unbonding validator queue by a given height and time.

func (Keeper) SetUndelegation

func (k Keeper) SetUndelegation(ctx sdk.Context, ubd types.Undelegation)

SetUndelegation sets the unbonding delegation and associated index.

func (Keeper) SetUndelegationEntry

func (k Keeper) SetUndelegationEntry(
	ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress,
	creationHeight int64, minTime time.Time, stake types.Stake,
) types.Undelegation

SetUndelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist.

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator)

func (Keeper) SetValidatorByConsAddr

func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator) error

validator index

func (Keeper) SetValidatorByPowerIndex

func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, validator types.Validator)

validator index

func (Keeper) SetValidatorRS

func (k Keeper) SetValidatorRS(ctx sdk.Context, valAddr sdk.ValAddress, rewards types.ValidatorRS)

func (Keeper) SignedBlockWindow

func (k Keeper) SignedBlockWindow(ctx sdk.Context) (res int64)

func (Keeper) SignedBlocksWindow

func (k Keeper) SignedBlocksWindow(ctx sdk.Context) (res int64)

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec)

Slash a validator for an infraction committed at a known height Find the contributing stake at that height and burn the specified slashFactor of it, updating unbonding delegations & redelegations appropriately

CONTRACT:

slashFactor is non-negative

CONTRACT:

Infraction was committed equal to or less than an unbonding period in the past,
so all unbonding delegations and redelegations from that height are stored

CONTRACT:

Slash will not slash unbonded validators (for the above reason)

CONTRACT:

Infraction was committed at the current height or at a past height,
not at a height in the future

func (Keeper) SlashFractionDoubleSign

func (k Keeper) SlashFractionDoubleSign(ctx sdk.Context) (res sdk.Dec)

func (Keeper) SlashFractionDowntime

func (k Keeper) SlashFractionDowntime(ctx sdk.Context) (res sdk.Dec)

func (Keeper) SubCustomCoinStaked added in v0.1.0

func (k Keeper) SubCustomCoinStaked(ctx sdk.Context, coin sdk.Coin)

func (*Keeper) ToBaseCoin

func (k *Keeper) ToBaseCoin(ctx sdk.Context, c sdk.Coin) sdk.Coin

func (Keeper) TotalBondedTokens

func (k Keeper) TotalBondedTokens(_ sdk.Context) sdk.Int

func (Keeper) TrackHistoricalInfo

func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)

TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height.

func (Keeper) TransferStakeBetweenPools

func (k Keeper) TransferStakeBetweenPools(ctx sdk.Context, statusSrc types.BondStatus, statusDst types.BondStatus, stake types.Stake) error

func (Keeper) UBDQueueIterator

func (k Keeper) UBDQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

UBDQueueIterator returns all the unbonding queue timeslices from time 0 until endTime.

func (Keeper) Unbond

func (k Keeper) Unbond(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, stake, remainStake types.Stake) (err error)

func (Keeper) UnbondAllMatureValidators

func (k Keeper) UnbondAllMatureValidators(ctx sdk.Context)

UnbondAllMatureValidators unbonds all the mature unbonding validators that have finished their unbonding period.

func (Keeper) UnbondingTime

func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)

compatible method for IBCKeeper

func (Keeper) UnbondingToUnbonded

func (k Keeper) UnbondingToUnbonded(ctx sdk.Context, validator types.Validator) types.Validator

func (Keeper) Undelegate

func (k Keeper) Undelegate(
	ctx sdk.Context, delegator sdk.AccAddress, valAddress sdk.ValAddress,
	stake types.Stake, remainStake types.Stake,
) (time.Time, error)

Undelegate unbonds a stake from a given validator. stake and remainStake must be calculated before by CalculateUnbondStake It create an unbonding object and insert into the unbonding queue which will be processed during EndBlocker.

func (Keeper) UndelegationTime

func (k Keeper) UndelegationTime(ctx sdk.Context) (res time.Duration)

UndelegationTime returns time duration needed to undelegate a stake.

func (Keeper) Unjail

func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)

unjail a validator

func (Keeper) Validator

func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) types.ValidatorI

Validator gets the Validator interface for a particular address

func (Keeper) ValidatorByConsAddr

func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) stakingtypes.ValidatorI

ValidatorByConsAddr gets the validator interface for a particular pubkey

func (Keeper) ValidatorQueueIterator

func (k Keeper) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time, endHeight int64) sdk.Iterator

ValidatorQueueIterator returns an interator ranging over validators that are unbonding whose unbonding completion occurs at the given height and time.

func (Keeper) ValidatorsPowerStoreIterator

func (k Keeper) ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator

returns an iterator for the current validator power store

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper.

func (Querier) CustomCoinPrice added in v0.1.0

CustomCoinPrice queries the total amount bonded custom coins.

func (Querier) Delegations

Delegations queries delegations info for given validator delegator pair.

func (Querier) DelegatorDelegations

DelegatorDelegations queries all delegations of a give delegator address

func (Querier) DelegatorRedelegations

DelegatorRedelegations queries all redelegations of a given delegator address.

func (Querier) DelegatorUndelegations

DelegatorUndelegations queries all undelegations of a given delegator address.

func (Querier) DelegatorValidator

DelegatorValidator queries validator info for given delegator validator pair.

func (Querier) DelegatorValidators

DelegatorValidators queries all validators info for given delegator address.

func (Querier) HistoricalInfo

HistoricalInfo queries the historical info for given height.

func (Querier) Params

Params queries the module params.

func (Querier) Pool

Pool queries the pool info.

func (Querier) Redelegations

Redelegations queries redelegations info for given validator delegator pair.

func (Querier) TotalCustomCoin added in v0.1.0

TotalCustomCoin queries the total amount bonded custom coins.

func (Querier) Undelegation

Undelegation queries undelegations info for given validator delegator pair.

func (Querier) Validator

Validator queries validator info for given validator address.

func (Querier) ValidatorDelegations

ValidatorDelegations queries delegate info for given validator.

func (Querier) ValidatorRedelegations

ValidatorRedelegations queries redelegations of a validator.

func (Querier) ValidatorUndelegations

ValidatorUndelegations queries undelegations of a validator.

func (Querier) Validators

Validators queries all validators that match the given status.

Jump to

Keyboard shortcuts

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