staking

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultParamspace                  = keeper.DefaultParamspace
	ModuleName                         = types.ModuleName
	StoreKey                           = types.StoreKey
	QuerierRoute                       = types.QuerierRoute
	RouterKey                          = types.RouterKey
	DefaultUnbondingTime               = types.DefaultUnbondingTime
	DefaultMaxValidators               = types.DefaultMaxValidators
	DefaultMaxEntries                  = types.DefaultMaxEntries
	NotBondedPoolName                  = types.NotBondedPoolName
	BondedPoolName                     = types.BondedPoolName
	QueryValidators                    = types.QueryValidators
	QueryValidator                     = types.QueryValidator
	QueryDelegatorDelegations          = types.QueryDelegatorDelegations
	QueryDelegatorUnbondingDelegations = types.QueryDelegatorUnbondingDelegations
	QueryRedelegations                 = types.QueryRedelegations
	QueryValidatorDelegations          = types.QueryValidatorDelegations
	QueryValidatorRedelegations        = types.QueryValidatorRedelegations
	QueryValidatorUnbondingDelegations = types.QueryValidatorUnbondingDelegations
	QueryDelegation                    = types.QueryDelegation
	QueryUnbondingDelegation           = types.QueryUnbondingDelegation
	QueryDelegatorValidators           = types.QueryDelegatorValidators
	QueryDelegatorValidator            = types.QueryDelegatorValidator
	QueryPool                          = types.QueryPool
	QueryParameters                    = types.QueryParameters
	QueryHistoricalInfo                = types.QueryHistoricalInfo
	MaxMonikerLength                   = types.MaxMonikerLength
	MaxIdentityLength                  = types.MaxIdentityLength
	MaxWebsiteLength                   = types.MaxWebsiteLength
	MaxDetailsLength                   = types.MaxDetailsLength
	DoNotModifyDesc                    = types.DoNotModifyDesc
)

Variables

View Source
var (
	// functions aliases
	RegisterInvariants                 = keeper.RegisterInvariants
	AllInvariants                      = keeper.AllInvariants
	ModuleAccountInvariants            = keeper.ModuleAccountInvariants
	NonNegativePowerInvariant          = keeper.NonNegativePowerInvariant
	PositiveDelegationInvariant        = keeper.PositiveDelegationInvariant
	DelegatorSharesInvariant           = keeper.DelegatorSharesInvariant
	NewKeeper                          = keeper.NewKeeper
	ParamKeyTable                      = keeper.ParamKeyTable
	NewQuerier                         = keeper.NewQuerier
	RegisterCodec                      = types.RegisterCodec
	NewCommissionRates                 = types.NewCommissionRates
	NewCommission                      = types.NewCommission
	NewCommissionWithTime              = types.NewCommissionWithTime
	NewDelegation                      = types.NewDelegation
	MustMarshalDelegation              = types.MustMarshalDelegation
	MustUnmarshalDelegation            = types.MustUnmarshalDelegation
	UnmarshalDelegation                = types.UnmarshalDelegation
	NewUnbondingDelegation             = types.NewUnbondingDelegation
	NewUnbondingDelegationEntry        = types.NewUnbondingDelegationEntry
	MustMarshalUBD                     = types.MustMarshalUBD
	MustUnmarshalUBD                   = types.MustUnmarshalUBD
	UnmarshalUBD                       = types.UnmarshalUBD
	NewRedelegation                    = types.NewRedelegation
	NewRedelegationEntry               = types.NewRedelegationEntry
	MustMarshalRED                     = types.MustMarshalRED
	MustUnmarshalRED                   = types.MustUnmarshalRED
	UnmarshalRED                       = types.UnmarshalRED
	NewDelegationResp                  = types.NewDelegationResp
	NewRedelegationResponse            = types.NewRedelegationResponse
	NewRedelegationEntryResponse       = types.NewRedelegationEntryResponse
	NewHistoricalInfo                  = types.NewHistoricalInfo
	MustMarshalHistoricalInfo          = types.MustMarshalHistoricalInfo
	MustUnmarshalHistoricalInfo        = types.MustUnmarshalHistoricalInfo
	UnmarshalHistoricalInfo            = types.UnmarshalHistoricalInfo
	ErrEmptyValidatorAddr              = types.ErrEmptyValidatorAddr
	ErrBadValidatorAddr                = types.ErrBadValidatorAddr
	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
	ErrMinSelfDelegationInvalid        = types.ErrMinSelfDelegationInvalid
	ErrMinSelfDelegationDecreased      = types.ErrMinSelfDelegationDecreased
	ErrEmptyDelegatorAddr              = types.ErrEmptyDelegatorAddr
	ErrBadDenom                        = types.ErrBadDenom
	ErrBadDelegationAddr               = types.ErrBadDelegationAddr
	ErrBadDelegationAmount             = types.ErrBadDelegationAmount
	ErrNoDelegation                    = types.ErrNoDelegation
	ErrBadDelegatorAddr                = types.ErrBadDelegatorAddr
	ErrNoDelegatorForAddress           = types.ErrNoDelegatorForAddress
	ErrInsufficientShares              = types.ErrInsufficientShares
	ErrDelegationValidatorEmpty        = types.ErrDelegationValidatorEmpty
	ErrNotEnoughDelegationShares       = types.ErrNotEnoughDelegationShares
	ErrBadSharesAmount                 = types.ErrBadSharesAmount
	ErrBadSharesPercent                = types.ErrBadSharesPercent
	ErrNotMature                       = types.ErrNotMature
	ErrNoUnbondingDelegation           = types.ErrNoUnbondingDelegation
	ErrMaxUnbondingDelegationEntries   = types.ErrMaxUnbondingDelegationEntries
	ErrBadRedelegationAddr             = types.ErrBadRedelegationAddr
	ErrNoRedelegation                  = types.ErrNoRedelegation
	ErrSelfRedelegation                = types.ErrSelfRedelegation
	ErrTinyRedelegationAmount          = types.ErrTinyRedelegationAmount
	ErrBadRedelegationDst              = types.ErrBadRedelegationDst
	ErrTransitiveRedelegation          = types.ErrTransitiveRedelegation
	ErrMaxRedelegationEntries          = types.ErrMaxRedelegationEntries
	ErrDelegatorShareExRateInvalid     = types.ErrDelegatorShareExRateInvalid
	ErrBothShareMsgsGiven              = types.ErrBothShareMsgsGiven
	ErrNeitherShareMsgsGiven           = types.ErrNeitherShareMsgsGiven
	ErrInvalidHistoricalInfo           = types.ErrInvalidHistoricalInfo
	ErrNoHistoricalInfo                = types.ErrNoHistoricalInfo
	ErrEmptyValidatorPubKey            = types.ErrEmptyValidatorPubKey
	NewGenesisState                    = types.NewGenesisState
	DefaultGenesisState                = types.DefaultGenesisState
	NewMultiStakingHooks               = types.NewMultiStakingHooks
	GetValidatorKey                    = types.GetValidatorKey
	GetValidatorByConsAddrKey          = types.GetValidatorByConsAddrKey
	AddressFromLastValidatorPowerKey   = types.AddressFromLastValidatorPowerKey
	GetValidatorsByPowerIndexKey       = types.GetValidatorsByPowerIndexKey
	GetLastValidatorPowerKey           = types.GetLastValidatorPowerKey
	ParseValidatorPowerRankKey         = types.ParseValidatorPowerRankKey
	GetValidatorQueueTimeKey           = types.GetValidatorQueueTimeKey
	GetDelegationKey                   = types.GetDelegationKey
	GetDelegationsKey                  = types.GetDelegationsKey
	GetUBDKey                          = types.GetUBDKey
	GetUBDByValIndexKey                = types.GetUBDByValIndexKey
	GetUBDKeyFromValIndexKey           = types.GetUBDKeyFromValIndexKey
	GetUBDsKey                         = types.GetUBDsKey
	GetUBDsByValIndexKey               = types.GetUBDsByValIndexKey
	GetUnbondingDelegationTimeKey      = types.GetUnbondingDelegationTimeKey
	GetREDKey                          = types.GetREDKey
	GetREDByValSrcIndexKey             = types.GetREDByValSrcIndexKey
	GetREDByValDstIndexKey             = types.GetREDByValDstIndexKey
	GetREDKeyFromValSrcIndexKey        = types.GetREDKeyFromValSrcIndexKey
	GetREDKeyFromValDstIndexKey        = types.GetREDKeyFromValDstIndexKey
	GetRedelegationTimeKey             = types.GetRedelegationTimeKey
	GetREDsKey                         = types.GetREDsKey
	GetREDsFromValSrcIndexKey          = types.GetREDsFromValSrcIndexKey
	GetREDsToValDstIndexKey            = types.GetREDsToValDstIndexKey
	GetREDsByDelToValDstIndexKey       = types.GetREDsByDelToValDstIndexKey
	GetHistoricalInfoKey               = types.GetHistoricalInfoKey
	NewMsgCreateValidator              = types.NewMsgCreateValidator
	NewMsgEditValidator                = types.NewMsgEditValidator
	NewMsgDelegate                     = types.NewMsgDelegate
	NewMsgBeginRedelegate              = types.NewMsgBeginRedelegate
	NewMsgUndelegate                   = types.NewMsgUndelegate
	NewParams                          = types.NewParams
	DefaultParams                      = types.DefaultParams
	MustUnmarshalParams                = types.MustUnmarshalParams
	UnmarshalParams                    = types.UnmarshalParams
	NewPool                            = types.NewPool
	NewQueryDelegatorParams            = types.NewQueryDelegatorParams
	NewQueryValidatorParams            = types.NewQueryValidatorParams
	NewQueryBondsParams                = types.NewQueryBondsParams
	NewQueryRedelegationParams         = types.NewQueryRedelegationParams
	NewQueryValidatorsParams           = types.NewQueryValidatorsParams
	NewQueryHistoricalInfoParams       = types.NewQueryHistoricalInfoParams
	NewValidator                       = types.NewValidator
	MustMarshalValidator               = types.MustMarshalValidator
	MustUnmarshalValidator             = types.MustUnmarshalValidator
	UnmarshalValidator                 = types.UnmarshalValidator
	NewDescription                     = types.NewDescription

	// variable aliases
	ModuleCdc                        = types.ModuleCdc
	LastValidatorPowerKey            = types.LastValidatorPowerKey
	LastTotalPowerKey                = types.LastTotalPowerKey
	ValidatorsKey                    = types.ValidatorsKey
	ValidatorsByConsAddrKey          = types.ValidatorsByConsAddrKey
	ValidatorsByPowerIndexKey        = types.ValidatorsByPowerIndexKey
	DelegationKey                    = types.DelegationKey
	UnbondingDelegationKey           = types.UnbondingDelegationKey
	UnbondingDelegationByValIndexKey = types.UnbondingDelegationByValIndexKey
	RedelegationKey                  = types.RedelegationKey
	RedelegationByValSrcIndexKey     = types.RedelegationByValSrcIndexKey
	RedelegationByValDstIndexKey     = types.RedelegationByValDstIndexKey
	UnbondingQueueKey                = types.UnbondingQueueKey
	RedelegationQueueKey             = types.RedelegationQueueKey
	ValidatorQueueKey                = types.ValidatorQueueKey
	HistoricalInfoKey                = types.HistoricalInfoKey
	KeyUnbondingTime                 = types.KeyUnbondingTime
	KeyMaxValidators                 = types.KeyMaxValidators
	KeyMaxEntries                    = types.KeyMaxEntries
	KeyBondDenom                     = types.KeyBondDenom
)

Functions

func BeginBlocker added in v1.0.0

func BeginBlocker(ctx sdk.Context, k keeper.Keeper)

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

func EndBlocker added in v0.30.0

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

Called every block, update validator set

func ExportGenesis added in v0.30.0

func ExportGenesis(ctx sdk.Context, keeper Keeper) 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 InitGenesis added in v0.30.0

func InitGenesis(
	ctx sdk.Context, keeper Keeper, accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper, 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 NewHandler

func NewHandler(k keeper.Keeper) sdk.Handler

func ValidateGenesis added in v0.30.0

func ValidateGenesis(data types.GenesisState) error

ValidateGenesis validates the provided staking genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)

func WriteValidators added in v0.30.0

func WriteValidators(ctx sdk.Context, keeper Keeper) (vals []tmtypes.GenesisValidator)

WriteValidators returns a slice of bonded genesis validators.

Types

type AppModule added in v1.0.0

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements an application module for the staking module.

func NewAppModule added in v1.0.0

func NewAppModule(cdc codec.Marshaler, keeper Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock added in v1.0.0

func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)

BeginBlock returns the begin blocker for the staking module.

func (AppModule) EndBlock added in v1.0.0

EndBlock returns the end blocker for the staking module. It returns no validator updates.

func (AppModule) ExportGenesis added in v1.0.0

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the staking module.

func (AppModule) GenerateGenesisState added in v1.0.0

func (AppModule) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the staking module.

func (AppModule) InitGenesis added in v1.0.0

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the staking module. It returns no validator updates.

func (AppModule) Name added in v1.0.0

func (AppModule) Name() string

Name returns the staking module's name.

func (AppModule) NewHandler added in v1.0.0

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the staking module.

func (AppModule) NewQuerierHandler added in v1.0.0

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the staking module sdk.Querier.

func (AppModule) ProposalContents added in v1.0.0

func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent

ProposalContents doesn't return any content functions for governance proposals.

func (AppModule) QuerierRoute added in v1.0.0

func (AppModule) QuerierRoute() string

QuerierRoute returns the staking module's querier route name.

func (AppModule) RandomizedParams added in v1.0.0

func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange

RandomizedParams creates randomized staking param changes for the simulator.

func (AppModule) RegisterInvariants added in v1.0.0

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers the staking module invariants.

func (AppModule) RegisterStoreDecoder added in v1.0.0

func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for staking module's types

func (AppModule) Route added in v1.0.0

func (AppModule) Route() string

Route returns the message routing key for the staking module.

func (AppModule) WeightedOperations added in v1.0.0

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

WeightedOperations returns the all the staking module operations with their respective weights.

type AppModuleBasic added in v1.0.0

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

AppModuleBasic defines the basic application module used by the staking module.

func (AppModuleBasic) BuildCreateValidatorMsg added in v1.0.0

func (AppModuleBasic) BuildCreateValidatorMsg(cliCtx context.CLIContext,
	txBldr authtypes.TxBuilder) (authtypes.TxBuilder, sdk.Msg, error)

BuildCreateValidatorMsg - used for gen-tx

func (AppModuleBasic) CreateValidatorMsgHelpers added in v1.0.0

func (AppModuleBasic) CreateValidatorMsgHelpers(ipDefault string) (
	fs *flag.FlagSet, nodeIDFlag, pubkeyFlag, amountFlag, defaultsDesc string)

CreateValidatorMsgHelpers - used for gen-tx

func (AppModuleBasic) DefaultGenesis added in v1.0.0

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the staking module.

func (AppModuleBasic) GetQueryCmd added in v1.0.0

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd returns no root query command for the staking module.

func (AppModuleBasic) GetTxCmd added in v1.0.0

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd returns the root tx command for the staking module.

func (AppModuleBasic) Name added in v1.0.0

func (AppModuleBasic) Name() string

Name returns the staking module's name.

func (AppModuleBasic) PrepareFlagsForTxCreateValidator added in v1.0.0

func (AppModuleBasic) PrepareFlagsForTxCreateValidator(config *cfg.Config, nodeID,
	chainID string, valPubKey crypto.PubKey)

PrepareFlagsForTxCreateValidator - used for gen-tx

func (AppModuleBasic) RegisterCodec added in v1.0.0

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the staking module's types for the given codec.

func (AppModuleBasic) RegisterRESTRoutes added in v1.0.0

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the staking module.

func (AppModuleBasic) ValidateGenesis added in v1.0.0

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the staking module.

type Commission added in v0.30.0

type Commission = types.Commission

type CommissionRates added in v1.0.0

type CommissionRates = types.CommissionRates

type DVPair added in v1.0.0

type DVPair = types.DVPair

type DVVTriplet added in v1.0.0

type DVVTriplet = types.DVVTriplet

type Delegation added in v0.30.0

type Delegation = types.Delegation

type DelegationI added in v1.0.0

type DelegationI = exported.DelegationI

type DelegationResponse added in v1.0.0

type DelegationResponse = types.DelegationResponse

type DelegationResponses added in v1.0.0

type DelegationResponses = types.DelegationResponses

type Delegations added in v0.30.0

type Delegations = types.Delegations

type Description added in v0.30.0

type Description = types.Description

type GenesisState added in v0.30.0

type GenesisState = types.GenesisState

type HistoricalInfo added in v1.0.0

type HistoricalInfo = types.HistoricalInfo

type Keeper added in v0.30.0

type Keeper = keeper.Keeper

type LastValidatorPower added in v1.0.0

type LastValidatorPower = types.LastValidatorPower

type MsgBeginRedelegate added in v0.30.0

type MsgBeginRedelegate = types.MsgBeginRedelegate

type MsgCreateValidator added in v0.30.0

type MsgCreateValidator = types.MsgCreateValidator

type MsgDelegate added in v0.30.0

type MsgDelegate = types.MsgDelegate

type MsgEditValidator added in v0.30.0

type MsgEditValidator = types.MsgEditValidator

type MsgUndelegate added in v0.30.0

type MsgUndelegate = types.MsgUndelegate

type MultiStakingHooks added in v1.0.0

type MultiStakingHooks = types.MultiStakingHooks

type Params added in v0.30.0

type Params = types.Params

type Pool added in v0.30.0

type Pool = types.Pool

type QueryBondsParams added in v0.30.0

type QueryBondsParams = types.QueryBondsParams

type QueryDelegatorParams added in v0.30.0

type QueryDelegatorParams = types.QueryDelegatorParams

type QueryHistoricalInfoParams added in v1.0.0

type QueryHistoricalInfoParams = types.QueryHistoricalInfoParams

type QueryRedelegationParams added in v0.30.0

type QueryRedelegationParams = types.QueryRedelegationParams

type QueryValidatorParams added in v0.30.0

type QueryValidatorParams = types.QueryValidatorParams

type QueryValidatorsParams added in v1.0.0

type QueryValidatorsParams = types.QueryValidatorsParams

type Redelegation added in v0.30.0

type Redelegation = types.Redelegation

type RedelegationEntry added in v1.0.0

type RedelegationEntry = types.RedelegationEntry

type RedelegationEntryResponse added in v1.0.0

type RedelegationEntryResponse = types.RedelegationEntryResponse

type RedelegationResponse added in v1.0.0

type RedelegationResponse = types.RedelegationResponse

type RedelegationResponses added in v1.0.0

type RedelegationResponses = types.RedelegationResponses

type Redelegations added in v0.30.0

type Redelegations = types.Redelegations

type UnbondingDelegation added in v0.30.0

type UnbondingDelegation = types.UnbondingDelegation

type UnbondingDelegationEntry added in v1.0.0

type UnbondingDelegationEntry = types.UnbondingDelegationEntry

type UnbondingDelegations added in v0.30.0

type UnbondingDelegations = types.UnbondingDelegations

type Validator added in v0.30.0

type Validator = types.Validator

type ValidatorI added in v1.0.0

type ValidatorI = exported.ValidatorI

type Validators added in v0.30.0

type Validators = types.Validators

Directories

Path Synopsis
client
cli
legacy
v0_34
DONTCOVER nolint
DONTCOVER nolint
v0_36
DONTCOVER nolint
DONTCOVER nolint
v0_38
DONTCOVER nolint
DONTCOVER nolint

Jump to

Keyboard shortcuts

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