validator

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 31 Imported by: 1

README

TODO

The scaffolding tool creates a module with countless todos. These todos are placed in places in which you much delete them and fill them with what the module you are building needs.

APP

Once you have created your module and you are ready to integrate it into your app then you can follow the readme that is generated in the scaffolding of the app.

Documentation

Index

Constants

View Source
const (
	ModuleName        = types.ModuleName
	RouterKey         = types.RouterKey
	StoreKey          = types.StoreKey
	TStoreKey         = types.TStoreKey
	DefaultParamSpace = keeper.DefaultParamspace
	DefaultCodespace  = types.DefaultCodespace
	QuerierRoute      = types.QuerierRoute
	NotBondedPoolName = types.NotBondedPoolName
	BondedPoolName    = types.BondedPoolName
	DefaultBondDenom  = types.DefaultBondDenom

	ValidatorsKey = types.ValidatorsKey

	DeclareCandidateConst = types.DeclareCandidateConst
	DelegateConst         = types.DelegateConst
	SetOnlineConst        = types.SetOnlineConst
	SetOfflineConst       = types.SetOfflineConst
	UnbondConst           = types.UnbondConst
	EditCandidateConst    = types.EditCandidateConst

	DAOAddress1 = keeper.DAOAddress1
	DAOAddress2 = keeper.DAOAddress2
	DAOAddress3 = keeper.DAOAddress3

	DevelopAddress1 = keeper.DevelopAddress1
	DevelopAddress2 = keeper.DevelopAddress2
	DevelopAddress3 = keeper.DevelopAddress3

	Unbonded  = types.Unbonded
	Unbonding = types.Unbonding
	Bonded    = types.Bonded
)

Variables

View Source
var (
	// functions aliases
	NewKeeper           = keeper.NewKeeper
	NewQuerier          = keeper.NewQuerier
	RegisterCodec       = types.RegisterCodec
	DefaultGenesisState = types.DefaultGenesisState

	NewMsgDeclareCandidate = types.NewMsgDeclareCandidate
	NewMsgEditCandidate    = types.NewMsgEditCandidate
	NewMsgDelegate         = types.NewMsgDelegate
	NewMsgUnbond           = types.NewMsgUnbond
	NewMsgSetOnline        = types.NewMsgSetOnline
	NewMsgSetOffline       = types.NewMsgSetOffline
	NewMsgDelegateNFT      = types.NewMsgDelegateNFT
	NewMsgUnbondNFT        = types.NewMsgUnbondNFT

	NewValidator = types.NewValidator

	ErrCalculateCommission             = types.ErrCalculateCommission
	ErrUpdateBalance                   = types.ErrUpdateBalance
	ErrInsufficientFunds               = types.ErrInsufficientFunds
	ErrInsufficientCoinToPayCommission = types.ErrInsufficientCoinToPayCommission

	DefaultParams = types.DefaultParams

	TokensFromConsensusPower = types.TokensFromConsensusPower
	TokensToConsensusPower   = types.TokensToConsensusPower

	// variable aliases
	ModuleCdc = types.ModuleCdc
)

Functions

func BeginBlocker

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

BeginBlocker check for infraction evidence or downtime of validators on every begin block

func EndBlocker

func EndBlocker(ctx sdk.Context, k Keeper, coinKeeper coin.Keeper, supplyKeeper supply.Keeper, withRewards bool) []abci.ValidatorUpdate

EndBlocker called every block, process inflation, update validator set.

func ExportGenesis

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

func InitGenesis(ctx sdk.Context, keeper Keeper,
	supplyKeeper types.SupplyKeeper, data GenesisState) []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(keeper Keeper) sdk.Handler

NewHandler creates an sdk.Handler for all the validator type messages

func SyncDelegate added in v1.2.6

func SyncDelegate(ctx sdk.Context, k Keeper)

func SyncPools

func SyncPools(ctx sdk.Context, k Keeper, supplyKeeper supply.Keeper)

func SyncPools2

func SyncPools2(ctx sdk.Context, k Keeper, supplyKeeper supply.Keeper)

func SyncUnbondingDelegations

func SyncUnbondingDelegations(ctx sdk.Context, k Keeper)

func SyncValidators

func SyncValidators(ctx sdk.Context, k Keeper)

func ValidateGenesis

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

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

WriteValidators returns a slice of bonded genesis validators.

Types

type AppModule

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

AppModule implements an application module for the validator module.

func NewAppModule

func NewAppModule(k Keeper, supplyKeeper supply.Keeper, coinKeeper coin.Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

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

BeginBlock returns the begin blocker for the validator module.

func (AppModule) EndBlock

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

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

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

func (AppModule) InitGenesis

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

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

func (AppModule) Name

func (AppModule) Name() string

Name returns the validator module's name.

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the validator module.

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the validator module sdk.Querier.

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the validator module's querier route name.

func (AppModule) RegisterInvariants

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

RegisterInvariants registers the validator module invariants.

func (AppModule) Route

func (AppModule) Route() string

Route returns the message routing key for the validator module.

type AppModuleBasic

type AppModuleBasic struct{}

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

func (AppModuleBasic) BuildCreateValidatorMsg

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

BuildCreateValidatorMsg - used for gen-tx

func (AppModuleBasic) CreateValidatorMsgHelpers

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

CreateValidatorMsgHelpers - used for gen-tx

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

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

func (AppModuleBasic) GetQueryCmd

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

GetQueryCmd returns no root query command for the validator module.

func (AppModuleBasic) GetTxCmd

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

GetTxCmd returns the root tx command for the validator module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the validator module's name.

func (AppModuleBasic) PrepareFlagsForTxCreateValidator

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

PrepareFlagsForTxCreateValidator - used for gen-tx

func (AppModuleBasic) RegisterCodec

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

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

func (AppModuleBasic) RegisterRESTRoutes

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

RegisterRESTRoutes registers the REST routes for the validator module.

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the validator module.

type BondStatus

type BondStatus = types.BondStatus

type CodeType

type CodeType = types.CodeType

type Description

type Description = types.Description

type GenesisState

type GenesisState = types.GenesisState

type Keeper

type Keeper = keeper.Keeper

type MsgDeclareCandidate

type MsgDeclareCandidate = types.MsgDeclareCandidate

func NewTestMsgDeclareCandidate

func NewTestMsgDeclareCandidate(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) MsgDeclareCandidate

func NewTestMsgDeclareCandidateWithCommission

func NewTestMsgDeclareCandidateWithCommission(address sdk.ValAddress, pubKey crypto.PubKey,
	amt sdk.Int, commissionRate sdk.Dec) MsgDeclareCandidate

type MsgDelegate

type MsgDelegate = types.MsgDelegate

func NewTestMsgDelegate

func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Int) MsgDelegate

type MsgDelegateNFT

type MsgDelegateNFT = types.MsgDelegateNFT

type MsgEditCandidate

type MsgEditCandidate = types.MsgEditCandidate

type MsgSetOffline

type MsgSetOffline = types.MsgSetOffline

type MsgSetOnline

type MsgSetOnline = types.MsgSetOnline

type MsgUnbond

type MsgUnbond = types.MsgUnbond

type MsgUnbondNFT

type MsgUnbondNFT = types.MsgUnbondNFT

type Params

type Params = types.Params

type UnbondingDelegation

type UnbondingDelegation = types.UnbondingDelegation

type UnbondingDelegationEntry

type UnbondingDelegationEntry = types.UnbondingDelegationEntry

type Validator

type Validator = types.Validator

Directories

Path Synopsis
client
cli
internal

Jump to

Keyboard shortcuts

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