types

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the name of the module
	ModuleName = "configuration"
	// StoreKey is the key used to identify the module in the KVStore
	StoreKey = ModuleName
	// RouterKey is the key used to process transactions for the module
	RouterKey = ModuleName
	// QuerierRoute is used to process queries for the module
	QuerierRoute = ModuleName
	// DefaultParamSpace defines the key for the configuration paramspace
	DefaultParamSpace = ModuleName
)

ModuleConst

View Source
const QueryConfig = "configuration"

QueryConfig is the route key used to query configuration data

View Source
const QueryFees = "fees"

QueryFees is the route key used to query fees data

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func RegisterCodec added in v0.2.0

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

Types

type Config

type Config struct {
	// Owners are the configuration owner, the addresses allowed to handle fees
	// and register domains with no superuser
	Owners []sdk.AccAddress `json:"owners"`
	// ValidDomain defines a regexp that determines if a domain name is valid or not
	ValidDomain string `json:"valid_domain"`
	// ValidName defines a regexp that determines if an account name is valid or not
	ValidName string `json:"valid_name"`
	// ValidBlockchainID defines a regexp that determines if a blockchain id is valid or not
	ValidBlockchainID string `json:"valid_blockchain_id"`
	// ValidBlockchainAddress determines a regexp for a valid blockchain address
	ValidBlockchainAddress string `json:"valid_blockchain_address"`
	// DomainRenew defines the duration of the domain renewal period in seconds
	DomainRenew int64 `json:"domain_renew"`
	// DomainGracePeriod defines the grace period for a domain deletion in seconds
	DomainGracePeriod int64 `json:"domain_grace_period"`
}

Config is the configuration of the network

type Fees added in v0.2.0

type Fees struct {
	// LevelFees maps msg fees to their level
	LevelFees map[msgUniqueID]LevelFeeMapper
	// DefaultFees maps the default fees for a msg
	DefaultFees map[msgUniqueID]sdk.Coin
}

LevelFees contains different type of fees to calculate coins to detract when processing different messages

func NewFees added in v0.2.0

func NewFees() *Fees

NewFees is Fees constructor

func (*Fees) CalculateLevelFees added in v0.2.0

func (f *Fees) CalculateLevelFees(msg sdk.Msg, level int) (sdk.Coin, bool)

CalculateLevelFees calculates fees based on message type and level if there is no level fee then it retreats to the default fees for msg false is returned only in the case in which no fee was found or can be applied.

func (*Fees) DeleteDefaultFee added in v0.2.0

func (f *Fees) DeleteDefaultFee(msg sdk.Msg)

func (*Fees) DeleteLevelFee added in v0.2.0

func (f *Fees) DeleteLevelFee(msg sdk.Msg, level int)

func (*Fees) MarshalJSON added in v0.2.0

func (f *Fees) MarshalJSON() ([]byte, error)

MarshalJSON makes sure the map is ordered deterministically

func (*Fees) UnmarshalJSON added in v0.2.0

func (f *Fees) UnmarshalJSON(b []byte) error

func (*Fees) UpsertDefaultFees added in v0.2.0

func (f *Fees) UpsertDefaultFees(msg sdk.Msg, coin sdk.Coin)

UpsertDefaultFees updates or sets the default fees for sdk.Msg

func (*Fees) UpsertLevelFees added in v0.2.0

func (f *Fees) UpsertLevelFees(msg sdk.Msg, level int, coin sdk.Coin)

UpsertLevelFees updates or sets the level fees for the message

type LevelFeeMapper added in v0.2.0

type LevelFeeMapper map[string]sdk.Coin

LevelFeeMapper maps fees based on level

func (LevelFeeMapper) MarshalJSON added in v0.2.0

func (m LevelFeeMapper) MarshalJSON() ([]byte, error)

MarshalJSON marshals the map in a deterministic way

func (*LevelFeeMapper) UnmarshalJSON added in v0.2.0

func (m *LevelFeeMapper) UnmarshalJSON(b []byte) error

type MsgDeleteLevelFee added in v0.2.0

type MsgDeleteLevelFee struct {
	Signers []sdk.AccAddress
	Module  string
	MsgType string
	Level   sdk.Int
}

MsgDeleteLevelFee deletes a level fee

func (MsgDeleteLevelFee) GetSignBytes added in v0.2.0

func (m MsgDeleteLevelFee) GetSignBytes() []byte

func (MsgDeleteLevelFee) GetSigners added in v0.2.0

func (m MsgDeleteLevelFee) GetSigners() []sdk.AccAddress

func (MsgDeleteLevelFee) Route added in v0.2.0

func (m MsgDeleteLevelFee) Route() string

func (MsgDeleteLevelFee) Type added in v0.2.0

func (m MsgDeleteLevelFee) Type() string

func (MsgDeleteLevelFee) ValidateBasic added in v0.2.0

func (m MsgDeleteLevelFee) ValidateBasic() error

type MsgUpdateConfig added in v0.2.0

type MsgUpdateConfig struct {
	Signers          []sdk.AccAddress
	NewConfiguration Config
}

MsgUpdateConfig is used to update configuration using a multisig strategy

func (MsgUpdateConfig) GetSignBytes added in v0.2.0

func (m MsgUpdateConfig) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgUpdateConfig) GetSigners added in v0.2.0

func (m MsgUpdateConfig) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (MsgUpdateConfig) Route added in v0.2.0

func (m MsgUpdateConfig) Route() string

func (MsgUpdateConfig) Type added in v0.2.0

func (m MsgUpdateConfig) Type() string

func (MsgUpdateConfig) ValidateBasic added in v0.2.0

func (m MsgUpdateConfig) ValidateBasic() error

type MsgUpsertDefaultFee added in v0.2.0

type MsgUpsertDefaultFee struct {
	Signers []sdk.AccAddress
	Module  string
	MsgType string
	Fee     sdk.Coin
}

MsgUpdateDefaultFee inserts or update the default fees

func (MsgUpsertDefaultFee) GetSignBytes added in v0.2.0

func (m MsgUpsertDefaultFee) GetSignBytes() []byte

func (MsgUpsertDefaultFee) GetSigners added in v0.2.0

func (m MsgUpsertDefaultFee) GetSigners() []sdk.AccAddress

func (MsgUpsertDefaultFee) Route added in v0.2.0

func (m MsgUpsertDefaultFee) Route() string

func (MsgUpsertDefaultFee) Type added in v0.2.0

func (m MsgUpsertDefaultFee) Type() string

func (MsgUpsertDefaultFee) ValidateBasic added in v0.2.0

func (m MsgUpsertDefaultFee) ValidateBasic() error

type MsgUpsertLevelFee added in v0.2.0

type MsgUpsertLevelFee struct {
	Signers []sdk.AccAddress
	Module  string
	MsgType string
	Level   sdk.Int
	Fee     sdk.Coin
}

MsgUpsertLevelFee inserts or update a level fee

func (MsgUpsertLevelFee) GetSignBytes added in v0.2.0

func (m MsgUpsertLevelFee) GetSignBytes() []byte

func (MsgUpsertLevelFee) GetSigners added in v0.2.0

func (m MsgUpsertLevelFee) GetSigners() []sdk.AccAddress

func (MsgUpsertLevelFee) Route added in v0.2.0

func (m MsgUpsertLevelFee) Route() string

func (MsgUpsertLevelFee) Type added in v0.2.0

func (m MsgUpsertLevelFee) Type() string

func (MsgUpsertLevelFee) ValidateBasic added in v0.2.0

func (m MsgUpsertLevelFee) ValidateBasic() error

type QueryConfigResponse

type QueryConfigResponse struct {
	Configuration Config `json:"config"`
}

QueryConfigResponse is the result returned after a query to the chain configuration

type QueryFeesResponse added in v0.2.0

type QueryFeesResponse struct {
	Fees *Fees `json:"fees"`
}

Jump to

Keyboard shortcuts

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