guardian

package
v0.11.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "guardian"

	CodeInvalidOperator       sdk.CodeType = 100
	CodeProfilerExists        sdk.CodeType = 101
	CodeProfilerNotExists     sdk.CodeType = 102
	CodeTrusteeExists         sdk.CodeType = 103
	CodeTrusteeNotExists      sdk.CodeType = 104
	CodeInvalidDescription    sdk.CodeType = 105
	CodeDeleteGenesisProfiler sdk.CodeType = 106
	CodeDeleteGenesisTrustee  sdk.CodeType = 107
	CodeInvalidGuardian       sdk.CodeType = 108
)
View Source
const MsgType = "guardian"

Variables

This section is empty.

Functions

func ErrDeleteGenesisProfiler added in v0.10.0

func ErrDeleteGenesisProfiler(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error

func ErrDeleteGenesisTrustee added in v0.10.0

func ErrDeleteGenesisTrustee(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error

func ErrInvalidDescription added in v0.10.0

func ErrInvalidDescription(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidOperator added in v0.10.0

func ErrInvalidOperator(codespace sdk.CodespaceType, operator sdk.AccAddress) sdk.Error

func ErrProfilerExists

func ErrProfilerExists(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error

func ErrProfilerNotExists

func ErrProfilerNotExists(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error

func ErrTrusteeExists added in v0.10.0

func ErrTrusteeExists(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error

func ErrTrusteeNotExists added in v0.10.0

func ErrTrusteeNotExists(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error

func GetProfilerKey

func GetProfilerKey(addr sdk.AccAddress) []byte

func GetProfilersSubspaceKey

func GetProfilersSubspaceKey() []byte

Key for getting all profilers from the store

func GetTrusteeKey

func GetTrusteeKey(addr sdk.AccAddress) []byte

func GetTrusteesSubspaceKey

func GetTrusteesSubspaceKey() []byte

Key for getting all profilers from the store

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)

func NewHandler

func NewHandler(k Keeper) sdk.Handler

handle all "guardian" type messages.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type AccountType added in v0.10.0

type AccountType byte
const (
	Genesis  AccountType = 0x01
	Ordinary AccountType = 0x02
)

func AccountTypeFromString added in v0.10.0

func AccountTypeFromString(str string) (AccountType, error)

String to AccountType byte, Returns ff if invalid.

func (AccountType) Format added in v0.10.0

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

For Printf / Sprintf, returns bech32 when using %s

func (AccountType) MarshalJSON added in v0.10.0

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

Marshals to JSON using string

func (AccountType) String added in v0.10.0

func (bt AccountType) String() string

Turns BindingType byte to String

func (*AccountType) UnmarshalJSON added in v0.10.0

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

Unmarshals from JSON assuming Bech32 encoding

type AddGuardian added in v0.10.0

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

func (AddGuardian) EnsureLength added in v0.11.0

func (g AddGuardian) EnsureLength() sdk.Error

func (AddGuardian) ValidateBasic added in v0.10.0

func (g AddGuardian) ValidateBasic() sdk.Error

type DeleteGuardian added in v0.10.0

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

func (DeleteGuardian) ValidateBasic added in v0.10.0

func (g DeleteGuardian) ValidateBasic() sdk.Error

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

get raw genesis raw message for testing

func DefaultGenesisStateForTest

func DefaultGenesisStateForTest() GenesisState

get raw genesis raw message for testing

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

func NewGenesisState

func NewGenesisState(profilers, trustees []Guardian) GenesisState

type Guardian added in v0.10.0

type Guardian struct {
	Description string         `json:"description"`
	AccountType AccountType    `json:"type"`
	Address     sdk.AccAddress `json:"address"`  // this guardian's address
	AddedBy     sdk.AccAddress `json:"added_by"` // address that initiated the AddGuardian tx
}

func NewGuardian added in v0.10.0

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

func (Guardian) Equal added in v0.10.0

func (g Guardian) Equal(guardian Guardian) bool

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, codespace sdk.CodespaceType) Keeper

func (Keeper) AddProfiler

func (k Keeper) AddProfiler(ctx sdk.Context, guardian Guardian) sdk.Error

Add a profiler, only a existing profiler can add a new and the profiler is not existed

func (Keeper) AddTrustee

func (k Keeper) AddTrustee(ctx sdk.Context, guardian Guardian) sdk.Error

Add a trustee

func (Keeper) DeleteProfiler added in v0.10.0

func (k Keeper) DeleteProfiler(ctx sdk.Context, address sdk.AccAddress) sdk.Error

func (Keeper) DeleteTrustee added in v0.10.0

func (k Keeper) DeleteTrustee(ctx sdk.Context, address sdk.AccAddress) sdk.Error

func (Keeper) GetProfiler

func (k Keeper) GetProfiler(ctx sdk.Context, addr sdk.AccAddress) (guardian Guardian, found bool)

func (Keeper) GetTrustee

func (k Keeper) GetTrustee(ctx sdk.Context, addr sdk.AccAddress) (guardian Guardian, found bool)

func (Keeper) ProfilersIterator added in v0.10.0

func (k Keeper) ProfilersIterator(ctx sdk.Context) sdk.Iterator

Gets all profilers

func (Keeper) TrusteesIterator added in v0.10.0

func (k Keeper) TrusteesIterator(ctx sdk.Context) sdk.Iterator

Gets all trustees

type MsgAddProfiler

type MsgAddProfiler struct {
	AddGuardian
}

______________________________________________________________________ MsgAddProfiler - struct for add a profiler

func NewMsgAddProfiler

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

func (MsgAddProfiler) GetSignBytes

func (msg MsgAddProfiler) GetSignBytes() []byte

func (MsgAddProfiler) GetSigners

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

func (MsgAddProfiler) Route

func (msg MsgAddProfiler) Route() string

func (MsgAddProfiler) Type

func (msg MsgAddProfiler) Type() string

func (MsgAddProfiler) ValidateBasic

func (msg MsgAddProfiler) ValidateBasic() sdk.Error

type MsgAddTrustee added in v0.10.0

type MsgAddTrustee struct {
	AddGuardian
}

______________________________________________________________________ MsgAddTrustee - struct for add a trustee

func NewMsgAddTrustee added in v0.10.0

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

func (MsgAddTrustee) GetSignBytes added in v0.10.0

func (msg MsgAddTrustee) GetSignBytes() []byte

func (MsgAddTrustee) GetSigners added in v0.10.0

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

func (MsgAddTrustee) Route added in v0.10.0

func (msg MsgAddTrustee) Route() string

func (MsgAddTrustee) Type added in v0.10.0

func (msg MsgAddTrustee) Type() string

func (MsgAddTrustee) ValidateBasic added in v0.10.0

func (msg MsgAddTrustee) ValidateBasic() sdk.Error

type MsgDeleteProfiler added in v0.10.0

type MsgDeleteProfiler struct {
	DeleteGuardian
}

______________________________________________________________________ MsgDeleteProfiler - struct for delete a profiler

func NewMsgDeleteProfiler added in v0.10.0

func NewMsgDeleteProfiler(address, deletedBy sdk.AccAddress) MsgDeleteProfiler

func (MsgDeleteProfiler) GetSignBytes added in v0.10.0

func (msg MsgDeleteProfiler) GetSignBytes() []byte

func (MsgDeleteProfiler) GetSigners added in v0.10.0

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

func (MsgDeleteProfiler) Route added in v0.10.0

func (msg MsgDeleteProfiler) Route() string

func (MsgDeleteProfiler) Type added in v0.10.0

func (msg MsgDeleteProfiler) Type() string

func (MsgDeleteProfiler) ValidateBasic added in v0.10.0

func (msg MsgDeleteProfiler) ValidateBasic() sdk.Error

type MsgDeleteTrustee added in v0.10.0

type MsgDeleteTrustee struct {
	DeleteGuardian
}

______________________________________________________________________ MsgDeleteTrustee - struct for delete a trustee

func NewMsgDeleteTrustee added in v0.10.0

func NewMsgDeleteTrustee(address, deletedBy sdk.AccAddress) MsgDeleteTrustee

func (MsgDeleteTrustee) GetSignBytes added in v0.10.0

func (msg MsgDeleteTrustee) GetSignBytes() []byte

func (MsgDeleteTrustee) GetSigners added in v0.10.0

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

func (MsgDeleteTrustee) Route added in v0.10.0

func (msg MsgDeleteTrustee) Route() string

func (MsgDeleteTrustee) Type added in v0.10.0

func (msg MsgDeleteTrustee) Type() string

func (MsgDeleteTrustee) ValidateBasic added in v0.10.0

func (msg MsgDeleteTrustee) ValidateBasic() sdk.Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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