types

package
v0.0.0-...-3ea6778 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DAOAccountName              = "dao"
	DAOTransferString           = "dao_transfer"
	DAOBurnString               = "dao_burn"
	DAOTransfer       DAOAction = iota + 1
	DAOBurn
)
View Source
const (
	CodeUnknownSubspace         sdk.CodeType = 1
	CodeSettingParameter                     = 2
	CodeEmptyData                            = 3
	CodeInvalidACL                           = 4
	CodeUnauthorizedParamChange              = 5
	CodeSubspaceNotFound                     = 6
	CodeUnrecognizedDAOAction                = 7
	CodeZeroValueDAOAction                   = 8
	CodeZeroHeightUpgrade                    = 9
	CodeEmptyVersionUpgrade                  = 10
)

Param module codespace constants

View Source
const (
	EventDAOTransfer = "dao_transfer"
	EventDAOBurn     = "dao_burn"
	EventParamChange = "param_change"
	EventUpgrade     = "upgrade"
	EventMustUpgrade = "must_upgrade"
)
View Source
const (
	DAOTransferFee    = 100000
	MsgChangeParamFee = 100000
	MsgUpgradeFee     = 100000
)
View Source
const (
	MsgDAOTransferName = "dao_tranfer"
	MsgChangeParamName = "change_param"
	MsgUpgradeName     = "upgrade"
)
View Source
const (
	ModuleName                         = "gov"           // ModuleKey defines the name of the module
	RouterKey                          = ModuleName      // RouterKey defines the routing key for a Parameter Change
	StoreKey                           = "gov"           // StoreKey is the string store key for the param store
	TStoreKey                          = "transient_gov" // TStoreKey is the string store key for the param transient store
	DefaultCodespace sdk.CodespaceType = ModuleName      // default codespace for governance errors
	QuerierRoute                       = ModuleName      // QuerierRoute is the querier route for the staking module
	QueryACL                           = "acl"
	QueryDAO                           = "dao"
	QueryUpgrade                       = "upgrade"
	QueryDAOOwner                      = "daoOwner"
)

query endpoints supported by the staking Querier

View Source
const (
	ACLKeySep = "/"
)
View Source
const DefaultParamspace = ModuleName

DefaultParamspace defines the default auth module parameter subspace

Variables

View Source
var (
	ACLKey      = []byte("acl")
	DAOOwnerKey = []byte("daoOwner")
	UpgradeKey  = []byte("upgrade")
)

Parameter keys

View Source
var (
	GovFeeMap = map[string]int64{
		MsgDAOTransferName: DAOTransferFee,
		MsgChangeParamName: MsgChangeParamFee,
		MsgUpgradeName:     MsgUpgradeFee,
	}
)
View Source
var ModuleCdc *codec.Codec

module codec

Functions

func ErrEmptyChanges

func ErrEmptyChanges(codespace sdk.CodespaceType) sdk.Error

ErrEmptyChanges returns an error for empty parameter changes.

func ErrEmptyKey

func ErrEmptyKey(codespace sdk.CodespaceType) sdk.Error

ErrEmptyKey returns an error for when an empty key is given.

func ErrEmptySubspace

func ErrEmptySubspace(codespace sdk.CodespaceType) sdk.Error

ErrEmptySubspace returns an error for an empty subspace.

func ErrEmptyValue

func ErrEmptyValue(codespace sdk.CodespaceType) sdk.Error

ErrEmptyValue returns an error for when an empty key is given.

func ErrEmptyVersionUpgrade

func ErrEmptyVersionUpgrade(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidACL

func ErrInvalidACL(codespace sdk.CodespaceType, err error) sdk.Error

func ErrSettingParameter

func ErrSettingParameter(codespace sdk.CodespaceType, key, subkey, value, msg string) sdk.Error

ErrSettingParameter returns an error for failing to set a parameter.

func ErrSubspaceNotFound

func ErrSubspaceNotFound(codespace sdk.CodespaceType, subspaceName string) sdk.Error

func ErrUnauthorizedParamChange

func ErrUnauthorizedParamChange(codespace sdk.CodespaceType, owner sdk.Address, param string) sdk.Error

func ErrUnknownSubspace

func ErrUnknownSubspace(codespace sdk.CodespaceType, space string) sdk.Error

ErrUnknownSubspace returns an unknown subspace error.

func ErrUnrecognizedDAOAction

func ErrUnrecognizedDAOAction(codespace sdk.CodespaceType, daoActionString string) sdk.Error

func ErrZeroHeightUpgrade

func ErrZeroHeightUpgrade(codespace sdk.CodespaceType) sdk.Error

func ErrZeroValueDAOAction

func ErrZeroValueDAOAction(codespace sdk.CodespaceType) sdk.Error

func NewACLKey

func NewACLKey(subspaceName, paramName string) string

func ParamKeyTable

func ParamKeyTable() sdk.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers all necessary param module types with a given codec.

func SplitACLKey

func SplitACLKey(aclKey string) (subspaceName, paramName string)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of auth genesis data returning an error for any failed validation criteria.

Types

type ACL

type ACL interface {
	Validate(adjacencyMap map[string]bool) error
	GetOwner(permKey string) sdk.Address
	SetOwner(permKey string, ownerValue sdk.Address)
	GetAll() map[string]sdk.Address
	String() string
}

type ACLPair

type ACLPair struct {
	Key  string      `json:"acl_key"`
	Addr sdk.Address `json:"address"`
}

type BaseACL

type BaseACL struct {
	M map[string]sdk.Address
}

func (BaseACL) GetAll

func (b BaseACL) GetAll() map[string]sdk.Address

func (BaseACL) GetOwner

func (b BaseACL) GetOwner(permKey string) sdk.Address

func (BaseACL) SetOwner

func (b BaseACL) SetOwner(permKey string, ownerValue sdk.Address)

func (BaseACL) String

func (b BaseACL) String() string

func (BaseACL) Validate

func (b BaseACL) Validate(adjacencyMap map[string]bool) error

type DAOAction

type DAOAction int

func DAOActionFromString

func DAOActionFromString(s string) (DAOAction, sdk.Error)

func (DAOAction) String

func (da DAOAction) String() string

type GenesisState

type GenesisState struct {
	Params    Params  `json:"params" yaml:"params"`
	DAOTokens sdk.Int `json:"DAO_Tokens"`
}

GenesisState - all auth state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - Return a default genesis state

func NewGenesisState

func NewGenesisState(params Params, daoTokens sdk.Int) GenesisState

NewGenesisState - Create a new genesis state

type MsgChangeParam

type MsgChangeParam struct {
	FromAddress sdk.Address `json:"address"`
	ParamKey    string      `json:"param_key"`
	ParamVal    interface{} `json:"param_value"`
}

---------------------------------------------------------------------------------------------------------------------- MsgChangeParam structure for changing governance parameters

func (MsgChangeParam) GetSignBytes

func (msg MsgChangeParam) GetSignBytes() []byte

func (MsgChangeParam) GetSigners

func (msg MsgChangeParam) GetSigners() []sdk.Address

func (MsgChangeParam) Route

func (msg MsgChangeParam) Route() string

nolint

func (MsgChangeParam) Type

func (msg MsgChangeParam) Type() string

func (MsgChangeParam) ValidateBasic

func (msg MsgChangeParam) ValidateBasic() sdk.Error

type MsgDAOTransfer

type MsgDAOTransfer struct {
	FromAddress sdk.Address `json:"from_address"`
	ToAddress   sdk.Address `json:"to_address"`
	Amount      sdk.Int     `json:"amount"`
	Action      string      `json:"action"`
}

---------------------------------------------------------------------------------------------------------------------- MsgChangeParam structure for changing governance parameters

func (MsgDAOTransfer) GetSignBytes

func (msg MsgDAOTransfer) GetSignBytes() []byte

func (MsgDAOTransfer) GetSigners

func (msg MsgDAOTransfer) GetSigners() []sdk.Address

func (MsgDAOTransfer) Route

func (msg MsgDAOTransfer) Route() string

nolint

func (MsgDAOTransfer) Type

func (msg MsgDAOTransfer) Type() string

func (MsgDAOTransfer) ValidateBasic

func (msg MsgDAOTransfer) ValidateBasic() sdk.Error

type MsgUpgrade

type MsgUpgrade struct {
	Address sdk.Address `json:"address"`
	Upgrade Upgrade     `json:"upgrade"`
}

---------------------------------------------------------------------------------------------------------------------- MsgUpgrade structure for changing governance parameters

func (MsgUpgrade) GetSignBytes

func (msg MsgUpgrade) GetSignBytes() []byte

func (MsgUpgrade) GetSigners

func (msg MsgUpgrade) GetSigners() []sdk.Address

func (MsgUpgrade) Route

func (msg MsgUpgrade) Route() string

nolint

func (MsgUpgrade) Type

func (msg MsgUpgrade) Type() string

func (MsgUpgrade) ValidateBasic

func (msg MsgUpgrade) ValidateBasic() sdk.Error

type NonMapACL

type NonMapACL []ACLPair // cant use map cause of amino concrete marshal in tx

func (NonMapACL) GetAll

func (b NonMapACL) GetAll() map[string]sdk.Address

func (NonMapACL) GetOwner

func (b NonMapACL) GetOwner(permKey string) sdk.Address

func (*NonMapACL) SetOwner

func (b *NonMapACL) SetOwner(permKey string, ownerValue sdk.Address)

func (NonMapACL) String

func (b NonMapACL) String() string

func (NonMapACL) Validate

func (b NonMapACL) Validate(adjacencyMap map[string]bool) error

type Params

type Params struct {
	ACL      ACL         `json:"acl"`
	DAOOwner sdk.Address `json:"dao_owner"`
	Upgrade  Upgrade     `json:"upgrade"`
}

Params defines the parameters for the auth module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams(acl ACL, daoOwner sdk.Address) Params

NewParams creates a new Params object

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

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

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements the stringer interface.

type PosKeeper

type PosKeeper interface {
	RewardForRelays(ctx sdk.Ctx, relays sdk.Int, address sdk.Address)
	GetStakedTokens(ctx sdk.Ctx) sdk.Int
	Validator(ctx sdk.Ctx, addr sdk.Address) posexported.ValidatorI
	TotalTokens(ctx sdk.Ctx) sdk.Int
	BurnForChallenge(ctx sdk.Ctx, challenges sdk.Int, address sdk.Address)
	JailValidator(ctx sdk.Ctx, addr sdk.Address)
	AllValidators(ctx sdk.Ctx) (validators []posexported.ValidatorI)
	GetStakedValidators(ctx sdk.Ctx) (validators []posexported.ValidatorI)
	SessionBlockFrequency(ctx sdk.Ctx) (res int64)
	StakeDenom(ctx sdk.Ctx) (res string)
}

type QueryACLParams

type QueryACLParams struct{}

type QueryDAOParams

type QueryDAOParams struct{}

type QueryUpgradeParams

type QueryUpgradeParams struct{}

type SupplyKeeper

type SupplyKeeper interface {
	// get total supply of tokens
	GetSupply(ctx sdk.Ctx) supplyexported.SupplyI
	// get the address of a module account
	GetModuleAddress(name string) sdk.Address
	// get the module account structure
	GetModuleAccount(ctx sdk.Ctx, moduleName string) supplyexported.ModuleAccountI
	// set module account structure
	SetModuleAccount(sdk.Ctx, supplyexported.ModuleAccountI)
	// send coins to/from module accounts
	SendCoinsFromModuleToModule(ctx sdk.Ctx, senderModule, recipientModule string, amt sdk.Coins) sdk.Error
	// send coins from module to validator
	SendCoinsFromModuleToAccount(ctx sdk.Ctx, senderModule string, recipientAddr sdk.Address, amt sdk.Coins) sdk.Error
	// send coins from validator to module
	SendCoinsFromAccountToModule(ctx sdk.Ctx, senderAddr sdk.Address, recipientModule string, amt sdk.Coins) sdk.Error
	// mint coins
	MintCoins(ctx sdk.Ctx, moduleName string, amt sdk.Coins) sdk.Error
	// burn coins
	BurnCoins(ctx sdk.Ctx, name string, amt sdk.Coins) sdk.Error
}

SupplyKeeper defines the expected supply Keeper (noalias)

type Upgrade

type Upgrade struct {
	Height  int64  `json:"Height"`
	Version string `json:'Version'`
}

func NewUpgrade

func NewUpgrade(height int64, version string) Upgrade

func (Upgrade) UpgradeHeight

func (u Upgrade) UpgradeHeight() int64

func (Upgrade) UpgradeVersion

func (u Upgrade) UpgradeVersion() string

Jump to

Keyboard shortcuts

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