Documentation ¶
Index ¶
- Variables
- func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState
- func GetDividendAccountMapKey(id []byte) []byte
- func GetPrevDividendAccountMapKey(id []byte) []byte
- func GetStakingSequenceKey(sequence string) []byte
- func GetValidatorKey(address []byte) []byte
- func GetValidatorMapKey(address []byte) []byte
- func HandleMsgSignerUpdate(ctx sdk.Context, msg types.MsgSignerUpdate, k Keeper, ...) sdk.Result
- func HandleMsgStakeUpdate(ctx sdk.Context, msg types.MsgStakeUpdate, k Keeper, ...) sdk.Result
- func HandleMsgValidatorExit(ctx sdk.Context, msg types.MsgValidatorExit, k Keeper, ...) sdk.Result
- func HandleMsgValidatorJoin(ctx sdk.Context, msg types.MsgValidatorJoin, k Keeper, ...) sdk.Result
- func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
- func NewHandler(k Keeper, contractCaller helper.IContractCaller) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- type AppModule
- func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
- func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (AppModule) Name() string
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (AppModule) QuerierRoute() string
- func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
- func (AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- func (AppModuleBasic) VerifyGenesis(bz map[string]json.RawMessage) error
- type Keeper
- func (k *Keeper) AddDividendAccount(ctx sdk.Context, dividendAccount hmTypes.DividendAccount) error
- func (k *Keeper) AddFeeToDividendAccount(ctx sdk.Context, valID hmTypes.ValidatorID, fee *big.Int) sdk.Error
- func (k *Keeper) AddValidator(ctx sdk.Context, validator hmTypes.Validator) error
- func (k *Keeper) CheckIfDividendAccountExists(ctx sdk.Context, dividendID hmTypes.DividendAccountID) (ok bool)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k *Keeper) GetActiveValidatorInfo(ctx sdk.Context, address []byte) (validator hmTypes.Validator, err error)
- func (k *Keeper) GetAllDividendAccounts(ctx sdk.Context) (dividendAccounts []hmTypes.DividendAccount)
- func (k *Keeper) GetAllValidators(ctx sdk.Context) (validators []*hmTypes.Validator)
- func (k *Keeper) GetCurrentProposer(ctx sdk.Context) *hmTypes.Validator
- func (k *Keeper) GetCurrentValidators(ctx sdk.Context) (validators []hmTypes.Validator)
- func (k *Keeper) GetDividendAccountByID(ctx sdk.Context, dividendID hmTypes.DividendAccountID) (dividendAccount hmTypes.DividendAccount, err error)
- func (k *Keeper) GetLastUpdated(ctx sdk.Context, valID hmTypes.ValidatorID) (updatedAt string, found bool)
- func (k *Keeper) GetNextProposer(ctx sdk.Context) *hmTypes.Validator
- func (k *Keeper) GetSignerFromValidatorID(ctx sdk.Context, valID hmTypes.ValidatorID) (common.Address, bool)
- func (k *Keeper) GetSpanEligibleValidators(ctx sdk.Context) (validators []hmTypes.Validator)
- func (k *Keeper) GetStakingSequences(ctx sdk.Context) (sequences []string)
- func (k *Keeper) GetValidatorFromValID(ctx sdk.Context, valID hmTypes.ValidatorID) (validator hmTypes.Validator, ok bool)
- func (k *Keeper) GetValidatorInfo(ctx sdk.Context, address []byte) (validator hmTypes.Validator, err error)
- func (k *Keeper) GetValidatorSet(ctx sdk.Context) (validatorSet hmTypes.ValidatorSet)
- func (k *Keeper) HasStakingSequence(ctx sdk.Context, sequence string) bool
- func (k *Keeper) IncrementAccum(ctx sdk.Context, times int)
- func (k *Keeper) IsCurrentValidatorByAddress(ctx sdk.Context, address []byte) bool
- func (k *Keeper) IterateCurrentValidatorsAndApplyFn(ctx sdk.Context, f func(validator *hmTypes.Validator) bool)
- func (k *Keeper) IterateDividendAccountsByPrefixAndApplyFn(ctx sdk.Context, prefix []byte, ...)
- func (k *Keeper) IterateStakingSequencesAndApplyFn(ctx sdk.Context, f func(sequence string) error)
- func (k *Keeper) IterateValidatorsAndApplyFn(ctx sdk.Context, f func(validator hmTypes.Validator) error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k *Keeper) SetStakingSequence(ctx sdk.Context, sequence string)
- func (k *Keeper) SetValidatorIDToSignerAddr(ctx sdk.Context, valID hmTypes.ValidatorID, signerAddr hmTypes.HeimdallAddress)
- func (k *Keeper) UpdateSigner(ctx sdk.Context, newSigner hmTypes.HeimdallAddress, newPubkey hmTypes.PubKey, ...) error
- func (k *Keeper) UpdateValidatorSetInStore(ctx sdk.Context, newValidatorSet hmTypes.ValidatorSet) error
- type ModuleCommunicator
Constants ¶
This section is empty.
Variables ¶
var ( DefaultValue = []byte{0x01} // Value to store in CacheCheckpoint and CacheCheckpointACK & ValidatorSetChange Flag ValidatorsKey = []byte{0x21} // prefix for each key to a validator ValidatorMapKey = []byte{0x22} // prefix for each key for validator map CurrentValidatorSetKey = []byte{0x23} // Key to store current validator set PrevDividendAccountMapKey = []byte{0x41} // store for dividend accounts before checkpoint ack. DividendAccountMapKey = []byte{0x42} // prefix for each key for Dividend Account Map StakingSequenceKey = []byte{0x24} // prefix for each key for staking sequence map )
Functions ¶
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState
ExportGenesis returns a GenesisState for a given context and keeper.
func GetDividendAccountMapKey ¶
GetDividendAccountMapKey returns dividend account map
func GetPrevDividendAccountMapKey ¶
GetPrevDividendAccountMapKey returns prev dividend account map
func GetStakingSequenceKey ¶
GetStakingSequenceKey returns staking sequence key
func GetValidatorKey ¶
GetValidatorKey drafts the validator key for addresses
func GetValidatorMapKey ¶
GetValidatorMapKey returns validator map
func HandleMsgSignerUpdate ¶
func HandleMsgSignerUpdate(ctx sdk.Context, msg types.MsgSignerUpdate, k Keeper, contractCaller helper.IContractCaller) sdk.Result
HandleMsgSignerUpdate handles signer update message
func HandleMsgStakeUpdate ¶
func HandleMsgStakeUpdate(ctx sdk.Context, msg types.MsgStakeUpdate, k Keeper, contractCaller helper.IContractCaller) sdk.Result
HandleMsgStakeUpdate handles stake update message
func HandleMsgValidatorExit ¶
func HandleMsgValidatorExit(ctx sdk.Context, msg types.MsgValidatorExit, k Keeper, contractCaller helper.IContractCaller) sdk.Result
HandleMsgValidatorExit handle msg validator exit
func HandleMsgValidatorJoin ¶
func HandleMsgValidatorJoin(ctx sdk.Context, msg types.MsgValidatorJoin, k Keeper, contractCaller helper.IContractCaller) sdk.Result
HandleMsgValidatorJoin msg validator join
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
InitGenesis sets distribution information for genesis.
func NewHandler ¶
func NewHandler(k Keeper, contractCaller helper.IContractCaller) sdk.Handler
NewHandler new handler
func NewQuerier ¶
NewQuerier returns querier for staking Rest endpoints
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule implements an application module for the supply module.
func NewAppModule ¶
func NewAppModule(keeper Keeper, contractCaller helper.IContractCaller) AppModule
NewAppModule creates a new AppModule object
func (AppModule) BeginBlock ¶
func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
BeginBlock returns the begin blocker for the auth module.
func (AppModule) EndBlock ¶
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock returns the end blocker for the auth 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 auth module.
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis performs genesis initialization for the auth module. It returns no validator updates.
func (AppModule) NewHandler ¶
NewHandler returns an sdk.Handler for the module.
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler returns the auth module sdk.Querier.
func (AppModule) QuerierRoute ¶
QuerierRoute returns the staking module's querier route name.
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
RegisterInvariants performs a no-op.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the basic application module used by the auth module.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis returns default genesis state as raw bytes for the auth module.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd returns the root query command for the auth module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
GetTxCmd returns the root tx command for the auth module.
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name returns the auth module's name.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the auth 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 auth module.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis performs genesis state validation for the auth module.
func (AppModuleBasic) VerifyGenesis ¶
func (AppModuleBasic) VerifyGenesis(bz map[string]json.RawMessage) error
VerifyGenesis performs verification on auth module state.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper stores all related data
func NewKeeper ¶
func NewKeeper( cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace subspace.Subspace, codespace sdk.CodespaceType, moduleCommunicator ModuleCommunicator, ) Keeper
NewKeeper create new keeper
func (*Keeper) AddDividendAccount ¶
AddDividendAccount adds DividendAccount index with DividendID
func (*Keeper) AddFeeToDividendAccount ¶
func (k *Keeper) AddFeeToDividendAccount(ctx sdk.Context, valID hmTypes.ValidatorID, fee *big.Int) sdk.Error
AddFeeToDividendAccount adds fee to dividend account for withdrawal
func (*Keeper) AddValidator ¶
AddValidator adds validator indexed with address
func (*Keeper) CheckIfDividendAccountExists ¶
func (k *Keeper) CheckIfDividendAccountExists(ctx sdk.Context, dividendID hmTypes.DividendAccountID) (ok bool)
CheckIfDividendAccountExists will return true if dividend account exists
func (Keeper) Codespace ¶
func (k Keeper) Codespace() sdk.CodespaceType
Codespace returns the codespace
func (*Keeper) GetActiveValidatorInfo ¶
func (k *Keeper) GetActiveValidatorInfo(ctx sdk.Context, address []byte) (validator hmTypes.Validator, err error)
GetActiveValidatorInfo returns active validator
func (*Keeper) GetAllDividendAccounts ¶
func (k *Keeper) GetAllDividendAccounts(ctx sdk.Context) (dividendAccounts []hmTypes.DividendAccount)
GetAllDividendAccounts returns all DividendAccountss
func (*Keeper) GetAllValidators ¶
GetAllValidators returns all validators
func (*Keeper) GetCurrentProposer ¶
GetCurrentProposer returns current proposer
func (*Keeper) GetCurrentValidators ¶
GetCurrentValidators returns all validators who are in validator set
func (*Keeper) GetDividendAccountByID ¶
func (k *Keeper) GetDividendAccountByID(ctx sdk.Context, dividendID hmTypes.DividendAccountID) (dividendAccount hmTypes.DividendAccount, err error)
GetDividendAccountByID will return DividendAccount of valID
func (*Keeper) GetLastUpdated ¶
func (k *Keeper) GetLastUpdated(ctx sdk.Context, valID hmTypes.ValidatorID) (updatedAt string, found bool)
GetLastUpdated get last updated at for validator
func (*Keeper) GetNextProposer ¶
GetNextProposer returns next proposer
func (*Keeper) GetSignerFromValidatorID ¶
func (k *Keeper) GetSignerFromValidatorID(ctx sdk.Context, valID hmTypes.ValidatorID) (common.Address, bool)
GetSignerFromValidatorID get signer address from validator ID
func (*Keeper) GetSpanEligibleValidators ¶
GetSpanEligibleValidators returns current validators who are not getting deactivated in between next span
func (*Keeper) GetStakingSequences ¶
GetStakingSequences checks if Staking already exists
func (*Keeper) GetValidatorFromValID ¶
func (k *Keeper) GetValidatorFromValID(ctx sdk.Context, valID hmTypes.ValidatorID) (validator hmTypes.Validator, ok bool)
GetValidatorFromValID returns signer from validator ID
func (*Keeper) GetValidatorInfo ¶
func (k *Keeper) GetValidatorInfo(ctx sdk.Context, address []byte) (validator hmTypes.Validator, err error)
GetValidatorInfo returns validator
func (*Keeper) GetValidatorSet ¶
func (k *Keeper) GetValidatorSet(ctx sdk.Context) (validatorSet hmTypes.ValidatorSet)
GetValidatorSet returns current Validator Set from store
func (*Keeper) HasStakingSequence ¶
HasStakingSequence checks if staking sequence already exists
func (*Keeper) IncrementAccum ¶
IncrementAccum increments accum for validator set by n times and replace validator set in store
func (*Keeper) IsCurrentValidatorByAddress ¶
IsCurrentValidatorByAddress check if validator is in current validator set by signer address
func (*Keeper) IterateCurrentValidatorsAndApplyFn ¶
func (k *Keeper) IterateCurrentValidatorsAndApplyFn(ctx sdk.Context, f func(validator *hmTypes.Validator) bool)
IterateCurrentValidatorsAndApplyFn iterate through current validators
func (*Keeper) IterateDividendAccountsByPrefixAndApplyFn ¶
func (k *Keeper) IterateDividendAccountsByPrefixAndApplyFn(ctx sdk.Context, prefix []byte, f func(dividendAccount hmTypes.DividendAccount) error)
IterateDividendAccountsByPrefixAndApplyFn iterate dividendAccounts and apply the given function.
func (*Keeper) IterateStakingSequencesAndApplyFn ¶
IterateStakingSequencesAndApplyFn interate validators and apply the given function.
func (*Keeper) IterateValidatorsAndApplyFn ¶
func (k *Keeper) IterateValidatorsAndApplyFn(ctx sdk.Context, f func(validator hmTypes.Validator) error)
IterateValidatorsAndApplyFn interate validators and apply the given function.
func (*Keeper) SetStakingSequence ¶
SetStakingSequence sets staking sequence
func (*Keeper) SetValidatorIDToSignerAddr ¶
func (k *Keeper) SetValidatorIDToSignerAddr(ctx sdk.Context, valID hmTypes.ValidatorID, signerAddr hmTypes.HeimdallAddress)
SetValidatorIDToSignerAddr sets mapping for validator ID to signer address
func (*Keeper) UpdateSigner ¶
func (k *Keeper) UpdateSigner(ctx sdk.Context, newSigner hmTypes.HeimdallAddress, newPubkey hmTypes.PubKey, prevSigner hmTypes.HeimdallAddress) error
UpdateSigner updates validator with signer and pubkey + validator => signer map
func (*Keeper) UpdateValidatorSetInStore ¶
func (k *Keeper) UpdateValidatorSetInStore(ctx sdk.Context, newValidatorSet hmTypes.ValidatorSet) error
UpdateValidatorSetInStore adds validator set to store
type ModuleCommunicator ¶
type ModuleCommunicator interface { GetACKCount(ctx sdk.Context) uint64 SetCoins(ctx sdk.Context, addr hmTypes.HeimdallAddress, amt hmTypes.Coins) sdk.Error GetCoins(ctx sdk.Context, addr hmTypes.HeimdallAddress) hmTypes.Coins SendCoins(ctx sdk.Context, from hmTypes.HeimdallAddress, to hmTypes.HeimdallAddress, amt hmTypes.Coins) sdk.Error }
ModuleCommunicator manages different module interaction