Documentation
¶
Overview ¶
To prevent namespace collision between consumer modules, we define a type Subspace. A Subspace can only be generated by the keeper, and the keeper checks the existence of the Subspace having the same name before generating the Subspace.
Consumer modules must take a Subspace (via Keeper.Subspace), not the keeper itself. This isolates each modules from the others and make them modify their respective parameters safely. Keeper can be treated as master permission for all Subspaces (via Keeper.GetSubspace), so should be passed to proper modules (ex. x/governance).
Index ¶
- Constants
- Variables
- type CosmosGasParams
- func (*CosmosGasParams) Descriptor() ([]byte, []int)
- func (this *CosmosGasParams) Equal(that interface{}) bool
- func (m *CosmosGasParams) GetCosmosGasMultiplierDenominator() uint64
- func (m *CosmosGasParams) GetCosmosGasMultiplierNumerator() uint64
- func (m *CosmosGasParams) Marshal() (dAtA []byte, err error)
- func (m *CosmosGasParams) MarshalTo(dAtA []byte) (int, error)
- func (m *CosmosGasParams) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CosmosGasParams) ProtoMessage()
- func (m *CosmosGasParams) Reset()
- func (m *CosmosGasParams) Size() (n int)
- func (m *CosmosGasParams) String() string
- func (m *CosmosGasParams) Unmarshal(dAtA []byte) error
- func (cg *CosmosGasParams) Validate() error
- func (m *CosmosGasParams) XXX_DiscardUnknown()
- func (m *CosmosGasParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CosmosGasParams) XXX_Merge(src proto.Message)
- func (m *CosmosGasParams) XXX_Size() int
- func (m *CosmosGasParams) XXX_Unmarshal(b []byte) error
- type FeesParams
- func (*FeesParams) Descriptor() ([]byte, []int)
- func (this *FeesParams) Equal(that interface{}) bool
- func (m *FeesParams) GetAllowedFeeDenoms() []string
- func (m *FeesParams) GetGlobalMinimumGasPrices() github_com_cosmos_cosmos_sdk_types.DecCoins
- func (m *FeesParams) Marshal() (dAtA []byte, err error)
- func (m *FeesParams) MarshalTo(dAtA []byte) (int, error)
- func (m *FeesParams) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FeesParams) ProtoMessage()
- func (m *FeesParams) Reset()
- func (m *FeesParams) Size() (n int)
- func (m *FeesParams) String() string
- func (m *FeesParams) Unmarshal(dAtA []byte) error
- func (fp *FeesParams) Validate() error
- func (m *FeesParams) XXX_DiscardUnknown()
- func (m *FeesParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FeesParams) XXX_Merge(src proto.Message)
- func (m *FeesParams) XXX_Size() int
- func (m *FeesParams) XXX_Unmarshal(b []byte) error
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (this *GenesisState) Equal(that interface{}) bool
- func (m *GenesisState) GetCosmosGasParams() CosmosGasParams
- func (m *GenesisState) GetFeesParams() FeesParams
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (gs GenesisState) Validate() error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type KeyTable
- type ParamSet
- type ParamSetPair
- type ParamSetPairs
- type QuerySubspaceParams
- type ReadOnlySubspace
- func (ros ReadOnlySubspace) Get(ctx sdk.Context, key []byte, ptr interface{})
- func (ros ReadOnlySubspace) GetRaw(ctx sdk.Context, key []byte) []byte
- func (ros ReadOnlySubspace) Has(ctx sdk.Context, key []byte) bool
- func (ros ReadOnlySubspace) Modified(ctx sdk.Context, key []byte) bool
- func (ros ReadOnlySubspace) Name() string
- type Subspace
- func (s Subspace) Get(ctx sdk.Context, key []byte, ptr interface{})
- func (s Subspace) GetIfExists(ctx sdk.Context, key []byte, ptr interface{})
- func (s Subspace) GetParamSet(ctx sdk.Context, ps ParamSet)
- func (s Subspace) GetParamSetIfExists(ctx sdk.Context, ps ParamSet)
- func (s Subspace) GetRaw(ctx sdk.Context, key []byte) []byte
- func (s Subspace) Has(ctx sdk.Context, key []byte) bool
- func (s Subspace) HasKeyTable() bool
- func (s Subspace) Modified(ctx sdk.Context, key []byte) bool
- func (s Subspace) Name() string
- func (s Subspace) Set(ctx sdk.Context, key []byte, value interface{})
- func (s Subspace) SetParamSet(ctx sdk.Context, ps ParamSet)
- func (s Subspace) SetRaw(ctx sdk.Context, key []byte, value []byte)
- func (s Subspace) Update(ctx sdk.Context, key, value []byte) error
- func (s Subspace) Validate(ctx sdk.Context, key []byte, value interface{}) error
- func (s Subspace) WithKeyTable(table KeyTable) Subspace
- type SubspaceParamsResponse
- type ValueValidatorFn
Constants ¶
const ( // ModuleName defines the module name ModuleName = "params" // QuerierRoute defines the module's query routing key QuerierRoute = ModuleName )
const ( // StoreKey is the string store key for the param store StoreKey = "params" // TStoreKey is the string store key for the param transient store TStoreKey = "transient_params" )
const (
QueryParams = "params"
)
Querier path constants
Variables ¶
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var ParamStoreKeyCosmosGasParams = []byte("CosmosGasParams")
var ParamStoreKeyFeesParams = []byte("FeesParams")
Functions ¶
This section is empty.
Types ¶
type CosmosGasParams ¶
type CosmosGasParams struct {
CosmosGasMultiplierNumerator uint64 `` /* 157-byte string literal not displayed */
CosmosGasMultiplierDenominator uint64 `` /* 163-byte string literal not displayed */
}
func DefaultCosmosGasParams ¶
func DefaultCosmosGasParams() *CosmosGasParams
func NewCosmosGasParams ¶
func NewCosmosGasParams(multiplierNumerator uint64, multiplierDenominator uint64) CosmosGasParams
func (*CosmosGasParams) Descriptor ¶
func (*CosmosGasParams) Descriptor() ([]byte, []int)
func (*CosmosGasParams) Equal ¶
func (this *CosmosGasParams) Equal(that interface{}) bool
func (*CosmosGasParams) GetCosmosGasMultiplierDenominator ¶
func (m *CosmosGasParams) GetCosmosGasMultiplierDenominator() uint64
func (*CosmosGasParams) GetCosmosGasMultiplierNumerator ¶
func (m *CosmosGasParams) GetCosmosGasMultiplierNumerator() uint64
func (*CosmosGasParams) Marshal ¶
func (m *CosmosGasParams) Marshal() (dAtA []byte, err error)
func (*CosmosGasParams) MarshalToSizedBuffer ¶
func (m *CosmosGasParams) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CosmosGasParams) ProtoMessage ¶
func (*CosmosGasParams) ProtoMessage()
func (*CosmosGasParams) Reset ¶
func (m *CosmosGasParams) Reset()
func (*CosmosGasParams) Size ¶
func (m *CosmosGasParams) Size() (n int)
func (*CosmosGasParams) String ¶
func (m *CosmosGasParams) String() string
func (*CosmosGasParams) Unmarshal ¶
func (m *CosmosGasParams) Unmarshal(dAtA []byte) error
func (*CosmosGasParams) Validate ¶
func (cg *CosmosGasParams) Validate() error
func (*CosmosGasParams) XXX_DiscardUnknown ¶
func (m *CosmosGasParams) XXX_DiscardUnknown()
func (*CosmosGasParams) XXX_Marshal ¶
func (m *CosmosGasParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CosmosGasParams) XXX_Merge ¶
func (m *CosmosGasParams) XXX_Merge(src proto.Message)
func (*CosmosGasParams) XXX_Size ¶
func (m *CosmosGasParams) XXX_Size() int
func (*CosmosGasParams) XXX_Unmarshal ¶
func (m *CosmosGasParams) XXX_Unmarshal(b []byte) error
type FeesParams ¶
type FeesParams struct {
GlobalMinimumGasPrices github_com_cosmos_cosmos_sdk_types.DecCoins `` /* 184-byte string literal not displayed */
AllowedFeeDenoms []string `protobuf:"bytes,2,rep,name=allowed_fee_denoms,json=allowedFeeDenoms,proto3" json:"allowed_fee_denoms,omitempty"`
}
Defines fee params that are controlled through governance
func DefaultFeesParams ¶
func DefaultFeesParams() *FeesParams
func NewFeesParams ¶
func NewFeesParams(minGasPrices sdk.DecCoins) FeesParams
func (*FeesParams) Descriptor ¶
func (*FeesParams) Descriptor() ([]byte, []int)
func (*FeesParams) Equal ¶
func (this *FeesParams) Equal(that interface{}) bool
func (*FeesParams) GetAllowedFeeDenoms ¶
func (m *FeesParams) GetAllowedFeeDenoms() []string
func (*FeesParams) GetGlobalMinimumGasPrices ¶
func (m *FeesParams) GetGlobalMinimumGasPrices() github_com_cosmos_cosmos_sdk_types.DecCoins
func (*FeesParams) Marshal ¶
func (m *FeesParams) Marshal() (dAtA []byte, err error)
func (*FeesParams) MarshalToSizedBuffer ¶
func (m *FeesParams) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*FeesParams) ProtoMessage ¶
func (*FeesParams) ProtoMessage()
func (*FeesParams) Reset ¶
func (m *FeesParams) Reset()
func (*FeesParams) Size ¶
func (m *FeesParams) Size() (n int)
func (*FeesParams) String ¶
func (m *FeesParams) String() string
func (*FeesParams) Unmarshal ¶
func (m *FeesParams) Unmarshal(dAtA []byte) error
func (*FeesParams) Validate ¶
func (fp *FeesParams) Validate() error
func (*FeesParams) XXX_DiscardUnknown ¶
func (m *FeesParams) XXX_DiscardUnknown()
func (*FeesParams) XXX_Marshal ¶
func (m *FeesParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FeesParams) XXX_Merge ¶
func (m *FeesParams) XXX_Merge(src proto.Message)
func (*FeesParams) XXX_Size ¶
func (m *FeesParams) XXX_Size() int
func (*FeesParams) XXX_Unmarshal ¶
func (m *FeesParams) XXX_Unmarshal(b []byte) error
type GenesisState ¶
type GenesisState struct {
FeesParams FeesParams `protobuf:"bytes,1,opt,name=fees_params,json=feesParams,proto3" json:"fees_params"`
CosmosGasParams CosmosGasParams `protobuf:"bytes,2,opt,name=cosmos_gas_params,json=cosmosGasParams,proto3" json:"cosmos_gas_params"`
}
func DefaultGenesis ¶
func DefaultGenesis() *GenesisState
DefaultGenesis returns the default Capability genesis state
func NewGenesisState ¶
func NewGenesisState(feesParams FeesParams, cosmosGasParams CosmosGasParams) *GenesisState
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) Equal ¶
func (this *GenesisState) Equal(that interface{}) bool
func (*GenesisState) GetCosmosGasParams ¶
func (m *GenesisState) GetCosmosGasParams() CosmosGasParams
func (*GenesisState) GetFeesParams ¶
func (m *GenesisState) GetFeesParams() FeesParams
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalToSizedBuffer ¶
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶
func (m *GenesisState) Unmarshal(dAtA []byte) error
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
func (*GenesisState) XXX_DiscardUnknown ¶
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Merge ¶
func (m *GenesisState) XXX_Merge(src proto.Message)
func (*GenesisState) XXX_Size ¶
func (m *GenesisState) XXX_Size() int
func (*GenesisState) XXX_Unmarshal ¶
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type KeyTable ¶
type KeyTable struct {
// contains filtered or unexported fields
}
KeyTable subspaces appropriate type for each parameter key
func NewKeyTable ¶
func NewKeyTable(pairs ...ParamSetPair) KeyTable
func (KeyTable) RegisterParamSet ¶
RegisterParamSet registers multiple ParamSetPairs from a ParamSet in a KeyTable.
func (KeyTable) RegisterType ¶
func (t KeyTable) RegisterType(psp ParamSetPair) KeyTable
RegisterType registers a single ParamSetPair (key-type pair) in a KeyTable.
type ParamSet ¶
type ParamSet interface {
ParamSetPairs() ParamSetPairs
}
ParamSet defines an interface for structs containing parameters for a module
type ParamSetPair ¶
type ParamSetPair struct {
Key []byte
Value interface{}
ValidatorFn ValueValidatorFn
}
ParamSetPair is used for associating paramsubspace key and field of param structs.
func NewParamSetPair ¶
func NewParamSetPair(key []byte, value interface{}, vfn ValueValidatorFn) ParamSetPair
NewParamSetPair creates a new ParamSetPair instance.
type QuerySubspaceParams ¶
QuerySubspaceParams defines the params for querying module params by a given subspace and key.
func NewQuerySubspaceParams ¶
func NewQuerySubspaceParams(ss, key string) QuerySubspaceParams
type ReadOnlySubspace ¶
type ReadOnlySubspace struct {
// contains filtered or unexported fields
}
Wrapper of Subspace, provides immutable functions only
func (ReadOnlySubspace) Get ¶
func (ros ReadOnlySubspace) Get(ctx sdk.Context, key []byte, ptr interface{})
Get delegates a read-only Get call to the Subspace.
func (ReadOnlySubspace) GetRaw ¶
func (ros ReadOnlySubspace) GetRaw(ctx sdk.Context, key []byte) []byte
GetRaw delegates a read-only GetRaw call to the Subspace.
func (ReadOnlySubspace) Has ¶
func (ros ReadOnlySubspace) Has(ctx sdk.Context, key []byte) bool
Has delegates a read-only Has call to the Subspace.
func (ReadOnlySubspace) Modified ¶
func (ros ReadOnlySubspace) Modified(ctx sdk.Context, key []byte) bool
Modified delegates a read-only Modified call to the Subspace.
func (ReadOnlySubspace) Name ¶
func (ros ReadOnlySubspace) Name() string
Name delegates a read-only Name call to the Subspace.
type Subspace ¶
type Subspace struct {
// contains filtered or unexported fields
}
Individual parameter store for each keeper Transient store persists for a block, so we use it for recording whether the parameter has been changed or not
func NewSubspace ¶
func NewSubspace(cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key sdk.StoreKey, tkey sdk.StoreKey, name string) Subspace
NewSubspace constructs a store with namestore
func (Subspace) Get ¶
Get queries for a parameter by key from the Subspace's KVStore and sets the value to the provided pointer. If the value does not exist, it will panic.
func (Subspace) GetIfExists ¶
GetIfExists queries for a parameter by key from the Subspace's KVStore and sets the value to the provided pointer. If the value does not exist, it will perform a no-op.
func (Subspace) GetParamSet ¶
GetParamSet iterates through each ParamSetPair where for each pair, it will retrieve the value and set it to the corresponding value pointer provided in the ParamSetPair by calling Subspace#Get.
func (Subspace) GetParamSetIfExists ¶
GetParamSetIfExists iterates through each ParamSetPair where for each pair, it will retrieve the value and set it to the corresponding value pointer provided in the ParamSetPair by calling Subspace#GetIfExists.
func (Subspace) HasKeyTable ¶
HasKeyTable returns if the Subspace has a KeyTable registered.
func (Subspace) Modified ¶
Modified returns true if the parameter key is set in the Subspace's transient KVStore.
func (Subspace) Set ¶
Set stores a value for given a parameter key assuming the parameter type has been registered. It will panic if the parameter type has not been registered or if the value cannot be encoded. A change record is also set in the Subspace's transient KVStore to mark the parameter as modified.
func (Subspace) SetParamSet ¶
SetParamSet iterates through each ParamSetPair and sets the value with the corresponding parameter key in the Subspace's KVStore.
func (Subspace) Update ¶
Update stores an updated raw value for a given parameter key assuming the parameter type has been registered. It will panic if the parameter type has not been registered or if the value cannot be encoded. An error is returned if the raw value is not compatible with the registered type for the parameter key or if the new value is invalid as determined by the registered type's validation function.
func (Subspace) Validate ¶
Validate attempts to validate a parameter value by its key. If the key is not registered or if the validation of the value fails, an error is returned.
func (Subspace) WithKeyTable ¶
WithKeyTable initializes KeyTable and returns modified Subspace
type SubspaceParamsResponse ¶
SubspaceParamsResponse defines the response for quering parameters by subspace.
func NewSubspaceParamsResponse ¶
func NewSubspaceParamsResponse(ss, key, value string) SubspaceParamsResponse
type ValueValidatorFn ¶
type ValueValidatorFn func(value interface{}) error