keeper

package
v1.7.2-gon-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the MT module.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MT MsgServer interface for the provided Keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all supply invariants

func SupplyInvariant

func SupplyInvariant(k Keeper) sdk.Invariant

SupplyInvariant checks that the total amount of MTs on collections matches the total amount owned by addresses

Types

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey) Keeper

NewKeeper creates a new instance of the MT Keeper

func (Keeper) AddBalance

func (k Keeper) AddBalance(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	addr sdk.AccAddress) error

AddBalance adds amounts to an account

func (Keeper) Authorize

func (k Keeper) Authorize(ctx sdk.Context, denomID string, owner sdk.AccAddress) error

Authorize checks if the sender is the owner of the given denom

func (Keeper) Balances

func (Keeper) BurnMT

func (k Keeper) BurnMT(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	owner sdk.AccAddress) error

BurnMT burn amounts of MT from a owner

func (Keeper) Denom

func (Keeper) Denoms

func (Keeper) EditMT

func (k Keeper) EditMT(ctx sdk.Context,
	denomID, mtID string,
	metadata []byte,
	sender sdk.AccAddress,
) error

EditMT updates an existing MT

func (Keeper) ExportGenesisState

func (k Keeper) ExportGenesisState(ctx sdk.Context) *types.GenesisState

func (Keeper) GetBalance

func (k Keeper) GetBalance(ctx sdk.Context,
	denomID, mtID string,
	addr sdk.AccAddress) uint64

GetBalance gets balance of an MT

func (Keeper) GetDenom

func (k Keeper) GetDenom(ctx sdk.Context, id string) (denom types.Denom, found bool)

GetDenom returns the denom by id

func (Keeper) GetDenomSequence

func (k Keeper) GetDenomSequence(ctx sdk.Context) uint64

GetDenomSequence gets the next denom sequence from the store.

func (Keeper) GetDenomSupply

func (k Keeper) GetDenomSupply(ctx sdk.Context, denomID string) uint64

GetDenomSupply returns the number of Mts by the specified denom ID

func (Keeper) GetDenoms

func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []types.Denom)

GetDenoms returns all the denoms

func (Keeper) GetMT

func (k Keeper) GetMT(ctx sdk.Context, denomID, mtID string) (mt exported.MT, err error)

GetMT gets the the specified MT

func (Keeper) GetMTSequence

func (k Keeper) GetMTSequence(ctx sdk.Context) uint64

GetMTSequence gets the next MT sequence from the store.

func (Keeper) GetMTSupply

func (k Keeper) GetMTSupply(ctx sdk.Context, denomID, mtID string) uint64

GetMTSupply returns the supply of a specified MT

func (Keeper) GetMTs

func (k Keeper) GetMTs(ctx sdk.Context, denomID string) (mts []exported.MT)

GetMTs returns all MTs by the specified denom ID

func (Keeper) HasDenom

func (k Keeper) HasDenom(ctx sdk.Context, id string) bool

HasDenom returns whether the specified denom ID exists

func (Keeper) HasMT

func (k Keeper) HasMT(ctx sdk.Context, denomID, mtID string) bool

HasMT checks if the specified MT exists

func (Keeper) IncreaseDenomSupply

func (k Keeper) IncreaseDenomSupply(ctx sdk.Context, denomID string)

IncreaseDenomSupply increase total supply (count of MTs) of a denom

func (Keeper) IncreaseMTSupply

func (k Keeper) IncreaseMTSupply(ctx sdk.Context, denomID, mtID string, amount uint64) error

IncreaseMTSupply increase total supply of an MT

func (Keeper) IssueDenom

func (k Keeper) IssueDenom(ctx sdk.Context,
	id, name string, sender sdk.AccAddress, data []byte,
) types.Denom

IssueDenom issues a denom according to the given params

func (Keeper) IssueMT

func (k Keeper) IssueMT(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	data []byte,
	recipient sdk.AccAddress,
) (types.MT, error)

IssueMT issues a new MT

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MT

func (Keeper) MTSupply

func (Keeper) MTs

func (Keeper) MintMT

func (k Keeper) MintMT(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	recipient sdk.AccAddress,
) error

MintMT mints amounts of an existing MT

func (Keeper) SetDenom

func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom)

SetDenom is responsible for saving the definition of denom

func (Keeper) SetDenomSequence

func (k Keeper) SetDenomSequence(ctx sdk.Context, sequence uint64)

SetDenomSequence sets the next denom sequence to the store.

func (Keeper) SetMT

func (k Keeper) SetMT(ctx sdk.Context, denomID string, mt types.MT)

SetMT set the MT to store

func (Keeper) SetMTSequence

func (k Keeper) SetMTSequence(ctx sdk.Context, sequence uint64)

SetMTSequence sets the next MT sequence to the store.

func (Keeper) SubBalance

func (k Keeper) SubBalance(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	addr sdk.AccAddress)

SubBalance subs amounts from an account

func (Keeper) Transfer

func (k Keeper) Transfer(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	from, to sdk.AccAddress) error

Transfer transfers mts

func (Keeper) TransferDenomOwner

func (k Keeper) TransferDenomOwner(
	ctx sdk.Context, denomID string, srcOwner, dstOwner sdk.AccAddress,
) error

TransferDenomOwner transfers the ownership of the given denom to the new owner

func (Keeper) TransferOwner

func (k Keeper) TransferOwner(ctx sdk.Context,
	denomID, mtID string,
	amount uint64,
	srcOwner, dstOwner sdk.AccAddress,
) error

TransferOwner transfers the ownership of the given MT to the new owner

func (Keeper) UpdateDenom

func (k Keeper) UpdateDenom(ctx sdk.Context, denom types.Denom) error

UpdateDenom is responsible for updating the definition of denom

Jump to

Keyboard shortcuts

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