types

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Described types for PoA module.

Describing errors and codes.

Parameters store for PoA module.

Types for querier.

Index

Constants

View Source
const (
	ModuleName                          = "poa"
	RouterKey                           = ModuleName
	DefaultCodespace  sdk.CodespaceType = ModuleName
	DefaultParamspace                   = ModuleName
)
View Source
const (
	CodeValidatorExists      sdk.CodeType = 101
	CodeValidatorDoesntExist sdk.CodeType = 102
	CodeMaxValidatorsReached sdk.CodeType = 103
	CodeMinValidatorsReached sdk.CodeType = 104

	CodeWrongEthereumAddress sdk.CodeType = 201

	CodeNotEnoughValidators sdk.CodeType = 301
)
View Source
const (
	DefaultMaxValidators uint16 = 11
	DefaultMinValidators uint16 = 3
)

Default parameters.

Variables

View Source
var (
	ValidatorsCountKey = []byte("validators_count") // Count key in DB to count validators.
	ValidatorsListKey  = []byte("validators")       // Key in DB to store validators.
)
View Source
var (
	KeyMaxValidators = []byte("MaxValidators")
	KeyMinValidators = []byte("MinValidators")
)

Key to store min and max validators parameters.

Functions

func ErrMaxValidatorsReached

func ErrMaxValidatorsReached(max uint16) sdk.Error

Validators maximum limit reached (on genesis init / add validator request)

func ErrMinValidatorsReached

func ErrMinValidatorsReached(min uint16) sdk.Error

Validators minimum limit reached (on genesis init / add validator request)

func ErrNotEnoungValidators

func ErrNotEnoungValidators(actual uint16, min uint16) sdk.Error

Not enough validators to initialize genesis

func ErrValidatorDoesntExists

func ErrValidatorDoesntExists(address string) sdk.Error

Msg.Validator not found

func ErrValidatorExists

func ErrValidatorExists(address string) sdk.Error

Msg.Validator already exists

func ErrWrongEthereumAddress

func ErrWrongEthereumAddress(address string) sdk.Error

Validator's ethereum address is invalid (on validator add / replace)

Types

type GenesisState

type GenesisState struct {
	Parameters    Params     `json:"parameters"`
	PoAValidators Validators `json:"validators"`
}

Genesis state parameters contains genesis data.

type Params

type Params struct {
	MaxValidators uint16 `json:"max_validators"`
	MinValidators uint16 `json:"min_validators"`
}

Describing parameters for PoA module, like: min and max validators amount.

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(maxValidators, minValidators uint16) Params

Create new instance to store parameters.

func (*Params) Equal

func (p *Params) Equal(p2 Params) bool

func (*Params) ParamSetPairs

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

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

type QueryValidator

type QueryValidator struct {
	Address types.AccAddress
}

Request for querier to export validators by address.

type Validator

type Validator struct {
	Address    sdk.AccAddress `json:"address" example:"wallet1a7280dyzp487r7wghr99f6r3h2h2z4gk4d740m"`
	EthAddress string         `json:"eth_address" example:"0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"`
}

Described validator.

func NewValidator

func NewValidator(address sdk.AccAddress, ethAddress string) Validator

Creating new validator instance.

func (Validator) String

func (v Validator) String() string

type Validators

type Validators []Validator

Array of validators.

type ValidatorsConfirmations

type ValidatorsConfirmations struct {
	Validators    Validators `json:"validators"`                // Registered validators list
	Confirmations uint16     `json:"confirmations" example:"3"` // Minimum number of confirmations needed to approve Call
}

Response from querier with confirmations and validators list.

func (ValidatorsConfirmations) String

func (q ValidatorsConfirmations) String() string

Jump to

Keyboard shortcuts

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