Documentation ¶
Index ¶
- Constants
- Variables
- func AccountProcessor(ga *authTypes.GenesisAccount, ba *authTypes.BaseAccount) authExported.Account
- func ErrNoAccountCreated(codespace sdk.CodespaceType) sdk.Error
- func ErrNoPermission(codespace sdk.CodespaceType) sdk.Error
- func NewModuleAddress(name string) types.HeimdallAddress
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type ModuleAccount
- func (ma *ModuleAccount) AddPermissions(permissions ...string)
- func (ma ModuleAccount) GetName() string
- func (ma ModuleAccount) GetPermissions() []string
- func (ma ModuleAccount) HasPermission(permission string) bool
- func (ma ModuleAccount) MarshalYAML() (interface{}, error)
- func (ma *ModuleAccount) RemovePermission(permission string) error
- func (ma ModuleAccount) SetPubKey(pubKey crypto.PubKey) error
- func (ma ModuleAccount) SetSequence(seq uint64) error
- func (ma ModuleAccount) String() string
- type ModuleAccountInterface
- type PermissionsForAddress
- type QuerySupplyOfParams
- type QueryTotalSupplyParams
- type Supply
Constants ¶
const ( CodeNoAccountCreated sdk.CodeType = 2000 CodeNoPermission sdk.CodeType = 2001 )
supply errors reserve 2000 ~ 2100.
const ( // ModuleName is the name of the module ModuleName = "supply" // StoreKey is the store key string for supply StoreKey = ModuleName // RouterKey is the message route for supply RouterKey = ModuleName // QuerierRoute is the querier route for supply QuerierRoute = ModuleName // DefaultParamspace default name for parameter store DefaultParamspace = ModuleName // DefaultCodespace code space DefaultCodespace sdk.CodespaceType = ModuleName )
const ( Minter = "minter" Burner = "burner" Staking = "staking" )
permissions
const ( QueryTotalSupply = "total_supply" QuerySupplyOf = "supply_of" )
query endpoints supported by the supply Querier
Variables ¶
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func AccountProcessor ¶
func AccountProcessor(ga *authTypes.GenesisAccount, ba *authTypes.BaseAccount) authExported.Account
AccountProcessor process supply's module account
func ErrNoAccountCreated ¶
func ErrNoAccountCreated(codespace sdk.CodespaceType) sdk.Error
ErrNoAccountCreated is an error
func ErrNoPermission ¶
func ErrNoPermission(codespace sdk.CodespaceType) sdk.Error
ErrNoPermission is an error
func NewModuleAddress ¶
func NewModuleAddress(name string) types.HeimdallAddress
NewModuleAddress creates an AccAddress from the hash of the module's name
func RegisterCodec ¶
RegisterCodec registers the account types and interface
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of supply genesis data returning an error for any failed validation criteria.
Types ¶
type GenesisState ¶
type GenesisState struct {
Supply Supply `json:"supply" yaml:"supply"`
}
GenesisState is the supply state that must be provided at genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func NewGenesisState ¶
func NewGenesisState(supply Supply) GenesisState
NewGenesisState creates a new genesis state.
type ModuleAccount ¶
type ModuleAccount struct { *authTypes.BaseAccount Name string `json:"name" yaml:"name"` // name of the module Permissions []string `json:"permissions" yaml:"permissions"` // permissions of module account }
ModuleAccount defines an account for modules that holds coins on a pool
func NewEmptyModuleAccount ¶
func NewEmptyModuleAccount(name string, permissions ...string) *ModuleAccount
NewEmptyModuleAccount creates empty module account
func NewModuleAccount ¶
func NewModuleAccount(ba *authTypes.BaseAccount, name string, permissions ...string) *ModuleAccount
NewModuleAccount creates a new ModuleAccount instance
func (*ModuleAccount) AddPermissions ¶
func (ma *ModuleAccount) AddPermissions(permissions ...string)
AddPermissions adds the permissions to the module account's list of granted permissions.
func (ModuleAccount) GetName ¶
func (ma ModuleAccount) GetName() string
GetName returns the name of the holder's module
func (ModuleAccount) GetPermissions ¶
func (ma ModuleAccount) GetPermissions() []string
GetPermissions returns permissions granted to the module account
func (ModuleAccount) HasPermission ¶
func (ma ModuleAccount) HasPermission(permission string) bool
HasPermission returns whether or not the module account has permission.
func (ModuleAccount) MarshalYAML ¶
func (ma ModuleAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of a ModuleAccount.
func (*ModuleAccount) RemovePermission ¶
func (ma *ModuleAccount) RemovePermission(permission string) error
RemovePermission removes the permission from the list of granted permissions or returns an error if the permission has not been granted.
func (ModuleAccount) SetPubKey ¶
func (ma ModuleAccount) SetPubKey(pubKey crypto.PubKey) error
SetPubKey - Implements Account
func (ModuleAccount) SetSequence ¶
func (ma ModuleAccount) SetSequence(seq uint64) error
SetSequence - Implements Account
func (ModuleAccount) String ¶
func (ma ModuleAccount) String() string
String follows stringer interface
type ModuleAccountInterface ¶
type ModuleAccountInterface = exported.ModuleAccountI
ModuleAccountInterface exported module account interface
type PermissionsForAddress ¶
type PermissionsForAddress struct {
// contains filtered or unexported fields
}
PermissionsForAddress defines all the registered permissions for an address
func NewPermissionsForAddress ¶
func NewPermissionsForAddress(name string, permissions []string) PermissionsForAddress
NewPermissionsForAddress creates a new PermissionsForAddress object
func (PermissionsForAddress) GetAddress ¶
func (pa PermissionsForAddress) GetAddress() types.HeimdallAddress
GetAddress returns the address of the PermissionsForAddress object
func (PermissionsForAddress) GetPermissions ¶
func (pa PermissionsForAddress) GetPermissions() []string
GetPermissions returns the permissions granted to the address
func (PermissionsForAddress) HasPermission ¶
func (pa PermissionsForAddress) HasPermission(permission string) bool
HasPermission returns whether the PermissionsForAddress contains permission.
type QuerySupplyOfParams ¶
type QuerySupplyOfParams struct {
Denom string
}
QuerySupplyOfParams defines the params for the following queries:
- 'custom/supply/totalSupplyOf'
func NewQuerySupplyOfParams ¶
func NewQuerySupplyOfParams(denom string) QuerySupplyOfParams
NewQuerySupplyOfParams creates a new instance to query the total supply of a given denomination
type QueryTotalSupplyParams ¶
type QueryTotalSupplyParams struct {
Page, Limit int
}
QueryTotalSupply defines the params for the following queries:
- 'custom/supply/totalSupply'
func NewQueryTotalSupplyParams ¶
func NewQueryTotalSupplyParams(page, limit int) QueryTotalSupplyParams
NewQueryTotalSupplyParams creates a new instance to query the total supply
type Supply ¶
type Supply struct {
Total sdk.Coins `json:"total" yaml:"total"` // total supply of tokens registered on the chain
}
Supply represents a struct that passively keeps track of the total supply amounts in the network
func (Supply) ValidateBasic ¶
ValidateBasic validates the Supply coins and returns error if invalid