Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type Admin
- type Error
- type GenesisState
- type Measure
- type MeterAccount
- type MsgCreateMeterAccount
- type MsgSetAdmin
- type MsgSetMeasure
- type MsgSetParameters
- type MsgTokensMinting
- type ParamSubspace
- type Parameters
- type Params
- type QueryResAdmin
- type QueryResAllowed
- type QueryResGetMeterId
- type QueryResMeasures
- type QueryResParameters
- type TokensMinting
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "ps" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey to be used for routing msgs RouterKey = ModuleName // QuerierRoute to be used for querier msgs QuerierRoute = ModuleName )
const (
AttributeValueCategory = ModuleName
)
ps module event types
const (
DefaultParamspace = ModuleName
)
Default parameter namespace
const (
MeterAccountPrefix = "meterAccount-"
)
const (
ParametersPrefix = "parameters-"
)
const (
QueryGetMeterId = "get-meterId"
)
const (
QueryListMeterAccount = "list-meterAccount"
)
const (
QueryListParameters = "list-parameters"
)
const (
TokenName = "ectoken"
)
Variables ¶
var (
ErrInvalid = sdkerrors.Register(ModuleName, 1, "custom error message")
)
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the ps genesis parameters
Types ¶
type Admin ¶
type Admin struct { Id string `json:"id"` Account sdk.AccAddress `json:"account"` }
Admin section
type GenesisState ¶
type GenesisState struct { }
GenesisState - all ps state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - default GenesisState used by Cosmos Hub
func NewGenesisState ¶
func NewGenesisState() GenesisState
NewGenesisState creates a new GenesisState object
type Measure ¶
type Measure struct { Signal string `json:"signal"` Timestamp string `json:"timestamp"` MeterId string `json:"meterId"` Value string `json:"value"` Account sdk.AccAddress `json:"account"` Cost sdk.Coins `json:"cost"` }
Measure section
func NewMeasure ¶
func NewMeasure() Measure
type MeterAccount ¶
type MeterAccount struct { Meter string `json:"meter" yaml:"meter"` Account sdk.AccAddress `json:"account" yaml:"account"` Admin sdk.AccAddress `json:"admin" yaml:"admin"` }
MeterAccount section
type MsgCreateMeterAccount ¶
type MsgCreateMeterAccount struct { Meter string `json:"meter" yaml:"meter"` Account sdk.AccAddress `json:"account" yaml:"account"` Admin sdk.AccAddress `json:"admin" yaml:"admin"` }
func NewMsgCreateMeterAccount ¶
func NewMsgCreateMeterAccount(meter string, account sdk.AccAddress, admin sdk.AccAddress) MsgCreateMeterAccount
func (MsgCreateMeterAccount) GetSignBytes ¶
func (msg MsgCreateMeterAccount) GetSignBytes() []byte
func (MsgCreateMeterAccount) GetSigners ¶
func (msg MsgCreateMeterAccount) GetSigners() []sdk.AccAddress
func (MsgCreateMeterAccount) Route ¶
func (msg MsgCreateMeterAccount) Route() string
func (MsgCreateMeterAccount) Type ¶
func (msg MsgCreateMeterAccount) Type() string
func (MsgCreateMeterAccount) ValidateBasic ¶
func (msg MsgCreateMeterAccount) ValidateBasic() error
type MsgSetAdmin ¶
type MsgSetAdmin struct { Id string `json:"Id"` Account sdk.AccAddress `json:"account"` }
func NewMsgSetAdmin ¶
func NewMsgSetAdmin(id string, account sdk.AccAddress) MsgSetAdmin
NewMsgNewMeasure is a constructor function for MsgNewMeasure
func (MsgSetAdmin) GetSignBytes ¶
func (msg MsgSetAdmin) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgSetAdmin) GetSigners ¶
func (msg MsgSetAdmin) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgSetAdmin) Route ¶
func (msg MsgSetAdmin) Route() string
Route should return the name of the module
func (MsgSetAdmin) ValidateBasic ¶
func (msg MsgSetAdmin) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgSetMeasure ¶
type MsgSetMeasure struct { Signal string `json:"signal"` Timestamp string `json:"timestamp"` MeterId string `json:"meterId"` Value string `json:"value"` Account sdk.AccAddress `json:"account"` }
func NewMsgSetMeasure ¶
func NewMsgSetMeasure(signal string, timestamp string, meterId string, value string, account sdk.AccAddress) MsgSetMeasure
NewMsgNewMeasure is a constructor function for MsgNewMeasure
func (MsgSetMeasure) GetSignBytes ¶
func (msg MsgSetMeasure) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgSetMeasure) GetSigners ¶
func (msg MsgSetMeasure) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgSetMeasure) Route ¶
func (msg MsgSetMeasure) Route() string
Route should return the name of the module
func (MsgSetMeasure) ValidateBasic ¶
func (msg MsgSetMeasure) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgSetParameters ¶
type MsgSetParameters struct { ID string Creator sdk.AccAddress `json:"creator" yaml:"creator"` ProdConvFactor string `json:"prodConvFactor" yaml:"prodConvFactor"` ConsConvFactor string `json:"consConvFactor" yaml:"consConvFactor"` MaxConsumption string `json:"maxConsumption" yaml:"maxConsumption"` Penalty string `json:"penalty" yaml:"penalty"` }
func NewMsgSetParameters ¶
func NewMsgSetParameters(creator sdk.AccAddress, prodConvFactor string, consConvFactor string, maxConsumption string, penalty string) MsgSetParameters
func (MsgSetParameters) GetSignBytes ¶
func (msg MsgSetParameters) GetSignBytes() []byte
func (MsgSetParameters) GetSigners ¶
func (msg MsgSetParameters) GetSigners() []sdk.AccAddress
func (MsgSetParameters) Route ¶
func (msg MsgSetParameters) Route() string
func (MsgSetParameters) Type ¶
func (msg MsgSetParameters) Type() string
func (MsgSetParameters) ValidateBasic ¶
func (msg MsgSetParameters) ValidateBasic() error
type MsgTokensMinting ¶
type MsgTokensMinting struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"` Minter sdk.AccAddress `json:"minter" yaml:"minter"` }
func NewMsgTokensMinting ¶
func NewMsgTokensMinting(amount sdk.Coins, recipient sdk.AccAddress, minter sdk.AccAddress) MsgTokensMinting
NewMsgNewMeasure is a constructor function for MsgNewMeasure
func (MsgTokensMinting) GetSignBytes ¶
func (msg MsgTokensMinting) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgTokensMinting) GetSigners ¶
func (msg MsgTokensMinting) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgTokensMinting) Route ¶
func (msg MsgTokensMinting) Route() string
Route should return the name of the module
func (MsgTokensMinting) Type ¶
func (msg MsgTokensMinting) Type() string
Type should return the action
func (MsgTokensMinting) ValidateBasic ¶
func (msg MsgTokensMinting) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interfacace
type Parameters ¶
type Parameters struct { Creator sdk.AccAddress `json:"creator" yaml:"creator"` ProdConvFactor string `json:"prodConvFactor" yaml:"prodConvFactor"` ConsConvFactor string `json:"consConvFactor" yaml:"consConvFactor"` MaxConsumption string `json:"maxConsumption" yaml:"maxConsumption"` Penalty string `json:"penalty" yaml:"penalty"` }
Parameters section
func NewParameters ¶
func NewParameters() Parameters
type Params ¶
type Params struct { }
Params - used for initializing default parameter for ps at genesis
func DefaultParams ¶
func DefaultParams() Params
DefaultParams defines the parameters for this module
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs - Implements params.ParamSet
type QueryResGetMeterId ¶
type QueryResGetMeterId []string
QueryResGetMeterId Queries
func (QueryResGetMeterId) String ¶
func (n QueryResGetMeterId) String() string
implement fmt.Stringer
type QueryResParameters ¶
type QueryResParameters []string
QueryResParameters Queries
func (QueryResParameters) String ¶
func (n QueryResParameters) String() string
implement fmt.Stringer
type TokensMinting ¶
type TokensMinting struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"` Minter sdk.AccAddress `json:"minter" yaml:"minter"` }
TokensMinting section
func NewTokensMinting ¶
func NewTokensMinting() TokensMinting