Documentation
¶
Index ¶
- Constants
- Variables
- func GetCandidateKey(candidateAddr string) []byte
- func GetDelegatorKey(candidateAddr, delegatorAddr string) []byte
- func GetDelegatorsKey(candidateAddr string) []byte
- func GetRewardKey(ethAddr string) []byte
- func RegisterCodec(cdc *codec.Codec)
- type Candidate
- type Delegator
- type MsgSetTransactors
- type MsgSignReward
- type MsgWithdrawReward
- type Params
- type Puller
- type Pusher
- type QueryCandidateParams
- type QueryDelegatorParams
- type QueryRewardParams
- type Reward
- type RewardType
Constants ¶
const ( // module name ModuleName = "validator" // StoreKey to be used when creating the KVStore StoreKey = ModuleName AttributeKeyEthAddress = "eth_address" ActionInitiateWithdraw = "initate_withdraw" )
const ( TypeMsgSetTransactors = "set_transactors" TypeMsgWithdrawReward = "withdraw_reward" TypeMsgSignReward = "sign_reward" )
const ( DefaultPullerDuration uint = 10 DefaultPusherDuration uint = 10 )
validator params default values
const ( QueryPuller = "puller" QueryPusher = "pusher" QueryDelegator = "delegator" QueryCandidate = "candidate" QueryReward = "reward" )
const ( ServiceReward = iota MiningReward )
const RouterKey = ModuleName // this was defined in your key.go file
Variables ¶
var ( PullerKey = []byte{0x01} // key for puller PusherKey = []byte{0x02} // key for pusher DelegatorKeyPrefix = []byte{0x03} // Key prefix for delegator CandidateKeyPrefix = []byte{0x04} // Key prefix for candidate RewardKeyPrefix = []byte{0x05} // Key prefix for reward )
var ( DefaultMiningReward = sdk.NewInt(10000000000000) DefaultPullerReward = sdk.NewInt(500000000000) )
var ( KeyPullerDuration = []byte("PullerDuration") KeyPusherDuration = []byte("PusherDuration") KeyMiningReward = []byte("MiningReward") KeyPullerReward = []byte("PullerReward") )
nolint - Keys for parameter access
var ModuleCdc = codec.New()
Functions ¶
func GetCandidateKey ¶
get candidate key from candidateAddr
func GetDelegatorKey ¶
get delegator key from candidate address and delegator address
func GetDelegatorsKey ¶
get delegators key from candidate address
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
Types ¶
type Candidate ¶
type Candidate struct {
EthAddress string `json:"ethAddress"`
Operator sdk.AccAddress `json:"operator"`
Transactors []sdk.AccAddress `json:"transactors"`
Delegators []Delegator `json:"delegators"`
StakingPool sdk.Int `json:"stakingPool"`
CommissionRate sdk.Dec `json:"commissionRate"`
RequestCount sdk.Int `json:"requestCount"`
}
operator will be used for running validator node, and transactor will be used for running gateway
func NewCandidate ¶
func NewCandidate(ethAddress string, operator sdk.AccAddress) Candidate
type Delegator ¶
type Delegator struct {
CandidateAddr string `json:"candidateAddr"`
DelegatorAddr string `json:"delegatorAddr"`
DelegatedStake sdk.Int `json:"delegatedStake"`
}
func NewDelegator ¶
type MsgSetTransactors ¶ added in v0.2.0
type MsgSetTransactors struct {
EthAddress string `json:"ethAddress"`
Transactors []sdk.AccAddress `json:"transactors"`
Sender sdk.AccAddress `json:"sender"`
}
func NewMsgSetTransactors ¶ added in v0.2.0
func NewMsgSetTransactors(ethAddress string, transactors []sdk.AccAddress, sender sdk.AccAddress) MsgSetTransactors
NewMsgSetTransactors is a constructor function for MsgSetTransactors
func (MsgSetTransactors) GetSignBytes ¶ added in v0.2.0
func (msg MsgSetTransactors) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgSetTransactors) GetSigners ¶ added in v0.2.0
func (msg MsgSetTransactors) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgSetTransactors) Route ¶ added in v0.2.0
func (msg MsgSetTransactors) Route() string
Route should return the name of the module
func (MsgSetTransactors) Type ¶ added in v0.2.0
func (msg MsgSetTransactors) Type() string
Type should return the action
func (MsgSetTransactors) ValidateBasic ¶ added in v0.2.0
func (msg MsgSetTransactors) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgSignReward ¶
type MsgSignReward struct {
EthAddress string `json:"ethAddress"`
Sig []byte `json:"sig"`
Sender sdk.AccAddress `json:"sender"`
}
MsgSignReward defines a SyncValidator message
func NewMsgSignReward ¶
func NewMsgSignReward(ethAddress string, sig []byte, sender sdk.AccAddress) MsgSignReward
func (MsgSignReward) GetSignBytes ¶
func (msg MsgSignReward) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgSignReward) GetSigners ¶
func (msg MsgSignReward) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgSignReward) Route ¶
func (msg MsgSignReward) Route() string
Route should return the name of the module
func (MsgSignReward) ValidateBasic ¶
func (msg MsgSignReward) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgWithdrawReward ¶
type MsgWithdrawReward struct {
EthAddress string `json:"ethAddress"`
Sender sdk.AccAddress `json:"sender"`
}
MsgWithdrawReward defines a SyncValidator message
func NewMsgWithdrawReward ¶
func NewMsgWithdrawReward(ethAddress string, sender sdk.AccAddress) MsgWithdrawReward
func (MsgWithdrawReward) GetSignBytes ¶
func (msg MsgWithdrawReward) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgWithdrawReward) GetSigners ¶
func (msg MsgWithdrawReward) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgWithdrawReward) Route ¶
func (msg MsgWithdrawReward) Route() string
Route should return the name of the module
func (MsgWithdrawReward) Type ¶
func (msg MsgWithdrawReward) Type() string
Type should return the action
func (MsgWithdrawReward) ValidateBasic ¶
func (msg MsgWithdrawReward) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Params ¶
type Params struct {
PullerDuration uint `json:"puller_duration" yaml:"puller_duration"`
PusherDuration uint `json:"pusher_duration" yaml:"pusher_duration"`
MiningReward sdk.Int `json:"mining_reward" yaml:"mining_reward"`
PullerReward sdk.Int `json:"puller_reward" yaml:"puller_reward"`
}
func MustUnmarshalParams ¶
unmarshal the current validator params value from store key or panic
func UnmarshalParams ¶
unmarshal the current validator params value from store key
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
Implements params.ParamSet
type Puller ¶
type Puller struct {
ValidatorIdx uint `json:"validatorIdx"`
ValidatorAddr sdk.AccAddress `json:"validatorAddr"`
}
type Pusher ¶
type Pusher struct {
ValidatorIdx uint `json:"validatorIdx"`
ValidatorAddr sdk.AccAddress `json:"validatorAddr"`
}
type QueryCandidateParams ¶
type QueryCandidateParams struct {
CandidateAddress string
}
func NewQueryCandidateParams ¶
func NewQueryCandidateParams(candidateAddress string) QueryCandidateParams
type QueryDelegatorParams ¶
func NewQueryDelegatorParams ¶
func NewQueryDelegatorParams(candidateAddress, delegatorAddress string) QueryDelegatorParams
type QueryRewardParams ¶
type QueryRewardParams struct {
EthAddress string
}
func NewQueryRewardParams ¶
func NewQueryRewardParams(ethAddress string) QueryRewardParams
type Reward ¶
type Reward struct {
Receiver string `json:"receiver"`
MiningReward sdk.Int `json:"miningReward"`
ServiceReward sdk.Int `json:"serviceReward"`
RewardProtoBytes []byte `json:"rewardProtoBytes"` // proto msg for reward snapshot from latest intendWithdraw
Sigs []common.Sig `json:"sigs"`
}
func (Reward) GetRewardRequest ¶
Generate rewardRequest msg
type RewardType ¶ added in v0.2.0
type RewardType int