types

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the module name constant used in many places
	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
)
View Source
const (
	Minter  = "minter"
	Burner  = "burner"
	Staking = "staking"
)

permissions

View Source
const (
	QueryTotalSupply = "total_supply"
	QuerySupplyOf    = "supply_of"
	QueryBurned      = "burned"
	QueryBurnedOf    = "burned_of"
)

query endpoints supported by the supply Querier

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func DefaultSupply

func DefaultSupply() exported.SupplyI

DefaultSupply creates an empty Supply

func NewModuleAddress

func NewModuleAddress(name string) sdk.CUAddress

NewModuleAddress creates an CUAddress from the hash of the module's name

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 CustodianUnit types and interface

Types

type CUKeeper

type CUKeeper interface {
	IterateCUs(ctx sdk.Context, process func(exported.CustodianUnit) (stop bool))
	GetCU(sdk.Context, sdk.CUAddress) exported.CustodianUnit
	SetCU(sdk.Context, exported.CustodianUnit)
	NewCU(sdk.Context, exported.CustodianUnit) exported.CustodianUnit
}

CUKeeper defines the expected CustodianUnit keeper (noalias)

type GenesisState

type GenesisState struct {
	Supply sdk.Coins `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 sdk.Coins) GenesisState

NewGenesisState creates a new genesis state.

type ModuleAccount

type ModuleAccount struct {
	*authtypes.BaseCU
	Name        string   `json:"name" yaml:"name"`               // name of the module
	Permissions []string `json:"permissions" yaml:"permissions"` // permissions of module CustodianUnit
}

ModuleAccount defines an CustodianUnit for modules that holds coins on a pool

func NewEmptyModuleAccount

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

func NewModuleAccount

func NewModuleAccount(ba *authtypes.BaseCU,
	name string, permissions ...string) *ModuleAccount

NewModuleAccount creates a new ModuleAccount instance

func (ModuleAccount) GetName

func (ma ModuleAccount) GetName() string

GetName returns the the name of the holder's module

func (ModuleAccount) GetPermissions

func (ma ModuleAccount) GetPermissions() []string

GetPermissions returns permissions granted to the module CustodianUnit

func (ModuleAccount) HasPermission

func (ma ModuleAccount) HasPermission(permission string) bool

HasPermission returns whether or not the module CustodianUnit has permission.

func (ModuleAccount) MarshalYAML

func (ma ModuleAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a ModuleAccount.

func (ModuleAccount) SetPubKey

func (ma ModuleAccount) SetPubKey(pubKey crypto.PubKey) error

SetPubKey - Implements CustodianUnit

func (ModuleAccount) SetSequence

func (ma ModuleAccount) SetSequence(seq uint64) error

SetSequence - Implements CustodianUnit

func (ModuleAccount) String

func (ma ModuleAccount) String() string

String follows stringer 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() sdk.CUAddress

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
	Burned sdk.Coins `json:"burned" yaml:"burned"`
}

Supply represents a struct that passively keeps track of the total supply amounts in the network

func (Supply) Deflate

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

Deflate subtracts coins from the total supply

func (Supply) GetBurned

func (supply Supply) GetBurned() sdk.Coins

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

type TransferKeeper

type TransferKeeper interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.CUAddress, toAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, []sdk.Flow, sdk.Error)
	DelegateCoins(ctx sdk.Context, fromAdd, toAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)
	UndelegateCoins(ctx sdk.Context, fromAddr, toAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)

	SubCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	AddCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
}

BankKeeper defines the expected bank keeper (noalias)

Jump to

Keyboard shortcuts

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