types

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// module name
	ModuleName = "validator"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	AttributeKeyEthAddress = "eth_address"

	ActionInitiateWithdraw = "initate_withdraw"
)
View Source
const (
	TypeMsgInitializeCandidate = "initialize_candidate"
	TypeMsgClaimValidator      = "claim_validator"
	TypeMsgSyncValidator       = "sync_validator"
	TypeMsgSyncDelegator       = "sync_delegator"
	TypeMsgWithdrawReward      = "withdraw_reward"
	TypeMsgSignReward          = "sign_reward"
)
View Source
const (
	DefaultPullerDuration uint = 10
	DefaultPusherDuration uint = 10
)

validator params default values

View Source
const (
	QueryPuller    = "puller"
	QueryPusher    = "pusher"
	QueryDelegator = "delegator"
	QueryCandidate = "candidate"
	QueryReward    = "reward"
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file

Variables

View Source
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
)
View Source
var (
	KeyPullerDuration = []byte("PullerDuration")
	KeyPusherDuration = []byte("PusherDuration")
	KeyMiningReward   = []byte("MiningReward")
)

nolint - Keys for parameter access

View Source
var (
	DefaultMiningReward = sdk.NewInt(10000000000000)
)
View Source
var ModuleCdc = codec.New()

Functions

func GetCandidateKey

func GetCandidateKey(candidateAddr string) []byte

get candidate key from candidateAddr

func GetDelegatorKey

func GetDelegatorKey(candidateAddr, delegatorAddr string) []byte

get delegator key from candidate address and delegator address

func GetDelegatorsKey

func GetDelegatorsKey(candidateAddr string) []byte

get delegators key from candidate address

func GetRewardKey

func GetRewardKey(ethAddr string) []byte

get reward key from ethAddr

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type Candidate

type Candidate struct {
	Operator    sdk.AccAddress   `json:"operator"`
	Transactors []sdk.AccAddress `json:"transactors"`
	StakingPool sdk.Int          `json:"stakingPool"`
	Delegators  []Delegator      `json:"delegators"`
}

operator will be used for running validator node, and transactor will be used for running gateway

func NewCandidate

func NewCandidate(operator sdk.AccAddress) Candidate

func (Candidate) String

func (c Candidate) String() string

implement fmt.Stringer

type Delegator

type Delegator struct {
	EthAddress     string  `json:"ethAddress"`
	DelegatedStake sdk.Int `json:"delegatedStake"`
}

func NewDelegator

func NewDelegator(ethAddress string) Delegator

func (Delegator) String

func (c Delegator) String() string

implement fmt.Stringer

type MsgClaimValidator

type MsgClaimValidator struct {
	EthAddress  string           `json:"ethAddress"`
	PubKey      string           `json:"pubkey"`
	Transactors []sdk.AccAddress `json:"transactors"`
	Sender      sdk.AccAddress   `json:"sender"`
}

MsgClaimValidator defines a ClaimValidator message

func NewMsgClaimValidator

func NewMsgClaimValidator(ethAddress string, pubkey string, transactors []sdk.AccAddress, sender sdk.AccAddress) MsgClaimValidator

NewMsgClaimValidator is a constructor function for MsgClaimValidator

func (MsgClaimValidator) GetSignBytes

func (msg MsgClaimValidator) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgClaimValidator) GetSigners

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

GetSigners defines whose signature is required

func (MsgClaimValidator) Route

func (msg MsgClaimValidator) Route() string

Route should return the name of the module

func (MsgClaimValidator) Type

func (msg MsgClaimValidator) Type() string

Type should return the action

func (MsgClaimValidator) ValidateBasic

func (msg MsgClaimValidator) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgInitializeCandidate

type MsgInitializeCandidate struct {
	EthAddress string         `json:"ethAddress"`
	Sender     sdk.AccAddress `json:"sender"`
}

MsgInitializeCandidate defines a InitializeCandidate message

func NewMsgInitializeCandidate

func NewMsgInitializeCandidate(ethAddress string, sender sdk.AccAddress) MsgInitializeCandidate

NewMsgInitializeCandidate is a constructor function for MsgInitializeCandidate

func (MsgInitializeCandidate) GetSignBytes

func (msg MsgInitializeCandidate) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgInitializeCandidate) GetSigners

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

GetSigners defines whose signature is required

func (MsgInitializeCandidate) Route

func (msg MsgInitializeCandidate) Route() string

Route should return the name of the module

func (MsgInitializeCandidate) Type

func (msg MsgInitializeCandidate) Type() string

Type should return the action

func (MsgInitializeCandidate) ValidateBasic

func (msg MsgInitializeCandidate) ValidateBasic() sdk.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) Type

func (msg MsgSignReward) Type() string

Type should return the action

func (MsgSignReward) ValidateBasic

func (msg MsgSignReward) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgSyncDelegator

type MsgSyncDelegator struct {
	CandidateAddress string         `json:"candidateAddress"` // ETH address with "0x" prefix
	DelegatorAddress string         `json:"delegatorAddress"` // ETH address with "0x" prefix
	Sender           sdk.AccAddress `json:"sender"`
}

MsgSyncDelegator defines a SyncDelegator message

func NewMsgSyncDelegator

func NewMsgSyncDelegator(candidateAddress, delegatorAddress string, sender sdk.AccAddress) MsgSyncDelegator

NewMsgSyncDelegator is a constructor function for MsgSyncDelegator

func (MsgSyncDelegator) GetSignBytes

func (msg MsgSyncDelegator) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSyncDelegator) GetSigners

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

GetSigners defines whose signature is required

func (MsgSyncDelegator) Route

func (msg MsgSyncDelegator) Route() string

Route should return the name of the module

func (MsgSyncDelegator) Type

func (msg MsgSyncDelegator) Type() string

Type should return the action

func (MsgSyncDelegator) ValidateBasic

func (msg MsgSyncDelegator) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgSyncValidator

type MsgSyncValidator struct {
	EthAddress string         `json:"ethAddress"`
	Sender     sdk.AccAddress `json:"sender"`
}

MsgSyncValidator defines a SyncValidator message

func NewMsgSyncValidator

func NewMsgSyncValidator(ethAddress string, sender sdk.AccAddress) MsgSyncValidator

NewMsgSyncValidator is a constructor function for MsgSyncValidator

func (MsgSyncValidator) GetSignBytes

func (msg MsgSyncValidator) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSyncValidator) GetSigners

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

GetSigners defines whose signature is required

func (MsgSyncValidator) Route

func (msg MsgSyncValidator) Route() string

Route should return the name of the module

func (MsgSyncValidator) Type

func (msg MsgSyncValidator) Type() string

Type should return the action

func (MsgSyncValidator) ValidateBasic

func (msg MsgSyncValidator) ValidateBasic() sdk.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() sdk.Error

ValidateBasic runs stateless checks on the message

type Params

type Params struct {
	PullerDuration uint    `json:"pullerDuration" yaml:"pullerDuration"`
	PusherDuration uint    `json:"pusherDuration" yaml:"pusherDuration"`
	MiningReward   sdk.Int `json:"miningReward" yaml:"miningReward"`
}

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current validator params value from store key or panic

func NewParams

func NewParams(pullerDuration uint, pusherDuration uint, miningReward sdk.Int) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current validator params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type Puller

type Puller struct {
	ValidatorIdx  uint           `json:"validatorIdx"`
	ValidatorAddr sdk.AccAddress `json:"validatorAddr"`
}

func NewPuller

func NewPuller(validatorIdx uint, validatorAddr sdk.AccAddress) Puller

func (Puller) String

func (r Puller) String() string

implement fmt.Stringer

type Pusher

type Pusher struct {
	ValidatorIdx  uint           `json:"validatorIdx"`
	ValidatorAddr sdk.AccAddress `json:"validatorAddr"`
}

func NewPusher

func NewPusher(validatorIdx uint, validatorAddr sdk.AccAddress) Pusher

func (Pusher) String

func (r Pusher) String() string

implement fmt.Stringer

type QueryCandidateParams

type QueryCandidateParams struct {
	CandidateAddress string
}

func NewQueryCandidateParams

func NewQueryCandidateParams(candidateAddress string) QueryCandidateParams

type QueryDelegatorParams

type QueryDelegatorParams struct {
	CandidateAddress string
	DelegatorAddress string
}

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 NewReward

func NewReward(receiver string) Reward

func (*Reward) AddSig

func (r *Reward) AddSig(sig []byte, expectedSigner string) error

Add signature to reward sigs

func (Reward) GetRewardRequest

func (r Reward) GetRewardRequest() []byte

Generate rewardRequest msg

func (Reward) HasNewReward

func (r Reward) HasNewReward() bool

Check if have new reward added

func (*Reward) InitateWithdraw

func (r *Reward) InitateWithdraw()

Initiate the withdraw process

func (Reward) String

func (r Reward) String() string

implement fmt.Stringer

Jump to

Keyboard shortcuts

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