types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	EventTypeAddProfiler    = "add_profiler"
	EventTypeAddTrustee     = "add_trustee"
	EventTypeDeleteProfiler = "delete_profiler"
	EventTypeDeleteTrustee  = "delete_trustee"

	AttributeKeyProfilerAddress = "address"
	AttributeKeyTrusteeAddress  = "address"
	AttributeKeyAddedBy         = "added_by"
	AttributeKeyDeletedBy       = "deleted_by"

	AttributeValueCategory = ModuleName
)

guardian module event types

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

	// StoreKey is the default store key for guardian
	StoreKey = ModuleName

	// RouterKey is the message route for guardian
	RouterKey = ModuleName

	// QuerierRoute is the querier route for the guardian store.
	QuerierRoute = StoreKey

	// Query endpoints supported by the guardian querier
	QueryProfilers = "profilers"
	QueryTrustees  = "trustees"
)

nolint

View Source
const (
	TypeMsgAddProfiler    = "add_profiler"    // type for MsgAddProfiler
	TypeMsgDeleteProfiler = "delete_profiler" // type for MsgDeleteProfiler
	TypeMsgAddTrustee     = "add_trustee"     // type for MsgAddTrustee
	TypeMsgDeleteTrustee  = "delete_trustee"  // type for MsgDeleteTrustee
)

Variables

View Source
var (
	ErrUnknownOperator       = sdkerrors.Register(ModuleName, 1, "unknown operator")
	ErrUnknownProfiler       = sdkerrors.Register(ModuleName, 2, "unknown profiler")
	ErrUnknownTrustee        = sdkerrors.Register(ModuleName, 3, "unknown trustee")
	ErrDeleteGenesisProfiler = sdkerrors.Register(ModuleName, 4, "can't delete genesis profiler")
	ErrDeleteGenesisTrustee  = sdkerrors.Register(ModuleName, 5, "can't delete genesis trustee")
)

guardian module sentinel errors

View Source
var (
	ProfilerKey = []byte{0x00} // profiler key
	TrusteeKey  = []byte{0x01} // trustee key
)
View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func GetProfilerKey

func GetProfilerKey(addr sdk.AccAddress) []byte

GetProfilerKey returns profiler key bytes

func GetProfilersSubspaceKey

func GetProfilersSubspaceKey() []byte

GetProfilersSubspaceKey returns the key for getting all profilers from the store

func GetTrusteeKey

func GetTrusteeKey(addr sdk.AccAddress) []byte

GetTrusteeKey returns trustee key bytes

func GetTrusteesSubspaceKey

func GetTrusteesSubspaceKey() []byte

GetProfilersSubspaceKey returns the key for getting all profilers from the store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec.

Types

type AccountType

type AccountType byte

AccountType represents the type of account

const (
	Genesis  AccountType = 0x01 // account type of genesis
	Ordinary AccountType = 0x02 // account type of ordinary
)

func AccountTypeFromString

func AccountTypeFromString(str string) (AccountType, error)

AccountTypeFromString converts string to AccountType byte, Returns ff if invalid.

func (AccountType) Format

func (bt AccountType) Format(s fmt.State, verb rune)

Format for Printf / Sprintf, returns bech32 when using %s

func (AccountType) MarshalJSON

func (bt AccountType) MarshalJSON() ([]byte, error)

MarshalJSON marshals AccountType to JSON using string

func (AccountType) String

func (bt AccountType) String() string

String converts BindingType byte to String

func (*AccountType) UnmarshalJSON

func (bt *AccountType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals AccountType from JSON assuming Bech32 encoding

type AddGuardian

type AddGuardian struct {
	Description string         `json:"description" yaml:"description"` // description of the guardian
	Address     sdk.AccAddress `json:"address" yaml:"address"`         // address added
	AddedBy     sdk.AccAddress `json:"added_by" yaml:"added_by"`       // address that initiated the tx
}

AddGuardian defines the properties of add guardian message

func (AddGuardian) EnsureLength

func (g AddGuardian) EnsureLength() error

EnsureLength validate the length of AddGuardian

func (AddGuardian) ValidateBasic

func (g AddGuardian) ValidateBasic() error

ValidateBasic validate the AddGuardian

type DeleteGuardian

type DeleteGuardian struct {
	Address   sdk.AccAddress `json:"address" yaml:"address"`       // address deleted
	DeletedBy sdk.AccAddress `json:"deleted_by" yaml:"deleted_by"` // address that initiated the tx
}

DeleteGuardian defines the properties of delete guardian message

func (DeleteGuardian) ValidateBasic

func (g DeleteGuardian) ValidateBasic() error

ValidateBasic validate the DeleteGuardian

type GenesisState

type GenesisState struct {
	Profilers []Guardian `json:"profilers"`
	Trustees  []Guardian `json:"trustees"`
}

GenesisState - all guardian state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState gets raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(profilers, trustees []Guardian) GenesisState

NewGenesisState constructs a GenesisState

type Guardian

type Guardian struct {
	Description string         `json:"description" yaml:"description"` // description of guardian
	AccountType AccountType    `json:"type"  yaml:"account_type"`      // account type of guardian
	Address     sdk.AccAddress `json:"address" yaml:"address"`         // address of guardian
	AddedBy     sdk.AccAddress `json:"added_by"  yaml:"added_by"`      // address that initiated the AddGuardian tx
}

Guardian represents a Guardian

func NewGuardian

func NewGuardian(description string, accountType AccountType, address, addedBy sdk.AccAddress) Guardian

NewGuardian constructs a Guardian

func (Guardian) Equal

func (g Guardian) Equal(guardian Guardian) bool

Equal returns if the guardian is equal to specified guardian

func (Guardian) GetAccountType added in v0.5.0

func (g Guardian) GetAccountType() exported.AccountTypeI

GetAccountType returns AccountType of the guardian

func (Guardian) GetAddedBy added in v0.5.0

func (g Guardian) GetAddedBy() sdk.AccAddress

GetAddedBy returns AddedBy of the guardian

func (Guardian) GetAddress added in v0.5.0

func (g Guardian) GetAddress() sdk.AccAddress

GetAddress returns Address of the guardian

func (Guardian) GetDescription added in v0.5.0

func (g Guardian) GetDescription() string

GetDescription returns Description of the guardian

type MsgAddProfiler

type MsgAddProfiler struct {
	AddGuardian `json:"add_guardian" yaml:"add_guardian"` // the guardian will be added
}

MsgAddProfiler - struct for add a profiler

func NewMsgAddProfiler

func NewMsgAddProfiler(description string, address, addedBy sdk.AccAddress) MsgAddProfiler

NewMsgAddProfiler constructs a MsgAddProfiler

func (MsgAddProfiler) GetSignBytes

func (msg MsgAddProfiler) GetSignBytes() []byte

GetSignBytes implements Msg.

func (MsgAddProfiler) GetSigners

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

GetSigners implements Msg.

func (MsgAddProfiler) Route

func (msg MsgAddProfiler) Route() string

Route implements Msg.

func (MsgAddProfiler) Type

func (msg MsgAddProfiler) Type() string

Type implements Msg.

func (MsgAddProfiler) ValidateBasic

func (msg MsgAddProfiler) ValidateBasic() error

ValidateBasic implements Msg.

type MsgAddTrustee

type MsgAddTrustee struct {
	AddGuardian `json:"add_guardian" yaml:"add_guardian"` // the guardian will be added
}

______________________________________________________________________ MsgAddTrustee - struct for add a trustee

func NewMsgAddTrustee

func NewMsgAddTrustee(description string, address, addedAddress sdk.AccAddress) MsgAddTrustee

NewMsgAddTrustee constructs a MsgAddTrustee

func (MsgAddTrustee) GetSignBytes

func (msg MsgAddTrustee) GetSignBytes() []byte

GetSignBytes implements Msg.

func (MsgAddTrustee) GetSigners

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

GetSigners implements Msg.

func (MsgAddTrustee) Route

func (msg MsgAddTrustee) Route() string

Route implements Msg.

func (MsgAddTrustee) Type

func (msg MsgAddTrustee) Type() string

Type implements Msg.

func (MsgAddTrustee) ValidateBasic

func (msg MsgAddTrustee) ValidateBasic() error

ValidateBasic implements Msg.

type MsgDeleteProfiler

type MsgDeleteProfiler struct {
	DeleteGuardian `json:"delete_guardian" yaml:"delete_guardian"` // the guardian will be deleted
}

______________________________________________________________________ MsgDeleteProfiler - struct for delete a profiler

func NewMsgDeleteProfiler

func NewMsgDeleteProfiler(address, deletedBy sdk.AccAddress) MsgDeleteProfiler

NewMsgDeleteProfiler constructs a MsgDeleteProfiler

func (MsgDeleteProfiler) GetSignBytes

func (msg MsgDeleteProfiler) GetSignBytes() []byte

GetSignBytes implements Msg.

func (MsgDeleteProfiler) GetSigners

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

GetSigners implements Msg.

func (MsgDeleteProfiler) Route

func (msg MsgDeleteProfiler) Route() string

Route implements Msg.

func (MsgDeleteProfiler) Type

func (msg MsgDeleteProfiler) Type() string

Type implements Msg.

func (MsgDeleteProfiler) ValidateBasic

func (msg MsgDeleteProfiler) ValidateBasic() error

RoValidateBasicute implements Msg.

type MsgDeleteTrustee

type MsgDeleteTrustee struct {
	DeleteGuardian `json:"delete_guardian" yaml:"delete_guardian"` // the guardian will be deleted
}

______________________________________________________________________ MsgDeleteTrustee - struct for delete a trustee

func NewMsgDeleteTrustee

func NewMsgDeleteTrustee(address, deletedBy sdk.AccAddress) MsgDeleteTrustee

NewMsgDeleteTrustee constructs a MsgDeleteTrustee

func (MsgDeleteTrustee) GetSignBytes

func (msg MsgDeleteTrustee) GetSignBytes() []byte

GetSignBytes implements Msg.

func (MsgDeleteTrustee) GetSigners

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

GetSigners implements Msg.

func (MsgDeleteTrustee) Route

func (msg MsgDeleteTrustee) Route() string

Route implements Msg.

func (MsgDeleteTrustee) Type

func (msg MsgDeleteTrustee) Type() string

Type implements Msg.

func (MsgDeleteTrustee) ValidateBasic

func (msg MsgDeleteTrustee) ValidateBasic() error

ValidateBasic implements Msg.

type Profilers

type Profilers []Guardian

Profilers is a collection of Guardian

func (Profilers) String

func (ps Profilers) String() (out string)

String implements string

type Trustees

type Trustees []Guardian

Trustees is a collection of Guardian

func (Trustees) String

func (ts Trustees) String() (out string)

String implements string

Jump to

Keyboard shortcuts

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