types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "staking"

	// StoreKey is the store key string for bor
	StoreKey = ModuleName

	// RouterKey is the message route for bor
	RouterKey = ModuleName

	// QuerierRoute is the querier route for bor
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	// DefaultValPower default validator power
	DefaultValPower = 10
)
View Source
const (
	QueryCurrentValidatorSet  = "current-validator-set"
	QuerySigner               = "signer"
	QueryValidator            = "validator"
	QueryValidatorStatus      = "validator-status"
	QueryProposer             = "proposer"
	QueryCurrentProposer      = "current-proposer"
	QueryProposerBonusPercent = "proposer-bonus-percent"
	QueryDividendAccount      = "dividend-account"
	QueryDividendAccountRoot  = "dividend-account-root"
	QueryAccountProof         = "dividend-account-proof"
	QueryVerifyAccountProof   = "verify-account-proof"
	QuerySlashValidator       = "slash-validator"
)

query endpoints supported by the staking Querier

View Source
const (

	// DefaultProposerBonusPercent - Proposer Signer Reward Ratio
	DefaultProposerBonusPercent = int64(10)
)

Variables

View Source
var (
	EventTypeNewProposer   = "new-proposer"
	EventTypeValidatorJoin = "validator-join"
	EventTypeSignerUpdate  = "signer-update"
	EventTypeStakeUpdate   = "stake-update"
	EventTypeValidatorExit = "validator-exit"

	AttributeKeySigner            = "signer"
	AttributeKeyDeactivationEpoch = "deactivation-epoch"
	AttributeKeyActivationEpoch   = "activation-epoch"
	AttributeKeyValidatorID       = "validator-id"
	AttributeKeyUpdatedAt         = "updated-at"

	AttributeValueCategory = ModuleName
)

Checkpoint tags

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

View Source
var ParamStoreKeyProposerBonusPercent = []byte("proposerbonuspercent")

ParamStoreKeyProposerBonusPercent - Store's Key for Reward amount

Functions

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable type declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func RegisterPulp

func RegisterPulp(pulp *authTypes.Pulp)

func SetGenesisStateToAppState

func SetGenesisStateToAppState(appState map[string]json.RawMessage, validators []*hmTypes.Validator, currentValSet hmTypes.ValidatorSet, dividendAccounts []hmTypes.DividendAccount) (map[string]json.RawMessage, error)

SetGenesisStateToAppState sets state into app state

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of bor genesis data returning an error for any failed validation criteria.

Types

type GenesisState

type GenesisState struct {
	Validators       []*hmTypes.Validator      `json:"validators" yaml:"validators"`
	CurrentValSet    hmTypes.ValidatorSet      `json:"current_val_set" yaml:"current_val_set"`
	DividentAccounts []hmTypes.DividendAccount `json:"dividend_accounts" yaml:"dividend_accounts"`
	StakingSequences []string                  `json:"staking_sequences" yaml:"staking_sequences"`
}

GenesisState is the checkpoint state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns staking GenesisState given raw application genesis state

func NewGenesisState

func NewGenesisState(
	validators []*hmTypes.Validator,
	currentValSet hmTypes.ValidatorSet,
	dividentAccounts []hmTypes.DividendAccount,
	stakingSequences []string,
) GenesisState

NewGenesisState creates a new genesis state.

type GenesisValidator

type GenesisValidator struct {
	ID         hmTypes.ValidatorID     `json:"id"`
	StartEpoch uint64                  `json:"start_epoch"`
	EndEpoch   uint64                  `json:"end_epoch"`
	Power      uint64                  `json:"power"` // aka Amount
	PubKey     hmTypes.PubKey          `json:"pub_key"`
	Signer     hmTypes.HeimdallAddress `json:"signer"`
}

GenesisValidator genesis validator

func (*GenesisValidator) HeimdallValidator

func (v *GenesisValidator) HeimdallValidator() hmTypes.Validator

HeimdallValidator converts genesis validator validator to Heimdall validator

type MsgSignerUpdate

type MsgSignerUpdate struct {
	From            hmTypes.HeimdallAddress `json:"from"`
	ID              hmTypes.ValidatorID     `json:"id"`
	NewSignerPubKey hmTypes.PubKey          `json:"pubKey"`
	TxHash          hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex        uint64                  `json:"log_index"`
}

MsgSignerUpdate signer update struct TODO add old signer sig check

func NewMsgSignerUpdate

func NewMsgSignerUpdate(
	from hmTypes.HeimdallAddress,
	id uint64,
	pubKey hmTypes.PubKey,
	txhash hmTypes.HeimdallHash,
	logIndex uint64,
) MsgSignerUpdate

func (MsgSignerUpdate) GetLogIndex

func (msg MsgSignerUpdate) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgSignerUpdate) GetSignBytes

func (msg MsgSignerUpdate) GetSignBytes() []byte

func (MsgSignerUpdate) GetSigners

func (msg MsgSignerUpdate) GetSigners() []sdk.AccAddress

func (MsgSignerUpdate) GetTxHash

func (msg MsgSignerUpdate) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgSignerUpdate) Route

func (msg MsgSignerUpdate) Route() string

func (MsgSignerUpdate) Type

func (msg MsgSignerUpdate) Type() string

func (MsgSignerUpdate) ValidateBasic

func (msg MsgSignerUpdate) ValidateBasic() sdk.Error

type MsgStakeUpdate

type MsgStakeUpdate struct {
	From     hmTypes.HeimdallAddress `json:"from"`
	ID       hmTypes.ValidatorID     `json:"id"`
	TxHash   hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex uint64                  `json:"log_index"`
}

MsgStakeUpdate represents stake update

func NewMsgStakeUpdate

func NewMsgStakeUpdate(from hmTypes.HeimdallAddress, id uint64, txhash hmTypes.HeimdallHash, logIndex uint64) MsgStakeUpdate

NewMsgStakeUpdate represents stake update

func (MsgStakeUpdate) GetLogIndex

func (msg MsgStakeUpdate) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgStakeUpdate) GetSignBytes

func (msg MsgStakeUpdate) GetSignBytes() []byte

func (MsgStakeUpdate) GetSigners

func (msg MsgStakeUpdate) GetSigners() []sdk.AccAddress

func (MsgStakeUpdate) GetTxHash

func (msg MsgStakeUpdate) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgStakeUpdate) Route

func (msg MsgStakeUpdate) Route() string

func (MsgStakeUpdate) Type

func (msg MsgStakeUpdate) Type() string

func (MsgStakeUpdate) ValidateBasic

func (msg MsgStakeUpdate) ValidateBasic() sdk.Error

type MsgValidatorExit

type MsgValidatorExit struct {
	From     hmTypes.HeimdallAddress `json:"from"`
	ID       hmTypes.ValidatorID     `json:"id"`
	TxHash   hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex uint64                  `json:"log_index"`
}

func NewMsgValidatorExit

func NewMsgValidatorExit(from hmTypes.HeimdallAddress, id uint64, txhash hmTypes.HeimdallHash, logIndex uint64) MsgValidatorExit

func (MsgValidatorExit) GetLogIndex

func (msg MsgValidatorExit) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgValidatorExit) GetSignBytes

func (msg MsgValidatorExit) GetSignBytes() []byte

func (MsgValidatorExit) GetSigners

func (msg MsgValidatorExit) GetSigners() []sdk.AccAddress

func (MsgValidatorExit) GetTxHash

func (msg MsgValidatorExit) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgValidatorExit) Route

func (msg MsgValidatorExit) Route() string

func (MsgValidatorExit) Type

func (msg MsgValidatorExit) Type() string

func (MsgValidatorExit) ValidateBasic

func (msg MsgValidatorExit) ValidateBasic() sdk.Error

type MsgValidatorJoin

type MsgValidatorJoin struct {
	From         hmTypes.HeimdallAddress `json:"from"`
	ID           hmTypes.ValidatorID     `json:"id"`
	SignerPubKey hmTypes.PubKey          `json:"pub_key"`
	TxHash       hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex     uint64                  `json:"log_index"`
}

func NewMsgValidatorJoin

func NewMsgValidatorJoin(
	from hmTypes.HeimdallAddress,
	id uint64,
	pubkey hmTypes.PubKey,
	txhash hmTypes.HeimdallHash,
	logIndex uint64,
) MsgValidatorJoin

NewMsgValidatorJoin creates new validator-join

func (MsgValidatorJoin) GetLogIndex

func (msg MsgValidatorJoin) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgValidatorJoin) GetSignBytes

func (msg MsgValidatorJoin) GetSignBytes() []byte

func (MsgValidatorJoin) GetSigners

func (msg MsgValidatorJoin) GetSigners() []sdk.AccAddress

func (MsgValidatorJoin) GetTxHash

func (msg MsgValidatorJoin) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgValidatorJoin) Route

func (msg MsgValidatorJoin) Route() string

func (MsgValidatorJoin) Type

func (msg MsgValidatorJoin) Type() string

func (MsgValidatorJoin) ValidateBasic

func (msg MsgValidatorJoin) ValidateBasic() sdk.Error

type QueryAccountProofParams

type QueryAccountProofParams struct {
	DividendAccountID types.DividendAccountID `json:"dividend_account_id"`
}

QueryAccountProofParams defines the params for querying account proof.

func NewQueryAccountProofParams

func NewQueryAccountProofParams(dividendAccountID types.DividendAccountID) QueryAccountProofParams

NewQueryAccountProofParams creates a new instance of QueryAccountProofParams.

type QueryDividendAccountParams

type QueryDividendAccountParams struct {
	DividendAccountID types.DividendAccountID `json:"dividend_account_id"`
}

QueryDividendAccountParams defines the params for querying dividend account status.

func NewQueryDividendAccountParams

func NewQueryDividendAccountParams(dividendAccountID types.DividendAccountID) QueryDividendAccountParams

NewQueryDividendAccountParams creates a new instance of QueryDividendAccountParams.

type QueryProposerParams

type QueryProposerParams struct {
	Times uint64 `json:"times"`
}

QueryProposerParams defines the params for querying val status.

func NewQueryProposerParams

func NewQueryProposerParams(times uint64) QueryProposerParams

NewQueryProposerParams creates a new instance of QueryProposerParams.

type QuerySignerParams

type QuerySignerParams struct {
	SignerAddress []byte `json:"signer_address"`
}

QuerySignerParams defines the params for querying by address

func NewQuerySignerParams

func NewQuerySignerParams(signerAddress []byte) QuerySignerParams

NewQuerySignerParams creates a new instance of QuerySignerParams.

type QueryValidatorParams

type QueryValidatorParams struct {
	ValidatorID types.ValidatorID `json:"validator_id"`
}

QueryValidatorParams defines the params for querying val status.

func NewQueryValidatorParams

func NewQueryValidatorParams(validatorID types.ValidatorID) QueryValidatorParams

NewQueryValidatorParams creates a new instance of QueryValidatorParams.

type QueryValidatorStatusParams

type QueryValidatorStatusParams struct {
	SignerAddress []byte
}

QueryValidatorStatusParams defines the params for querying val status.

func NewQueryValidatorStatusParams

func NewQueryValidatorStatusParams(signerAddress []byte) QueryValidatorStatusParams

NewQueryValidatorStatusParams creates a new instance of QueryValidatorStatusParams.

type QueryVerifyAccountProofParams

type QueryVerifyAccountProofParams struct {
	DividendAccountID types.DividendAccountID `json:"dividend_account_id"`
	AccountProof      string                  `json:"account_proof"`
}

QueryVerifyAccountProofParams defines the params for verifying account proof.

func NewQueryVerifyAccountProofParams

func NewQueryVerifyAccountProofParams(dividendAccountID types.DividendAccountID, accountProof string) QueryVerifyAccountProofParams

NewQueryVerifyAccountProofParams creates a new instance of QueryVerifyAccountProofParams.

type ValidatorSlashParams

type ValidatorSlashParams struct {
	ValID       hmTypes.ValidatorID
	SlashAmount *big.Int
}

ValidatorSlashParams defines the params for slashing a validator

func NewValidatorSlashParams

func NewValidatorSlashParams(validatorID hmTypes.ValidatorID, amountToSlash *big.Int) ValidatorSlashParams

NewValidatorSlashParams creates a new instance of ValidatorSlashParams.

Jump to

Keyboard shortcuts

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