keeper

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 23 Imported by: 41

Documentation

Overview

nolint

Index

Constants

View Source
const (
	FeeFactorBase = 3
	FeeFactorExp  = 4
)

fee factor formula: (ln(len({name}))/ln{base})^{exp}

Variables

This section is empty.

Functions

func NewLegacyMsgServerImpl added in v1.7.3

func NewLegacyMsgServerImpl(server v1.MsgServer, k Keeper) v1beta1.MsgServer

NewLegacyMsgServerImpl returns an implementation of the token MsgServer interface for the provided Keeper.

func NewLegacyQueryServer added in v1.7.3

func NewLegacyQueryServer(server v1.QueryServer, cdc codec.Codec) v1beta1.QueryServer

NewLegacyQueryServer returns an implementation of the token QueryServer interface for the provided Keeper.

func NewMsgServerImpl added in v1.2.0

func NewMsgServerImpl(keeper Keeper) v1.MsgServer

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

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	key storetypes.StoreKey,
	bankKeeper types.BankKeeper,
	feeCollectorName string,
	authority string,
) Keeper

func (Keeper) AddBurnCoin added in v1.2.0

func (k Keeper) AddBurnCoin(ctx sdk.Context, coin sdk.Coin)

AddBurnCoin saves the total amount of the burned tokens

func (Keeper) AddToken

func (k Keeper) AddToken(ctx sdk.Context, token v1.Token) error

AddToken saves a new token

func (Keeper) BurnToken added in v1.2.0

func (k Keeper) BurnToken(
	ctx sdk.Context,
	coinBurnt sdk.Coin,
	owner sdk.AccAddress,
) error

BurnToken burns the specified amount of token

func (Keeper) Codec added in v1.7.3

func (k Keeper) Codec() codec.Codec

Codec returns a k.cdc.

func (Keeper) DeductIssueTokenFee

func (k Keeper) DeductIssueTokenFee(ctx sdk.Context, owner sdk.AccAddress, symbol string) error

DeductIssueTokenFee performs fee handling for issuing token

func (Keeper) DeductMintTokenFee

func (k Keeper) DeductMintTokenFee(ctx sdk.Context, owner sdk.AccAddress, symbol string) error

DeductMintTokenFee performs fee handling for minting token

func (Keeper) EditToken

func (k Keeper) EditToken(
	ctx sdk.Context,
	symbol string,
	name string,
	maxSupply uint64,
	mintable types.Bool,
	owner sdk.AccAddress,
) error

EditToken edits the specified token

func (Keeper) Fees

func (Keeper) GetAllBurnCoin added in v1.2.0

func (k Keeper) GetAllBurnCoin(ctx sdk.Context) []sdk.Coin

GetAllBurnCoin returns the total amount of all the burned tokens

func (Keeper) GetBurnCoin added in v1.2.0

func (k Keeper) GetBurnCoin(ctx sdk.Context, minUint string) (sdk.Coin, error)

GetBurnCoin returns the total amount of the burned tokens

func (Keeper) GetOwner added in v1.2.0

func (k Keeper) GetOwner(ctx sdk.Context, denom string) (sdk.AccAddress, error)

GetOwner returns the owner of the specified token

func (Keeper) GetParams added in v1.8.0

func (k Keeper) GetParams(ctx sdk.Context) (params v1.Params)

GetParams sets the token module parameters.

func (Keeper) GetToken

func (k Keeper) GetToken(ctx sdk.Context, denom string) (v1.TokenI, error)

GetToken returns the token of the specified symbol or min uint

func (Keeper) GetTokenIssueFee

func (k Keeper) GetTokenIssueFee(ctx sdk.Context, symbol string) (sdk.Coin, error)

GetTokenIssueFee returns the token issuance fee

func (Keeper) GetTokenMintFee

func (k Keeper) GetTokenMintFee(ctx sdk.Context, symbol string) (sdk.Coin, error)

GetTokenMintFee returns the token minting fee

func (Keeper) GetTokens

func (k Keeper) GetTokens(ctx sdk.Context, owner sdk.AccAddress) (tokens []v1.TokenI)

GetTokens returns all existing tokens

func (Keeper) HasSymbol added in v1.3.0

func (k Keeper) HasSymbol(ctx sdk.Context, symbol string) bool

HasSymbol asserts a token exists by symbol

func (Keeper) HasToken

func (k Keeper) HasToken(ctx sdk.Context, denom string) bool

HasToken asserts a token exists

func (Keeper) IssueToken

func (k Keeper) IssueToken(
	ctx sdk.Context,
	symbol string,
	name string,
	minUnit string,
	scale uint32,
	initialSupply uint64,
	maxSupply uint64,
	mintable bool,
	owner sdk.AccAddress,
) error

IssueToken issues a new token

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintToken

func (k Keeper) MintToken(
	ctx sdk.Context,
	coinMinted sdk.Coin,
	recipient sdk.AccAddress,
	owner sdk.AccAddress,
) error

MintToken mints the specified amount of token to the specified recipient NOTE: empty owner means that the external caller is responsible to manage the token authority

func (Keeper) Params

Params return the all the parameter in tonken module

func (Keeper) SetParams added in v1.8.0

func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error

SetParams sets the token module parameters.

func (Keeper) SwapFeeToken added in v1.7.3

func (k Keeper) SwapFeeToken(
	ctx sdk.Context,
	feePaid sdk.Coin,
	sender sdk.AccAddress,
	recipient sdk.AccAddress,
) (sdk.Coin, sdk.Coin, error)

SwapFeeToken swap the fee token

func (Keeper) Token

func (Keeper) Tokens

func (Keeper) TotalBurn added in v1.2.0

TotalBurn return the all burn coin

func (Keeper) TransferTokenOwner

func (k Keeper) TransferTokenOwner(
	ctx sdk.Context,
	symbol string,
	srcOwner sdk.AccAddress,
	dstOwner sdk.AccAddress,
) error

TransferTokenOwner transfers the owner of the specified token to a new one

func (Keeper) UnsafeTransferTokenOwner added in v1.7.3

func (k Keeper) UnsafeTransferTokenOwner(ctx sdk.Context, symbol string, to sdk.AccAddress) error

UnsafeTransferTokenOwner transfer the token owner without authorization NOTE: this method should be used with caution

func (Keeper) WithSwapRegistry added in v1.7.3

func (k Keeper) WithSwapRegistry(registry v1.SwapRegistry) Keeper

type Migrator added in v1.8.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.8.0

func NewMigrator(k Keeper, legacySubspace exported.Subspace) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v1.8.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

type ValidateTokenFeeDecorator

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

func NewValidateTokenFeeDecorator

func NewValidateTokenFeeDecorator(k Keeper, bk types.BankKeeper) ValidateTokenFeeDecorator

func (ValidateTokenFeeDecorator) AnteHandle

func (dtf ValidateTokenFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle returns an AnteHandler that checks if the balance of the fee payer is sufficient for token related fee

Jump to

Keyboard shortcuts

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