types

package
v1.5.32 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Minter  = "minter"
	Burner  = "burner"
	Staking = "staking"
)

permissions

View Source
const ModuleName = "supply"

Variables

View Source
var (
	SupplyKey           = []byte{0x00}
	BalancesPrefix      = []byte("balances")
	DenomMetadataPrefix = []byte{0x1}
)
View Source
var ModuleCdc *codec.Codec

Functions

func DefaultSupply

func DefaultSupply() exported.SupplyI

DefaultSupply creates an empty Supply

func DenomMetadataKey

func DenomMetadataKey(denom string) []byte

DenomMetadataKey returns the denomination metadata key.

func NewModuleAddress

func NewModuleAddress(name string) types.AccAddress

func NewSupply

func NewSupply(total sdk.Coins) exported.SupplyI

NewSupply creates a new Supply instance

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the account types and interface

Types

type DenomUnit

type DenomUnit struct {
	// denom represents the string name of the given denom unit (e.g uatom).
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// exponent represents power of 10 exponent that one must
	// raise the base_denom to in order to equal the given DenomUnit's denom
	// 1 denom = 1^exponent base_denom
	// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
	// exponent = 6, thus: 1 atom = 10^6 uatom).
	Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"`
	// aliases is a list of string aliases for the given denom
	Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"`
}

type GenesisState

type GenesisState struct {
	Supply sdk.Coins `json:"supply"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func NewGenesisState

func NewGenesisState(supply sdk.Coins) GenesisState

NewGenesisState creates a new genesis state.

type Metadata

type Metadata struct {
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
	// denom_units represents the list of DenomUnit's for a given coin
	DenomUnits []*DenomUnit `protobuf:"bytes,2,rep,name=denom_units,json=denomUnits,proto3" json:"denom_units,omitempty"`
	// base represents the base denom (should be the DenomUnit with exponent = 0).
	Base string `protobuf:"bytes,3,opt,name=base,proto3" json:"base,omitempty"`
	// display indicates the suggested denom that should be
	// displayed in clients.
	Display string `protobuf:"bytes,4,opt,name=display,proto3" json:"display,omitempty"`
}

type ModuleAccount

type ModuleAccount struct {
	*account.BaseAccount

	Name        string   `json:"name" yaml:"name"`
	Permissions []string `json:"permissions" yaml:"permissions"`
}

func NewEmptyModuleAccount

func NewEmptyModuleAccount(name string, permissions ...string) *ModuleAccount

func (ModuleAccount) GetName

func (macc ModuleAccount) GetName() string

func (ModuleAccount) GetPermissions

func (macc ModuleAccount) GetPermissions() []string

func (ModuleAccount) HasPermission

func (macc ModuleAccount) HasPermission(perm string) bool

type PermissionsForAddress

type PermissionsForAddress struct {
	// contains filtered or unexported fields
}

func NewPermissionForAddress

func NewPermissionForAddress(name string, permissions []string) PermissionsForAddress

func (PermissionsForAddress) GetAddress

func (pa PermissionsForAddress) GetAddress() sdk.AccAddress

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 Supply

type Supply struct {
	Total sdk.Coins `json:"total"` // total supply of tokens registered on the chain
}

func (Supply) Deflate

func (supply Supply) Deflate(amount sdk.Coins) exported.SupplyI

Deflate subtracts coins from the total supply

func (Supply) GetTotal

func (supply Supply) GetTotal() sdk.Coins

GetTotal returns the supply total.

func (Supply) Inflate

func (supply Supply) Inflate(amount sdk.Coins) exported.SupplyI

Inflate adds coins to the total supply

func (Supply) SetTotal

func (supply Supply) SetTotal(total sdk.Coins) exported.SupplyI

SetTotal sets the total supply.

func (Supply) String

func (supply Supply) String() string

String returns a human readable string representation of a supplier.

func (Supply) ValidateBasic

func (supply Supply) ValidateBasic() error

ValidateBasic validates the Supply coins and returns error if invalid

Jump to

Keyboard shortcuts

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