Documentation ¶
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, keeper Keeper) (updates []abci.ValidatorUpdate)
- func GetCandidateInfoFromMainchain(ctx sdk.Context, keeper Keeper, ethAddress string) (mainchain.CandidateInfo, error)
- func InitAccount(ctx sdk.Context, keeper Keeper, accAddress sdk.AccAddress)
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func ValidateGenesis(data GenesisState) error
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)
- func (am AppModule) EndBlock(ctx sdk.Context, req 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 (am AppModule) QuerierRoute() string
- func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
- func (am 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
- type Candidate
- type Delegator
- type GenesisState
- type Keeper
- func (k Keeper) DistributeReward(ctx sdk.Context, totalReward sdk.Int, rewardType RewardType)
- func (k Keeper) GetAllCandidates(ctx sdk.Context) (candidates []Candidate)
- func (k Keeper) GetAllDelegators(ctx sdk.Context, candidateAddress string) (delegators []Delegator)
- func (k Keeper) GetCandidate(ctx sdk.Context, candidateAddress string) (candidate Candidate, found bool)
- func (k Keeper) GetDelegator(ctx sdk.Context, candidateAddress, delegatorAddress string) Delegator
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPuller(ctx sdk.Context) Puller
- func (k Keeper) GetPusher(ctx sdk.Context) Pusher
- func (k Keeper) GetReward(ctx sdk.Context, ethAddress string) (Reward, bool)
- func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (staking.Validator, bool)
- func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) (staking.Validator, bool)
- func (k Keeper) GetValidatorCandidates(ctx sdk.Context) (candidates []Candidate)
- func (k Keeper) GetValidators(ctx sdk.Context) []staking.Validator
- func (k Keeper) MiningReward(ctx sdk.Context) (res sdk.Int)
- func (k Keeper) PullerDuration(ctx sdk.Context) (res uint)
- func (k Keeper) PusherDuration(ctx sdk.Context) (res uint)
- func (k Keeper) SetCandidate(ctx sdk.Context, candidateAddr string, candidate Candidate)
- func (k Keeper) SetDelegator(ctx sdk.Context, candidateAddress, delegatorAddress string, ...)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPuller(ctx sdk.Context, puller Puller)
- func (k Keeper) SetPusher(ctx sdk.Context, pusher Pusher)
- func (k Keeper) SetReward(ctx sdk.Context, reward Reward)
- func (k Keeper) SnapshotCandidate(ctx sdk.Context, candidateAddr string)
- type MsgClaimValidator
- type MsgInitializeCandidate
- type MsgSignReward
- type MsgSyncDelegator
- type MsgSyncValidator
- type MsgWithdrawReward
- type Params
- type Puller
- type Pusher
- type QueryCandidateParams
- type QueryDelegatorParams
- type QueryRewardParams
- type Reward
- type RewardType
Constants ¶
const ( ModuleName = types.ModuleName RouterKey = types.RouterKey StoreKey = types.StoreKey QueryPuller = types.QueryPuller QueryPusher = types.QueryPusher QueryDelegator = types.QueryDelegator QueryCandidate = types.QueryCandidate QueryReward = types.QueryReward TypeMsgWithdrawReward = types.TypeMsgWithdrawReward AttributeKeyEthAddress = types.AttributeKeyEthAddress ActionInitiateWithdraw = types.ActionInitiateWithdraw )
const ( ServiceReward = iota MiningReward )
const (
DefaultParamspace = types.ModuleName
)
Default parameter namespace
Variables ¶
var ( NewMsgInitializeCandidate = types.NewMsgInitializeCandidate NewMsgClaimValidator = types.NewMsgClaimValidator NewMsgSyncValidator = types.NewMsgSyncValidator NewMsgSyncDelegator = types.NewMsgSyncDelegator NewMsgWithdrawReward = types.NewMsgWithdrawReward NewMsgSignReward = types.NewMsgSignReward NewQueryRewardParams = types.NewQueryRewardParams ModuleCdc = types.ModuleCdc RegisterCodec = types.RegisterCodec PullerKey = types.PullerKey PusherKey = types.PusherKey CandidateKeyPrefix = types.CandidateKeyPrefix GetDelegatorKey = types.GetDelegatorKey GetDelegatorsKey = types.GetDelegatorsKey GetCandidateKey = types.GetCandidateKey GetRewardKey = types.GetRewardKey NewPuller = types.NewPuller NewPusher = types.NewPusher NewDelegator = types.NewDelegator NewCandidate = types.NewCandidate NewReward = types.NewReward CLIQueryPuller = cli.QueryPuller CLIQueryPusher = cli.QueryPusher CLIQueryCandidate = cli.QueryCandidate CLIQueryReward = cli.QueryReward CLIQueryDelegator = cli.QueryDelegator CLIQueryValidator = cli.QueryValidator CLIQueryValidators = cli.QueryValidators CLIQueryBondedValidators = cli.QueryBondedValidators DefaultParams = types.DefaultParams )
var PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(9), nil))
1 Gwei (10^9), mainchain token amount will be divided by this number in sidechain. This is to address the Tendermint limitation on the voting power max value. It also indicates that mainchain token staking should be a the unit of gwei.
Functions ¶
func EndBlocker ¶
func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, keeper Keeper) (updates []abci.ValidatorUpdate)
EndBlocker called every block, process inflation, update validator set.
func InitAccount ¶
func InitAccount(ctx sdk.Context, keeper Keeper, accAddress sdk.AccAddress)
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate
func NewHandler ¶
NewHandler returns a handler for "validator" type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
func NewAppModule ¶
NewAppModule creates a new AppModule Object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
func (AppModule) NewHandler ¶
func (AppModule) NewQuerierHandler ¶
func (AppModule) QuerierRoute ¶
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
type AppModuleBasic ¶
type AppModuleBasic struct{}
app module Basics object
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
Get the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
Get the root tx command of this module
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
Register rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
Validation check of the Genesis
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
}
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec, ethClient *mainchain.EthClient, globalKeeper global.Keeper, accountKeeper auth.AccountKeeper, stakingKeeper staking.Keeper, paramstore params.Subspace) Keeper
NewKeeper creates new instances of the validator Keeper
func (Keeper) DistributeReward ¶
DistributeServiceReward distributes rewards to candidates and their delegators
func (Keeper) GetAllCandidates ¶
Get the set of all candidates with no limits
func (Keeper) GetAllDelegators ¶
Get the set of all delegators with no limits
func (Keeper) GetCandidate ¶
func (k Keeper) GetCandidate(ctx sdk.Context, candidateAddress string) (candidate Candidate, found bool)
Get the entire Candidate metadata
func (Keeper) GetDelegator ¶
Get the entire Delegator metadata for a candidateAddress and delegatorAddress
func (Keeper) GetValidator ¶
Get a validator by validator account address
func (Keeper) GetValidatorByConsAddr ¶
func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) (staking.Validator, bool)
Get a validator by consencus address
func (Keeper) GetValidatorCandidates ¶
GetValidatorCandidates get candidates info for current validators
func (Keeper) GetValidators ¶
Get validators metadata
func (Keeper) MiningReward ¶
MiningReward - mining reward
func (Keeper) PullerDuration ¶
PullerDuration - puller duration
func (Keeper) PusherDuration ¶
PusherDuration - pusher duration
func (Keeper) SetCandidate ¶
Sets the Candidate metadata
func (Keeper) SetDelegator ¶
func (k Keeper) SetDelegator(ctx sdk.Context, candidateAddress, delegatorAddress string, delegator Delegator)
Sets the entire Delegator metadata for a candidateAddress and delegatorAddress
type MsgClaimValidator ¶
type MsgClaimValidator = types.MsgClaimValidator
type MsgInitializeCandidate ¶
type MsgInitializeCandidate = types.MsgInitializeCandidate
type MsgSignReward ¶
type MsgSignReward = types.MsgSignReward
type MsgSyncDelegator ¶
type MsgSyncDelegator = types.MsgSyncDelegator
type MsgSyncValidator ¶
type MsgSyncValidator = types.MsgSyncValidator
type MsgWithdrawReward ¶
type MsgWithdrawReward = types.MsgWithdrawReward
type QueryCandidateParams ¶
type QueryCandidateParams = types.QueryCandidateParams
type QueryDelegatorParams ¶
type QueryDelegatorParams = types.QueryDelegatorParams
type QueryRewardParams ¶
type QueryRewardParams = types.QueryRewardParams
type RewardType ¶
type RewardType int