guardian

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

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 (
	QueryProfilers = "profilers"
	QueryTrustees  = "trustees"
)
View Source
const MsgType = "guardian"

Variables

This section is empty.

Functions

func ErrDeleteGenesisProfiler

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

func ErrDeleteGenesisTrustee

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

func ErrInvalidDescription

func ErrInvalidDescription(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidOperator

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

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

func ErrTrusteeNotExists

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 NewQuerier

func NewQuerier(k Keeper) sdk.Querier

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type AccountType

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

func AccountTypeFromString

func AccountTypeFromString(str string) (AccountType, error)

String to AccountType byte, Returns ff if invalid.

func (AccountType) Format

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

For Printf / Sprintf, returns bech32 when using %s

func (AccountType) MarshalJSON

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

Marshals to JSON using string

func (AccountType) String

func (bt AccountType) String() string

Turns BindingType byte to String

func (*AccountType) UnmarshalJSON

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

Unmarshals from JSON assuming Bech32 encoding

type AddGuardian

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

func (g AddGuardian) EnsureLength() sdk.Error

func (AddGuardian) ValidateBasic

func (g AddGuardian) ValidateBasic() sdk.Error

type DeleteGuardian

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

func (DeleteGuardian) ValidateBasic

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

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

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

func (Guardian) Equal

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

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

func (Keeper) DeleteTrustee

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

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

Gets all profilers

func (Keeper) TrusteesIterator

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

type MsgAddTrustee struct {
	AddGuardian
}

______________________________________________________________________ MsgAddTrustee - struct for add a trustee

func NewMsgAddTrustee

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

func (MsgAddTrustee) GetSignBytes

func (msg MsgAddTrustee) GetSignBytes() []byte

func (MsgAddTrustee) GetSigners

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

func (MsgAddTrustee) Route

func (msg MsgAddTrustee) Route() string

func (MsgAddTrustee) Type

func (msg MsgAddTrustee) Type() string

func (MsgAddTrustee) ValidateBasic

func (msg MsgAddTrustee) ValidateBasic() sdk.Error

type MsgDeleteProfiler

type MsgDeleteProfiler struct {
	DeleteGuardian
}

______________________________________________________________________ MsgDeleteProfiler - struct for delete a profiler

func NewMsgDeleteProfiler

func NewMsgDeleteProfiler(address, deletedBy sdk.AccAddress) MsgDeleteProfiler

func (MsgDeleteProfiler) GetSignBytes

func (msg MsgDeleteProfiler) GetSignBytes() []byte

func (MsgDeleteProfiler) GetSigners

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

func (MsgDeleteProfiler) Route

func (msg MsgDeleteProfiler) Route() string

func (MsgDeleteProfiler) Type

func (msg MsgDeleteProfiler) Type() string

func (MsgDeleteProfiler) ValidateBasic

func (msg MsgDeleteProfiler) ValidateBasic() sdk.Error

type MsgDeleteTrustee

type MsgDeleteTrustee struct {
	DeleteGuardian
}

______________________________________________________________________ MsgDeleteTrustee - struct for delete a trustee

func NewMsgDeleteTrustee

func NewMsgDeleteTrustee(address, deletedBy sdk.AccAddress) MsgDeleteTrustee

func (MsgDeleteTrustee) GetSignBytes

func (msg MsgDeleteTrustee) GetSignBytes() []byte

func (MsgDeleteTrustee) GetSigners

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

func (MsgDeleteTrustee) Route

func (msg MsgDeleteTrustee) Route() string

func (MsgDeleteTrustee) Type

func (msg MsgDeleteTrustee) Type() string

func (MsgDeleteTrustee) ValidateBasic

func (msg MsgDeleteTrustee) ValidateBasic() sdk.Error

type Profilers

type Profilers []Guardian

func (Profilers) String

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

type Trustees

type Trustees []Guardian

func (Trustees) String

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

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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