types

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 11 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 NewModuleAccountFromBaseAccount added in v1.5.70

func NewModuleAccountFromBaseAccount(acc *types2.BaseAccount, name string, permissions ...string) *ModuleAccount

func (ModuleAccount) GetAccountNumber added in v1.5.53

func (macc ModuleAccount) GetAccountNumber() uint64

func (ModuleAccount) GetAddress added in v1.5.53

func (macc ModuleAccount) GetAddress() types.AccAddress

func (ModuleAccount) GetCodeHash added in v1.5.53

func (macc ModuleAccount) GetCodeHash() []byte

func (ModuleAccount) GetCoins added in v1.5.53

func (macc ModuleAccount) GetCoins() types.Coins

func (ModuleAccount) GetContractType added in v1.5.53

func (macc ModuleAccount) GetContractType() string

func (ModuleAccount) GetIsModule added in v1.5.53

func (macc ModuleAccount) GetIsModule() bool

func (ModuleAccount) GetName

func (macc ModuleAccount) GetName() string

func (ModuleAccount) GetPermissions

func (macc ModuleAccount) GetPermissions() []string

func (ModuleAccount) GetPubKey added in v1.5.53

func (macc ModuleAccount) GetPubKey() crypto.PubKey

func (ModuleAccount) GetSequence added in v1.5.53

func (macc ModuleAccount) GetSequence() uint64

func (ModuleAccount) HasPermission

func (macc ModuleAccount) HasPermission(perm string) bool

func (*ModuleAccount) SetAccountNumber added in v1.5.53

func (macc *ModuleAccount) SetAccountNumber(n uint64) error

func (*ModuleAccount) SetAddress added in v1.5.53

func (macc *ModuleAccount) SetAddress(acc types.AccAddress) error

func (*ModuleAccount) SetCodeHash added in v1.5.53

func (macc *ModuleAccount) SetCodeHash(hash []byte)

func (*ModuleAccount) SetCoins added in v1.5.53

func (macc *ModuleAccount) SetCoins(c types.Coins) error

func (*ModuleAccount) SetContractType added in v1.5.53

func (macc *ModuleAccount) SetContractType(c string) error

func (ModuleAccount) SetIsModule added in v1.5.53

func (macc ModuleAccount) SetIsModule(flag bool) error

func (*ModuleAccount) SetPermissions added in v1.5.70

func (macc *ModuleAccount) SetPermissions(perms []string)

func (*ModuleAccount) SetPubKey added in v1.5.53

func (macc *ModuleAccount) SetPubKey(key crypto.PubKey) error

func (*ModuleAccount) SetSequence added in v1.5.53

func (macc *ModuleAccount) SetSequence(s uint64) error

func (ModuleAccount) SpendableCoins added in v1.5.53

func (macc ModuleAccount) SpendableCoins(bt time.Time) types.Coins

func (ModuleAccount) String added in v1.5.53

func (macc ModuleAccount) String() string

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