types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodeSpace btypes.CodespaceType = "guardian"

	CodeInvalidInput          btypes.CodeType = 601 // invalid input
	CodeInvalidCreator        btypes.CodeType = 602 // invalid creator
	CodeUnKnownGuardian       btypes.CodeType = 603 // unknown guardian
	CodeGuardianAlreadyExists btypes.CodeType = 604 // guardian already exists
)

Guardian errors reserve 600 ~ 699.

Variables

View Source
var (
	// 事件类型
	EventTypeAddGuardian    = "add-guardian"    // 添加系统账户
	EventTypeDeleteGuardian = "delete-guardian" // 删除系统账户
	EventTypeHaltNetwork    = "halt-network"    // 停止网络

	// 事件参数
	AttributeKeyModule   = "guardian"  // 模块名称
	AttributeKeyGuardian = "guardian"  // 账户地址
	AttributeKeyCreator  = "creator"   // 创建账户地址
	AttributeKeyDeleteBy = "delete-by" // 删除账户地址
	AttributeKeyReason   = "reason"    // 操作原因
)

Functions

func ErrGuardianAlreadyExists

func ErrGuardianAlreadyExists() btypes.Error

func ErrInvalidCreator

func ErrInvalidCreator() btypes.Error

func ErrInvalidInput

func ErrInvalidInput(msg string) btypes.Error

func ErrUnKnownGuardian

func ErrUnKnownGuardian() btypes.Error

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

状态校验

Types

type GenesisState

type GenesisState struct {
	Guardians []Guardian `json:"guardians"`
}

创世状态

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(guardians []Guardian) GenesisState

func (GenesisState) Equals

func (gs GenesisState) Equals(gs1 GenesisState) bool

type Guardian

type Guardian struct {
	Description  string            `json:"description"`   // 描述
	GuardianType GuardianType      `json:"guardian_type"` // 账户类型:Genesis 创世配置 Ordinary 交易创建
	Address      btypes.AccAddress `json:"address"`       // 账户地址
	Creator      btypes.AccAddress `json:"creator"`       // 创建者账户地址
}

系统账户

func NewGuardian

func NewGuardian(description string, guardianType GuardianType, address, creator btypes.AccAddress) *Guardian

func (Guardian) Equals

func (g Guardian) Equals(g1 Guardian) bool

type GuardianType

type GuardianType byte
const (
	Genesis  GuardianType = 0x01 // 创世配置
	Ordinary GuardianType = 0x02 // 交易创建
)

Jump to

Keyboard shortcuts

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