Documentation ¶
Index ¶
- Constants
- Variables
- func AddressFromLastValidatorPowerKey(key []byte) []byte
- func AddressFromValidatorsKey(key []byte) []byte
- func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetDelegationsByValKey(valAddr sdk.ValAddress, delAddr sdk.AccAddress) []byte
- func GetDelegationsByValPrefixKey(valAddr sdk.ValAddress) []byte
- func GetDelegationsKey(delAddr sdk.AccAddress) []byte
- func GetHistoricalInfoKey(height int64) []byte
- func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
- func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
- func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte
- func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte
- func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte
- func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte
- func GetREDsKey(delAddr sdk.AccAddress) []byte
- func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte
- func GetRedelegationTimeKey(timestamp time.Time) []byte
- func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
- func GetUBDKeyFromValIndexKey(indexKey []byte) []byte
- func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte
- func GetUBDsKey(delAddr sdk.AccAddress) []byte
- func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte
- func GetUnbondingIndexKey(id uint64) []byte
- func GetUnbondingTypeKey(id uint64) []byte
- func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte
- func GetValidatorKey(operatorAddr sdk.ValAddress) []byte
- func GetValidatorQueueKey(timestamp time.Time, height int64) []byte
- func GetValidatorsByPowerIndexKey(validator Validator, powerReduction math.Int, valAc addresscodec.Codec) []byte
- func MustMarshalDelegation(cdc codec.BinaryCodec, delegation Delegation) []byte
- func MustMarshalRED(cdc codec.BinaryCodec, red Redelegation) []byte
- func MustMarshalUBD(cdc codec.BinaryCodec, ubd UnbondingDelegation) []byte
- func MustMarshalUBDE(cdc codec.BinaryCodec, ubd UnbondingDelegationEntry) []byte
- func MustMarshalValidator(cdc codec.BinaryCodec, validator *Validator) []byte
- func ParamKeyTable() paramtypes.KeyTabledeprecated
- func ParseDelegationsByValKey(bz []byte) (sdk.ValAddress, sdk.AccAddress, error)
- func ParseValidatorPowerRankKey(key []byte) (operAddr []byte)
- func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error)
- func RegisterInterfaces(registry types.InterfaceRegistry)
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func ValidateBasic(hi HistoricalInfo, valAc address.Codec) error
- func ValidatePowerReduction(i interface{}) error
- type AccountKeeper
- type BankKeeper
- type DelegationI
- type DelegationResponses
- type DelegationSet
- type Delegations
- type MultiRefStakingHooks
- func (h MultiRefStakingHooks) CheckDelegationAvailable(ctx context.Context, delAddr, valAddr string) error
- func (h MultiRefStakingHooks) DelegationCoinsModified(ctx context.Context, delAddr, valAddr string, oldCoins, newCoins math.Int) error
- func (h MultiRefStakingHooks) SpendCoinsForRef(ctx context.Context, addr string, totalAmount math.Int) (math.Int, error)
- type MultiStakingHooks
- func (h MultiStakingHooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) AfterUnbondingInitiated(ctx context.Context, id uint64) error
- func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error
- func (h MultiStakingHooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error
- type QueryDelegatorParams
- type QueryRedelegationParams
- type QueryValidatorParams
- type QueryValidatorsParams
- type RedelegationResponses
- type Redelegations
- type RefStakingHooks
- type RefStakingHooksWrapper
- type StakingHooks
- type StakingHooksWrapper
- type UnbondingDelegations
- type UnbondingType
- type ValidatorI
- type ValidatorSet
- type Validators
- func (v Validators) Len() int
- func (v Validators) Less(i, j int) bool
- func (v Validators) Sort()
- func (v Validators) String() (out string)
- func (v Validators) Swap(i, j int)
- func (v Validators) ToSDKValidators() (validators []ValidatorI)
- func (v Validators) UnpackInterfaces(c codectypes.AnyUnpacker) error
- type ValidatorsByvotePower
Constants ¶
const ( EventTypeCompleteUnbonding = "complete_unbonding" EventTypeCompleteRedelegation = "complete_redelegation" EventTypeCreateValidator = "create_validator" EventTypeEditValidator = "edit_validator" EventTypeDelegate = "delegate" EventTypeUnbond = "unbond" EventTypeCancelUnbondingDelegation = "cancel_unbonding_delegation" EventTypeRedelegate = "redelegate" AttributeKeyValidator = "validator" AttributeKeyCommissionRate = "commission_rate" AttributeKeyMinSelfDelegation = "min_self_delegation" AttributeKeySrcValidator = "source_validator" AttributeKeyDstValidator = "destination_validator" AttributeKeyDelegator = "delegator" AttributeKeyCreationHeight = "creation_height" AttributeKeyCompletionTime = "completion_time" )
staking module event types
const ( // ModuleName is the name of the staking module ModuleName = "staking" // StoreKey is the string store representation StoreKey = ModuleName // RouterKey is the msg router key for the staking module RouterKey = ModuleName )
const ( // DefaultUnbondingTime reflects three weeks in seconds as the default // unbonding time. // TODO: Justify our choice of default here. DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 3 DefaultRedelegationTime time.Duration = time.Second * 5 // Default maximum number of bonded validators DefaultMaxValidators uint32 = 100 // Default maximum entries in a UBD/RED pair DefaultMaxEntries uint32 = 7 // DefaultHistorical entries is 10000. Apps that don't use IBC can ignore this // value by not adding the staking module to the application module manager's // SetOrderBeginBlockers. DefaultHistoricalEntries uint32 = 10000 DefaultMaximumMonthlyPoints uint64 = 30 * 24 * 60 * 60 * 1000000 )
Staking params default values
const ( NotBondedPoolName = "not_bonded_tokens_pool" BondedPoolName = "bonded_tokens_pool" )
names used as root for pool module accounts:
- NotBondedPool -> "not_bonded_tokens_pool"
- BondedPool -> "bonded_tokens_pool"
const ( QueryValidators = "validators" QueryValidator = "validator" QueryDelegatorDelegations = "delegatorDelegations" QueryDelegatorUnbondingDelegations = "delegatorUnbondingDelegations" QueryRedelegations = "redelegations" QueryValidatorDelegations = "validatorDelegations" QueryValidatorRedelegations = "validatorRedelegations" QueryValidatorUnbondingDelegations = "validatorUnbondingDelegations" QueryDelegation = "delegation" QueryUnbondingDelegation = "unbondingDelegation" QueryDelegatorValidators = "delegatorValidators" QueryDelegatorValidator = "delegatorValidator" QueryPool = "pool" QueryParameters = "parameters" QueryHistoricalInfo = "historicalInfo" )
query endpoints supported by the staking Querier
const ( // TODO: Why can't we just have one string description which can be JSON by convention MaxMonikerLength = 70 MaxIdentityLength = 3000 MaxWebsiteLength = 140 MaxSecurityContactLength = 140 MaxDetailsLength = 280 )
const DoNotModifyDesc = "[do-not-modify]"
constant used in flags to indicate that description field should not be updated
Variables ¶
var ( ErrEmptyValidatorAddr = types.ErrEmptyValidatorAddr ErrNoValidatorFound = types.ErrNoValidatorFound ErrValidatorOwnerExists = types.ErrValidatorOwnerExists ErrValidatorPubKeyExists = types.ErrValidatorPubKeyExists ErrValidatorPubKeyTypeNotSupported = types.ErrValidatorPubKeyTypeNotSupported ErrValidatorJailed = types.ErrValidatorJailed ErrBadRemoveValidator = types.ErrBadRemoveValidator ErrCommissionNegative = types.ErrCommissionNegative ErrCommissionHuge = types.ErrCommissionHuge ErrCommissionGTMaxRate = types.ErrCommissionGTMaxRate ErrCommissionUpdateTime = types.ErrCommissionUpdateTime ErrCommissionChangeRateNegative = types.ErrCommissionChangeRateNegative ErrCommissionChangeRateGTMaxRate = types.ErrCommissionChangeRateGTMaxRate ErrCommissionGTMaxChangeRate = types.ErrCommissionGTMaxChangeRate ErrSelfDelegationBelowMinimum = types.ErrSelfDelegationBelowMinimum ErrMinSelfDelegationDecreased = types.ErrMinSelfDelegationDecreased ErrEmptyDelegatorAddr = types.ErrEmptyDelegatorAddr ErrNoDelegation = types.ErrNoDelegation ErrBadDelegatorAddr = types.ErrBadDelegatorAddr ErrNoDelegatorForAddress = types.ErrNoDelegatorForAddress ErrDelegationValidatorEmpty = types.ErrDelegationValidatorEmpty ErrNotMature = types.ErrNotMature ErrNoUnbondingDelegation = types.ErrNoUnbondingDelegation ErrMaxUnbondingDelegationEntries = types.ErrMaxUnbondingDelegationEntries ErrNoRedelegation = types.ErrNoRedelegation ErrSelfRedelegation = types.ErrSelfRedelegation ErrTinyRedelegationAmount = types.ErrTinyRedelegationAmount ErrBadRedelegationDst = types.ErrBadRedelegationDst ErrTransitiveRedelegation = types.ErrTransitiveRedelegation ErrMaxRedelegationEntries = types.ErrMaxRedelegationEntries ErrInvalidHistoricalInfo = types.ErrInvalidHistoricalInfo ErrNoHistoricalInfo = types.ErrNoHistoricalInfo ErrEmptyValidatorPubKey = types.ErrEmptyValidatorPubKey ErrCommissionLTMinRate = types.ErrCommissionLTMinRate ErrUnbondingNotFound = types.ErrUnbondingNotFound ErrUnbondingOnHoldRefCountNegative = types.ErrUnbondingOnHoldRefCountNegative ErrInvalidSigner = types.ErrInvalidSigner ErrBadRedelegationSrc = types.ErrBadRedelegationSrc ErrNoUnbondingType = types.ErrNoUnbondingType )
x/staking module sentinel errors
var ( // Keys for store prefixes // Last* values are constant during a block. LastValidatorPowerKey = []byte{0x11} // prefix for each key to a validator index, for bonded validators LastTotalPowerKey = []byte{0x12} // prefix for the total power ValidatorsKey = []byte{0x21} // prefix for each key to a validator ValidatorsByConsAddrKey = []byte{0x22} // prefix for each key to a validator index, by pubkey ValidatorsByPowerIndexKey = []byte{0x23} // prefix for each key to a validator index, sorted by power DelegationKey = []byte{0x31} // key for a delegation UnbondingDelegationKey = []byte{0x32} // key for an unbonding-delegation UnbondingDelegationByValIndexKey = []byte{0x33} // prefix for each key for an unbonding-delegation, by validator operator RedelegationKey = []byte{0x34} // key for a redelegation RedelegationByValSrcIndexKey = []byte{0x35} // prefix for each key for an redelegation, by source validator operator RedelegationByValDstIndexKey = []byte{0x36} // prefix for each key for an redelegation, by destination validator operator UnbondingIDKey = []byte{0x37} // key for the counter for the incrementing id for UnbondingOperations UnbondingIndexKey = []byte{0x38} // prefix for an index for looking up unbonding operations by their IDs UnbondingTypeKey = []byte{0x39} // prefix for an index containing the type of unbonding operations UnbondingQueueKey = []byte{0x41} // prefix for the timestamps in unbonding queue RedelegationQueueKey = []byte{0x42} // prefix for the timestamps in redelegations queue ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue HistoricalInfoKey = []byte{0x50} // prefix for the historical info ValidatorUpdatesKey = []byte{0x61} // prefix for the end block validator updates key ParamsKey = []byte{0x51} // prefix for parameters for module x/staking DelegationByValIndexKey = []byte{0x71} // key for delegations by a validator )
var ( DefaultValidatorEmissionRate = math.LegacyNewDecWithPrec(3, 3) DefaultEmissionRange = EmissionRange{Start: math.LegacyZeroDec(), Rate: math.LegacyNewDecWithPrec(2, 1)} DefaultMinSelfDelegation = math.NewInt(20000000000) )
var ( KeyUnbondingTime = []byte("UnbondingTime") KeyMaxValidators = []byte("MaxValidators") KeyMaxEntries = []byte("MaxEntries") KeyBondDenom = []byte("BondDenom") KeyHistoricalEntries = []byte("HistoricalEntries") KeyMinCommissionRate = []byte("MinCommissionRate") )
var ( BondStatusUnspecified = BondStatus_name[int32(Unspecified)] BondStatusUnbonded = BondStatus_name[int32(Unbonded)] BondStatusUnbonding = BondStatus_name[int32(Unbonding)] BondStatusBonded = BondStatus_name[int32(Bonded)] )
Functions ¶
func AddressFromLastValidatorPowerKey ¶
AddressFromLastValidatorPowerKey creates the validator operator address from LastValidatorPowerKey
func AddressFromValidatorsKey ¶
AddressFromValidatorsKey creates the validator operator address from ValidatorsKey
func GetDelegationKey ¶
func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
GetDelegationKey creates the key for delegator bond with validator VALUE: staking/Delegation
func GetDelegationsByValKey ¶
func GetDelegationsByValKey(valAddr sdk.ValAddress, delAddr sdk.AccAddress) []byte
GetDelegationsByValKey creates the key for delegations by validator address VALUE: staking/Delegation
func GetDelegationsByValPrefixKey ¶
func GetDelegationsByValPrefixKey(valAddr sdk.ValAddress) []byte
GetDelegationsByValPrefixKey builds a prefix key bytes with the given validator address bytes.
func GetDelegationsKey ¶
func GetDelegationsKey(delAddr sdk.AccAddress) []byte
GetDelegationsKey creates the prefix for a delegator for all validators
func GetHistoricalInfoKey ¶
GetHistoricalInfoKey returns a key prefix for indexing HistoricalInfo objects.
func GetLastValidatorPowerKey ¶
func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte
GetLastValidatorPowerKey creates the bonded validator index key for an operator address
func GetREDByValDstIndexKey ¶
func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
GetREDByValDstIndexKey creates the index-key for a redelegation, stored by destination-validator-index VALUE: none (key rearrangement used)
func GetREDByValSrcIndexKey ¶
func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
GetREDByValSrcIndexKey creates the index-key for a redelegation, stored by source-validator-index VALUE: none (key rearrangement used)
func GetREDKey ¶
func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte
GetREDKey returns a key prefix for indexing a redelegation from a delegator and source validator to a destination validator.
func GetREDKeyFromValDstIndexKey ¶
GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey
func GetREDKeyFromValSrcIndexKey ¶
GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey
func GetREDsByDelToValDstIndexKey ¶
func GetREDsByDelToValDstIndexKey(delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) []byte
GetREDsByDelToValDstIndexKey returns a key prefix for indexing a redelegation from an address to a source validator.
func GetREDsFromValSrcIndexKey ¶
func GetREDsFromValSrcIndexKey(valSrcAddr sdk.ValAddress) []byte
GetREDsFromValSrcIndexKey returns a key prefix for indexing a redelegation to a source validator.
func GetREDsKey ¶
func GetREDsKey(delAddr sdk.AccAddress) []byte
GetREDsKey returns a key prefix for indexing a redelegation from a delegator address.
func GetREDsToValDstIndexKey ¶
func GetREDsToValDstIndexKey(valDstAddr sdk.ValAddress) []byte
GetREDsToValDstIndexKey returns a key prefix for indexing a redelegation to a destination (target) validator.
func GetRedelegationTimeKey ¶
GetRedelegationTimeKey returns a key prefix for indexing an unbonding redelegation based on a completion time.
func GetUBDByValIndexKey ¶
func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
GetUBDByValIndexKey creates the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)
func GetUBDKey ¶
func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte
GetUBDKey creates the key for an unbonding delegation by delegator and validator addr VALUE: staking/UnbondingDelegation
func GetUBDKeyFromValIndexKey ¶
GetUBDKeyFromValIndexKey rearranges the ValIndexKey to get the UBDKey
func GetUBDsByValIndexKey ¶
func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte
GetUBDsByValIndexKey creates the prefix keyspace for the indexes of unbonding delegations for a validator
func GetUBDsKey ¶
func GetUBDsKey(delAddr sdk.AccAddress) []byte
GetUBDsKey creates the prefix for all unbonding delegations from a delegator
func GetUnbondingDelegationTimeKey ¶
GetUnbondingDelegationTimeKey creates the prefix for all unbonding delegations from a delegator
func GetUnbondingIndexKey ¶
GetUnbondingIndexKey returns a key for the index for looking up UnbondingDelegations by the UnbondingDelegationEntries they contain
func GetUnbondingTypeKey ¶
GetUnbondingTypeKey returns a key for an index containing the type of unbonding operations
func GetValidatorByConsAddrKey ¶
func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte
GetValidatorByConsAddrKey creates the key for the validator with pubkey VALUE: validator operator address ([]byte)
func GetValidatorKey ¶
func GetValidatorKey(operatorAddr sdk.ValAddress) []byte
GetValidatorKey creates the key for the validator with address VALUE: staking/Validator
func GetValidatorQueueKey ¶
GetValidatorQueueKey returns the prefix key used for getting a set of unbonding validators whose unbonding completion occurs at the given time and height.
func GetValidatorsByPowerIndexKey ¶
func GetValidatorsByPowerIndexKey(validator Validator, powerReduction math.Int, valAc addresscodec.Codec) []byte
GetValidatorsByPowerIndexKey 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. VALUE: validator operator address ([]byte)
func MustMarshalDelegation ¶
func MustMarshalDelegation(cdc codec.BinaryCodec, delegation Delegation) []byte
MustMarshalDelegation returns the delegation bytes. Panics if fails
func MustMarshalRED ¶
func MustMarshalRED(cdc codec.BinaryCodec, red Redelegation) []byte
MustMarshalRED returns the Redelegation bytes. Panics if fails.
func MustMarshalUBD ¶
func MustMarshalUBD(cdc codec.BinaryCodec, ubd UnbondingDelegation) []byte
return the unbonding delegation
func MustMarshalUBDE ¶
func MustMarshalUBDE(cdc codec.BinaryCodec, ubd UnbondingDelegationEntry) []byte
return the unbonding delegation entry
func MustMarshalValidator ¶
func MustMarshalValidator(cdc codec.BinaryCodec, validator *Validator) []byte
return the redelegation
func ParamKeyTable
deprecated
func ParamKeyTable() paramtypes.KeyTable
Deprecated: now params can be accessed on key `0x51` on the staking store. ParamTable for staking module
func ParseDelegationsByValKey ¶
func ParseDelegationsByValKey(bz []byte) (sdk.ValAddress, sdk.AccAddress, error)
ParseDelegationsByValKey parses given key and returns validator, delegator address bytes
func ParseValidatorPowerRankKey ¶
ParseValidatorPowerRankKey parses the validators operator address from power rank key
func ParseValidatorQueueKey ¶
ParseValidatorQueueKey returns the encoded time and height from a key created from GetValidatorQueueKey.
func RegisterInterfaces ¶
func RegisterInterfaces(registry types.InterfaceRegistry)
RegisterInterfaces registers the x/staking interfaces types with the interface registry
func RegisterLegacyAminoCodec ¶
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the necessary x/staking interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func ValidateBasic ¶
ValidateBasic will ensure HistoricalInfo is not nil and sorted
func ValidatePowerReduction ¶
func ValidatePowerReduction(i interface{}) error
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { AddressCodec() address.Codec IterateAccounts(ctx context.Context, process func(sdk.AccountI) (stop bool)) GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // only used for simulation GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(context.Context, sdk.ModuleAccountI) }
AccountKeeper defines the expected account keeper (noalias)
type BankKeeper ¶
type BankKeeper interface { GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin LockedCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins GetSupply(ctx context.Context, denom string) sdk.Coin SendCoinsFromModuleToModule(ctx context.Context, senderPool, recipientPool string, amt sdk.Coins) error UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error BurnCoins(ctx context.Context, name string, amt sdk.Coins) error }
BankKeeper defines the expected interface needed to retrieve account balances.
type DelegationI ¶
type DelegationI interface { GetDelegatorAddr() string // delegator string for the bond GetValidatorAddr() string // validator operator address GetPoints() uint64 // emission points on delegation start period }
DelegationI delegation bond for a delegated proof of stake system
type DelegationResponses ¶
type DelegationResponses []DelegationResponse
DelegationResponses is a collection of DelegationResp
func (DelegationResponses) String ¶
func (d DelegationResponses) String() (out string)
String implements the Stringer interface for DelegationResponses.
type DelegationSet ¶
type DelegationSet interface { GetValidatorSet() ValidatorSet // validator set for which delegation set is based upon // iterate through all delegations from one delegator by validator-AccAddress, // execute func for each validator IterateDelegations(ctx context.Context, delegator sdk.AccAddress, fn func(index int64, delegation DelegationI) (stop bool)) error }
DelegationSet expected properties for the set of all delegations for a particular (noalias)
type Delegations ¶
type Delegations []Delegation
Delegations is a collection of delegations
func (Delegations) String ¶
func (d Delegations) String() (out string)
type MultiRefStakingHooks ¶
type MultiRefStakingHooks []RefStakingHooks
func NewMultiRefStakingHooks ¶
func NewMultiRefStakingHooks(hooks ...RefStakingHooks) MultiRefStakingHooks
func (MultiRefStakingHooks) CheckDelegationAvailable ¶
func (h MultiRefStakingHooks) CheckDelegationAvailable(ctx context.Context, delAddr, valAddr string) error
func (MultiRefStakingHooks) DelegationCoinsModified ¶
type MultiStakingHooks ¶
type MultiStakingHooks []StakingHooks
func NewMultiStakingHooks ¶
func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks
func (MultiStakingHooks) AfterDelegationModified ¶
func (h MultiStakingHooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) AfterUnbondingInitiated ¶
func (h MultiStakingHooks) AfterUnbondingInitiated(ctx context.Context, id uint64) error
func (MultiStakingHooks) AfterValidatorBeginUnbonding ¶
func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) AfterValidatorBonded ¶
func (h MultiStakingHooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) AfterValidatorCreated ¶
func (h MultiStakingHooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error
func (MultiStakingHooks) AfterValidatorRemoved ¶
func (h MultiStakingHooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) BeforeDelegationCreated ¶
func (h MultiStakingHooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) BeforeDelegationRemoved ¶
func (h MultiStakingHooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) BeforeDelegationSharesModified ¶
func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (MultiStakingHooks) BeforeValidatorModified ¶
func (h MultiStakingHooks) BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error
func (MultiStakingHooks) BeforeValidatorSlashed ¶
func (h MultiStakingHooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error
type QueryDelegatorParams ¶
type QueryDelegatorParams struct {
DelegatorAddr sdk.AccAddress
}
defines the params for the following queries: - 'custom/staking/delegatorDelegations' - 'custom/staking/delegatorUnbondingDelegations' - 'custom/staking/delegatorValidators'
func NewQueryDelegatorParams ¶
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams
type QueryRedelegationParams ¶
type QueryRedelegationParams struct { DelegatorAddr sdk.AccAddress SrcValidatorAddr sdk.ValAddress DstValidatorAddr sdk.ValAddress }
defines the params for the following queries: - 'custom/staking/redelegation'
func NewQueryRedelegationParams ¶
func NewQueryRedelegationParams(delegatorAddr sdk.AccAddress, srcValidatorAddr, dstValidatorAddr sdk.ValAddress) QueryRedelegationParams
type QueryValidatorParams ¶
type QueryValidatorParams struct { ValidatorAddr sdk.ValAddress Page, Limit int }
defines the params for the following queries: - 'custom/staking/validator' - 'custom/staking/validatorDelegations' - 'custom/staking/validatorUnbondingDelegations'
func NewQueryValidatorParams ¶
func NewQueryValidatorParams(validatorAddr sdk.ValAddress, page, limit int) QueryValidatorParams
type QueryValidatorsParams ¶
QueryValidatorsParams defines the params for the following queries: - 'custom/staking/validators'
func NewQueryValidatorsParams ¶
func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams
type RedelegationResponses ¶
type RedelegationResponses []RedelegationResponse
RedelegationResponses are a collection of RedelegationResp
func (RedelegationResponses) String ¶
func (r RedelegationResponses) String() (out string)
type Redelegations ¶
type Redelegations []Redelegation
Redelegations are a collection of Redelegation
func (Redelegations) String ¶
func (d Redelegations) String() (out string)
type RefStakingHooks ¶
type RefStakingHooks interface { DelegationCoinsModified(ctx context.Context, delAddr, valAddr string, oldCoins, newCoins math.Int) error CheckDelegationAvailable(ctx context.Context, delAddr, valAddr string) error SpendCoinsForRef(ctx context.Context, addr string, totalAmount math.Int) (math.Int, error) }
type RefStakingHooksWrapper ¶
type RefStakingHooksWrapper struct{ RefStakingHooks }
StakingHooksWrapper is a wrapper for modules to inject StakingHooks using depinject.
func (RefStakingHooksWrapper) IsOnePerModuleType ¶
func (RefStakingHooksWrapper) IsOnePerModuleType()
IsOnePerModuleType implements the depinject.OnePerModuleType interface.
type StakingHooks ¶
type StakingHooks interface { AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error // Must be called when a validator is created BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error // Must be called when a validator's state changes AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is deleted AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator is bonded AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error // Must be called when a validator begins unbonding BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation is created BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error // Must be called when a delegation is removed AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error AfterUnbondingInitiated(ctx context.Context, id uint64) error }
StakingHooks event hooks for staking validator object (noalias)
type StakingHooksWrapper ¶
type StakingHooksWrapper struct{ StakingHooks }
StakingHooksWrapper is a wrapper for modules to inject StakingHooks using depinject.
func (StakingHooksWrapper) IsOnePerModuleType ¶
func (StakingHooksWrapper) IsOnePerModuleType()
IsOnePerModuleType implements the depinject.OnePerModuleType interface.
type UnbondingDelegations ¶
type UnbondingDelegations []UnbondingDelegation
UnbondingDelegations is a collection of UnbondingDelegation
func (UnbondingDelegations) String ¶
func (ubds UnbondingDelegations) String() (out string)
type UnbondingType ¶
type UnbondingType int
UnbondingType defines the type of unbonding operation
const ( UnbondingType_Undefined UnbondingType = iota UnbondingType_UnbondingDelegation UnbondingType_Redelegation UnbondingType_ValidatorUnbonding )
type ValidatorI ¶
type ValidatorI interface { IsJailed() bool // whether the validator is jailed GetMoniker() string // moniker of the validator GetStatus() BondStatus // status of the validator IsBonded() bool // check if has a bonded status IsUnbonded() bool // check if has status unbonded IsUnbonding() bool // check if has status unbonding GetOperator() string // operator address to receive/return validators coins ConsPubKey() (cryptotypes.PubKey, error) // validation consensus pubkey (cryptotypes.PubKey) TmConsPublicKey() (cmtprotocrypto.PublicKey, error) // validation consensus pubkey (CometBFT) GetConsAddr() ([]byte, error) // validation consensus address GetTokens() math.Int // validation tokens GetBondedTokens() math.Int // validator bonded tokens GetConsensusPower(math.Int) int64 // validation power in CometBFT GetMinSelfDelegation() math.Int // validator minimum self delegation GetPoints() uint64 // validator emission points GetEmission() math.LegacyDec // emission of coins from last distribution }
ValidatorI expected validator functions
type ValidatorSet ¶
type ValidatorSet interface { // iterate through validators by operator address, execute func for each validator IterateValidators(context.Context, func(index int64, validator ValidatorI) (stop bool)) error // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower(context.Context, func(index int64, validator ValidatorI) (stop bool)) error // iterate through the consensus validator set of the last block by operator address, execute func for each validator IterateLastValidators(context.Context, func(index int64, validator ValidatorI) (stop bool)) error Validator(context.Context, sdk.ValAddress) (ValidatorI, error) // get a particular validator by operator address ValidatorByConsAddr(context.Context, sdk.ConsAddress) (ValidatorI, error) // get a particular validator by consensus address TotalBondedTokens(context.Context) (math.Int, error) // total bonded tokens within the validator set StakingTokenSupply(context.Context) (math.Int, error) // total staking token supply // slash the validator and delegators of the validator, specifying offense height, offense power, and slash fraction Slash(context.Context, sdk.ConsAddress, int64, int64, math.LegacyDec) (math.Int, error) SlashWithInfractionReason(context.Context, sdk.ConsAddress, int64, int64, math.LegacyDec, Infraction) (math.Int, error) Jail(context.Context, sdk.ConsAddress) error // jail a validator Unjail(context.Context, sdk.ConsAddress) error // unjail a validator // Delegation allows for getting a particular delegation for a given validator // and delegator outside the scope of the staking module. Delegation(context.Context, sdk.AccAddress, sdk.ValAddress) (DelegationI, error) // MaxValidators returns the maximum amount of bonded validators MaxValidators(context.Context) (uint32, error) // GetPubKeyByConsAddr returns the consensus public key for a validator. Used in vote // extension validation. GetPubKeyByConsAddr(context.Context, sdk.ConsAddress) (cmtprotocrypto.PublicKey, error) }
ValidatorSet expected properties for the set of all validators (noalias)
type Validators ¶
Validators is a collection of Validator
func (Validators) Sort ¶
func (v Validators) Sort()
Sort Validators sorts validator array in ascending operator address order
func (Validators) String ¶
func (v Validators) String() (out string)
func (Validators) ToSDKValidators ¶
func (v Validators) ToSDKValidators() (validators []ValidatorI)
ToSDKValidators - convenience function convert []Validator to []sdk.ValidatorI
func (Validators) UnpackInterfaces ¶
func (v Validators) UnpackInterfaces(c codectypes.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
type ValidatorsByvotePower ¶
type ValidatorsByvotePower []Validator
ValidatorsByvotePower implements sort.Interface for []Validator based on the votePower and Address fields. The validators are sorted first by their vote power (descending). Secondary index - Address (ascending). Copied from tendermint/types/validator_set.go
func (ValidatorsByvotePower) Len ¶
func (valz ValidatorsByvotePower) Len() int
func (ValidatorsByvotePower) Less ¶
func (valz ValidatorsByvotePower) Less(i, j int, r math.Int) bool
func (ValidatorsByvotePower) Swap ¶
func (valz ValidatorsByvotePower) Swap(i, j int)