keepers

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier - creates a querier for asset REST endpoints

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for asset module

Types

type BaseKeeper

type BaseKeeper struct {
	BaseTokenKeeper
	// contains filtered or unexported fields
}

BaseKeeper encodes/decodes tokens using the go-amino (binary) encoding/decoding library.

func NewBaseKeeper

func NewBaseKeeper(cdc *codec.Codec, key sdk.StoreKey,
	paramStore params.Subspace, bkx types.ExpectedBankxKeeper, sk supply.Keeper) BaseKeeper

NewBaseKeeper returns a new BaseKeeper that uses go-amino to (binary) encode and decode concrete Token.

func (BaseKeeper) AddToken

func (keeper BaseKeeper) AddToken(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error

AddToken - used for unit test

func (BaseKeeper) AddTokenWhitelist

func (keeper BaseKeeper) AddTokenWhitelist(ctx sdk.Context, symbol string, owner sdk.AccAddress, whitelist []sdk.AccAddress) sdk.Error

AddTokenWhitelist - add token forbidden whitelist

func (BaseKeeper) BurnToken

func (keeper BaseKeeper) BurnToken(ctx sdk.Context, symbol string, owner sdk.AccAddress, amount sdk.Int) sdk.Error

BurnToken - burn token

func (BaseKeeper) DeductIssueFee

func (keeper BaseKeeper) DeductIssueFee(ctx sdk.Context, addr sdk.AccAddress, amt int64) sdk.Error

DeductIssueFee - deduct issue token fee

func (BaseKeeper) ForbidAddress

func (keeper BaseKeeper) ForbidAddress(ctx sdk.Context, symbol string, owner sdk.AccAddress, addresses []sdk.AccAddress) sdk.Error

ForbidAddress - add forbidden addresses

func (BaseKeeper) ForbidToken

func (keeper BaseKeeper) ForbidToken(ctx sdk.Context, symbol string, owner sdk.AccAddress) sdk.Error

ForbidToken - forbid token

func (BaseKeeper) GetAccTotalToken

func (keeper BaseKeeper) GetAccTotalToken(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

GetAccTotalToken - used for unit test

func (BaseKeeper) GetParams

func (keeper BaseKeeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the asset module's parameters.

func (BaseKeeper) IssueToken

func (keeper BaseKeeper) IssueToken(ctx sdk.Context, name string, symbol string, totalSupply sdk.Int, owner sdk.AccAddress,
	mintable bool, burnable bool, addrForbiddable bool, tokenForbiddable bool,
	url string, description string, identity string) sdk.Error

IssueToken - new token and store it

func (BaseKeeper) MintToken

func (keeper BaseKeeper) MintToken(ctx sdk.Context, symbol string, owner sdk.AccAddress, amount sdk.Int) sdk.Error

MintToken - mint token

func (BaseKeeper) ModifyTokenInfo

func (keeper BaseKeeper) ModifyTokenInfo(ctx sdk.Context, symbol string, owner sdk.AccAddress,
	url, description, identity, name string, totalSupply sdk.Int,
	mintable, burnable, addrForbiddable, tokenForbiddable bool) sdk.Error

ModifyTokenInfo - modify token info property

func (BaseKeeper) RemoveToken

func (keeper BaseKeeper) RemoveToken(ctx sdk.Context, token types.Token)

func (BaseKeeper) RemoveTokenWhitelist

func (keeper BaseKeeper) RemoveTokenWhitelist(ctx sdk.Context, symbol string, owner sdk.AccAddress, whitelist []sdk.AccAddress) sdk.Error

RemoveTokenWhitelist - remove token forbidden whitelist

func (BaseKeeper) SendCoinsFromAccountToAssetModule

func (keeper BaseKeeper) SendCoinsFromAccountToAssetModule(ctx sdk.Context, addresses sdk.AccAddress, amt sdk.Coins) sdk.Error

func (BaseKeeper) SendCoinsFromAssetModuleToAccount

func (keeper BaseKeeper) SendCoinsFromAssetModuleToAccount(ctx sdk.Context, addresses sdk.AccAddress, amt sdk.Coins) sdk.Error

func (BaseKeeper) SetParams

func (keeper BaseKeeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the asset module's parameters.

func (BaseKeeper) TransferOwnership

func (keeper BaseKeeper) TransferOwnership(ctx sdk.Context, symbol string, originalOwner sdk.AccAddress, newOwner sdk.AccAddress) sdk.Error

TransferOwnership - transfer token owner

func (BaseKeeper) UnForbidAddress

func (keeper BaseKeeper) UnForbidAddress(ctx sdk.Context, symbol string, owner sdk.AccAddress, addresses []sdk.AccAddress) sdk.Error

UnForbidAddress - remove forbidden addresses

func (BaseKeeper) UnForbidToken

func (keeper BaseKeeper) UnForbidToken(ctx sdk.Context, symbol string, owner sdk.AccAddress) sdk.Error

UnForbidToken - unforbid token

type BaseTokenKeeper

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

BaseTokenKeeper implements a read only keeper implementation of TokenKeeper.

func NewBaseTokenKeeper

func NewBaseTokenKeeper(cdc *codec.Codec, key sdk.StoreKey) BaseTokenKeeper

BaseTokenKeeper returns a new BaseTokenKeeper that uses go-amino to (binary) encode and decode concrete Token.

func (BaseTokenKeeper) ExportGenesisAddrKeys

func (keeper BaseTokenKeeper) ExportGenesisAddrKeys(ctx sdk.Context, prefix []byte) (res []string)

ExportGenesisAddrKeys - get all whitelists or forbidden addresses string to genesis.json

func (BaseTokenKeeper) GetAllTokens

func (keeper BaseTokenKeeper) GetAllTokens(ctx sdk.Context) []types.Token

GetAllTokens - returns all tokens.

func (BaseTokenKeeper) GetForbiddenAddresses

func (keeper BaseTokenKeeper) GetForbiddenAddresses(ctx sdk.Context, symbol string) []sdk.AccAddress

GetForbiddenAddresses - returns all forbidden addr

func (BaseTokenKeeper) GetToken

func (keeper BaseTokenKeeper) GetToken(ctx sdk.Context, symbol string) types.Token

GetToken - return token by symbol

func (BaseTokenKeeper) GetWhitelist

func (keeper BaseTokenKeeper) GetWhitelist(ctx sdk.Context, symbol string) []sdk.AccAddress

GetWhitelist - returns whitelist.

func (BaseTokenKeeper) ImportGenesisAddrKeys

func (keeper BaseTokenKeeper) ImportGenesisAddrKeys(ctx sdk.Context, prefix []byte, addr string) error

ImportGenesisAddrKeys - import all whitelists or forbidden addresses string from genesis.json

func (BaseTokenKeeper) IsForbiddenByTokenIssuer

func (keeper BaseTokenKeeper) IsForbiddenByTokenIssuer(ctx sdk.Context, symbol string, addr sdk.AccAddress) bool

IsForbiddenByTokenIssuer - check whether addr is forbid by token issuer

func (BaseTokenKeeper) IsTokenExists

func (keeper BaseTokenKeeper) IsTokenExists(ctx sdk.Context, symbol string) bool

IsTokenExists - check whether there is a coin named "symbol"

func (BaseTokenKeeper) IsTokenForbidden

func (keeper BaseTokenKeeper) IsTokenForbidden(ctx sdk.Context, symbol string) bool

IsTokenForbidden - check whether coin issuer has forbidden "symbol"

func (BaseTokenKeeper) IsTokenIssuer

func (keeper BaseTokenKeeper) IsTokenIssuer(ctx sdk.Context, symbol string, addr sdk.AccAddress) bool

IsTokenIssuer - check whether addr is a token issuer

func (BaseTokenKeeper) SetToken

func (keeper BaseTokenKeeper) SetToken(ctx sdk.Context, token types.Token) sdk.Error

SetToken - set token to store

func (BaseTokenKeeper) UpdateTokenSendLock

func (keeper BaseTokenKeeper) UpdateTokenSendLock(ctx sdk.Context, symbol string, amount sdk.Int, lock bool) sdk.Error

UpdateTokenSendLock - set token SendLock amount

type Keeper

type Keeper interface {
	TokenKeeper

	IssueToken(ctx sdk.Context, name string, symbol string, totalSupply sdk.Int, owner sdk.AccAddress,
		mintable bool, burnable bool, addrForbiddable bool, tokenForbiddable bool,
		url string, description string, identity string) sdk.Error
	TransferOwnership(ctx sdk.Context, symbol string, originalOwner sdk.AccAddress, newOwner sdk.AccAddress) sdk.Error
	MintToken(ctx sdk.Context, symbol string, owner sdk.AccAddress, amount sdk.Int) sdk.Error
	BurnToken(ctx sdk.Context, symbol string, owner sdk.AccAddress, amount sdk.Int) sdk.Error
	ForbidToken(ctx sdk.Context, symbol string, owner sdk.AccAddress) sdk.Error
	UnForbidToken(ctx sdk.Context, symbol string, owner sdk.AccAddress) sdk.Error
	AddTokenWhitelist(ctx sdk.Context, symbol string, owner sdk.AccAddress, whitelist []sdk.AccAddress) sdk.Error
	RemoveTokenWhitelist(ctx sdk.Context, symbol string, owner sdk.AccAddress, whitelist []sdk.AccAddress) sdk.Error
	ForbidAddress(ctx sdk.Context, symbol string, owner sdk.AccAddress, addresses []sdk.AccAddress) sdk.Error
	UnForbidAddress(ctx sdk.Context, symbol string, owner sdk.AccAddress, addresses []sdk.AccAddress) sdk.Error
	ModifyTokenInfo(ctx sdk.Context, symbol string, owner sdk.AccAddress,
		url, description, identity, name string, totalSupply sdk.Int,
		mintable, burnable, addrForbiddable, tokenForbiddable bool) sdk.Error

	SetParams(ctx sdk.Context, params types.Params)
	GetParams(ctx sdk.Context) (params types.Params)
}

Keeper defines a module interface that keep token info.

type TokenKeeper

type TokenKeeper interface {
	GetToken(ctx sdk.Context, symbol string) types.Token
	GetAllTokens(ctx sdk.Context) []types.Token
	GetWhitelist(ctx sdk.Context, symbol string) []sdk.AccAddress
	GetForbiddenAddresses(ctx sdk.Context, symbol string) []sdk.AccAddress

	IsTokenForbidden(ctx sdk.Context, symbol string) bool
	IsTokenExists(ctx sdk.Context, symbol string) bool
	IsTokenIssuer(ctx sdk.Context, symbol string, addr sdk.AccAddress) bool
	IsForbiddenByTokenIssuer(ctx sdk.Context, symbol string, addr sdk.AccAddress) bool
	UpdateTokenSendLock(ctx sdk.Context, symbol string, amount sdk.Int, lock bool) sdk.Error
}

TokenKeeper defines a module interface that facilitates read only access to token store info.

Jump to

Keyboard shortcuts

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