types

package
v0.14.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EventTypeIssue           = "issue_tokens"
	EventTypeRedeem          = "redeem_tokens"
	EventTypeBlock           = "block_address"
	EventTypeUnblock         = "unblock_address"
	EventTypePause           = "change_pause_status"
	EventTypeSeize           = "seize_coins_from_blocked_address"
	AttributeValueCategory   = ModuleName
	AttributeKeyDenom        = "denom"
	AttributeKeyIssueAmount  = "amount_issued"
	AttributeKeyRedeemAmount = "amount_redeemed"
	AttributeKeyBlock        = "address_blocked"
	AttributeKeyUnblock      = "address_unblocked"
	AttributeKeyAddress      = "address"
	AttributeKeyPauseStatus  = "pause_status"
)

Events emitted by the issuance module

View Source
const (
	// ModuleName The name that will be used throughout the module
	ModuleName = "issuance"

	// StoreKey Top level store key where all module items will be stored
	StoreKey = ModuleName

	// RouterKey Top level router key
	RouterKey = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	// QuerierRoute route used for abci queries
	QuerierRoute = ModuleName
)
View Source
const (
	QueryGetParams = "parameters"
	QueryGetAsset  = "asset"
)

Querier routes for the issuance module

Variables

View Source
var (
	ErrAssetNotFound           = sdkerrors.Register(ModuleName, 2, "no asset with input denom found")
	ErrNotAuthorized           = sdkerrors.Register(ModuleName, 3, "account not authorized")
	ErrAssetPaused             = sdkerrors.Register(ModuleName, 4, "asset is paused")
	ErrAccountBlocked          = sdkerrors.Register(ModuleName, 5, "account is blocked")
	ErrAccountAlreadyBlocked   = sdkerrors.Register(ModuleName, 6, "account is already blocked")
	ErrAccountAlreadyUnblocked = sdkerrors.Register(ModuleName, 7, "account is already unblocked")
	ErrIssueToModuleAccount    = sdkerrors.Register(ModuleName, 8, "cannot issue tokens to module account")
	ErrExceedsSupplyLimit      = sdkerrors.Register(ModuleName, 9, "asset supply over limit")
	ErrAssetUnblockable        = sdkerrors.Register(ModuleName, 10, "asset does not support block/unblock functionality")
	ErrAccountNotFound         = sdkerrors.Register(ModuleName, 11, "cannot block account that does not exist in state")
)

Errors used by the issuance module

View Source
var (
	AssetSupplyPrefix    = []byte{0x01}
	PreviousBlockTimeKey = []byte{0x02}
)

KVStore key prefixes

View Source
var (
	KeyAssets         = []byte("Assets")
	DefaultAssets     = Assets{}
	ModuleAccountName = ModuleName
)

Parameter keys and default values

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable Key declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the necessary types for issuance module

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}

AccountKeeper expected interface for the account keeper (noalias)

type Asset

type Asset struct {
	Owner            sdk.AccAddress   `json:"owner" yaml:"owner"`
	Denom            string           `json:"denom" yaml:"denom"`
	BlockedAddresses []sdk.AccAddress `json:"blocked_addresses" yaml:"blocked_addresses"`
	Paused           bool             `json:"paused" yaml:"paused"`
	Blockable        bool             `json:"blockable" yaml:"blockable"`
	RateLimit        RateLimit        `json:"rate_limit" yaml:"rate_limit"`
}

Asset type for assets in the issuance module

func NewAsset

func NewAsset(owner sdk.AccAddress, denom string, blockedAddresses []sdk.AccAddress, paused bool, blockable bool, limit RateLimit) Asset

NewAsset returns a new Asset

func (Asset) String

func (a Asset) String() string

String implements fmt.Stringer

func (Asset) Validate

func (a Asset) Validate() error

Validate performs a basic check of asset fields

type AssetSupplies

type AssetSupplies []AssetSupply

AssetSupplies is a slice of AssetSupply

type AssetSupply

type AssetSupply struct {
	CurrentSupply sdk.Coin      `json:"current_supply"  yaml:"current_supply"`
	TimeElapsed   time.Duration `json:"time_elapsed" yaml:"time_elapsed"`
}

AssetSupply contains information about an asset's rate-limited supply (the total supply of the asset is tracked in the top-level supply module)

func NewAssetSupply

func NewAssetSupply(currentSupply sdk.Coin, timeElapsed time.Duration) AssetSupply

NewAssetSupply initializes a new AssetSupply

func (AssetSupply) GetDenom

func (a AssetSupply) GetDenom() string

GetDenom getter method for the denom of the asset supply

func (AssetSupply) String

func (a AssetSupply) String() string

String implements stringer

func (AssetSupply) Validate

func (a AssetSupply) Validate() error

Validate performs a basic validation of an asset supply fields.

type Assets

type Assets []Asset

Assets slice of Asset

func (Assets) String

func (as Assets) String() string

String implements fmt.Stringer

func (Assets) Validate

func (as Assets) Validate() error

Validate checks if all assets are valid and there are no duplicate entries

type GenesisState

type GenesisState struct {
	Params   Params        `json:"params" yaml:"params"`
	Supplies AssetSupplies `json:"supplies" yaml:"supplies"`
}

GenesisState is the state that must be provided at genesis for the issuance module

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns the default GenesisState for the issuance module

func NewGenesisState

func NewGenesisState(params Params, supplies AssetSupplies) GenesisState

NewGenesisState returns a new GenesisState

func (GenesisState) Equal

func (gs GenesisState) Equal(gs2 GenesisState) bool

Equal checks whether two GenesisState structs are equivalent

func (GenesisState) IsEmpty

func (gs GenesisState) IsEmpty() bool

IsEmpty returns true if a GenesisState is empty

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic validation of genesis data returning an error for any failed validation criteria.

type MsgBlockAddress

type MsgBlockAddress struct {
	Sender  sdk.AccAddress `json:"sender" yaml:"sender"`
	Denom   string         `json:"denom" yaml:"denom"`
	Address sdk.AccAddress `json:"blocked_address" yaml:"blocked_address"`
}

MsgBlockAddress message type used by the issuer to block an address from holding or transferring tokens

func NewMsgBlockAddress

func NewMsgBlockAddress(sender sdk.AccAddress, denom string, addr sdk.AccAddress) MsgBlockAddress

NewMsgBlockAddress returns a new MsgBlockAddress

func (MsgBlockAddress) GetSignBytes

func (msg MsgBlockAddress) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg

func (MsgBlockAddress) GetSigners

func (msg MsgBlockAddress) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign

func (MsgBlockAddress) Route

func (msg MsgBlockAddress) Route() string

Route return the message type used for routing the message.

func (MsgBlockAddress) String

func (msg MsgBlockAddress) String() string

String implements fmt.Stringer

func (MsgBlockAddress) Type

func (msg MsgBlockAddress) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgBlockAddress) ValidateBasic

func (msg MsgBlockAddress) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to state.

type MsgIssueTokens

type MsgIssueTokens struct {
	Sender   sdk.AccAddress `json:"sender" yaml:"sender"`
	Tokens   sdk.Coin       `json:"tokens" yaml:"tokens"`
	Receiver sdk.AccAddress `json:"receiver" yaml:"receiver"`
}

MsgIssueTokens message type used by the issuer to issue new tokens

func NewMsgIssueTokens

func NewMsgIssueTokens(sender sdk.AccAddress, tokens sdk.Coin, receiver sdk.AccAddress) MsgIssueTokens

NewMsgIssueTokens returns a new MsgIssueTokens

func (MsgIssueTokens) GetSignBytes

func (msg MsgIssueTokens) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg

func (MsgIssueTokens) GetSigners

func (msg MsgIssueTokens) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign

func (MsgIssueTokens) Route

func (msg MsgIssueTokens) Route() string

Route return the message type used for routing the message.

func (MsgIssueTokens) String

func (msg MsgIssueTokens) String() string

String implements fmt.Stringer

func (MsgIssueTokens) Type

func (msg MsgIssueTokens) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgIssueTokens) ValidateBasic

func (msg MsgIssueTokens) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to state.

type MsgRedeemTokens

type MsgRedeemTokens struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	Tokens sdk.Coin       `json:"tokens" yaml:"tokens"`
}

MsgRedeemTokens message type used by the issuer to redeem (burn) tokens

func NewMsgRedeemTokens

func NewMsgRedeemTokens(sender sdk.AccAddress, tokens sdk.Coin) MsgRedeemTokens

NewMsgRedeemTokens returns a new MsgRedeemTokens

func (MsgRedeemTokens) GetSignBytes

func (msg MsgRedeemTokens) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg

func (MsgRedeemTokens) GetSigners

func (msg MsgRedeemTokens) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign

func (MsgRedeemTokens) Route

func (msg MsgRedeemTokens) Route() string

Route return the message type used for routing the message.

func (MsgRedeemTokens) String

func (msg MsgRedeemTokens) String() string

String implements fmt.Stringer

func (MsgRedeemTokens) Type

func (msg MsgRedeemTokens) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgRedeemTokens) ValidateBasic

func (msg MsgRedeemTokens) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to state.

type MsgSetPauseStatus

type MsgSetPauseStatus struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	Denom  string         `json:"denom" yaml:"denom"`
	Status bool           `json:"status" yaml:"status"`
}

MsgSetPauseStatus message type used by the issuer to issue new tokens

func NewMsgSetPauseStatus

func NewMsgSetPauseStatus(sender sdk.AccAddress, denom string, status bool) MsgSetPauseStatus

NewMsgSetPauseStatus returns a new MsgSetPauseStatus

func (MsgSetPauseStatus) GetSignBytes

func (msg MsgSetPauseStatus) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg

func (MsgSetPauseStatus) GetSigners

func (msg MsgSetPauseStatus) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign

func (MsgSetPauseStatus) Route

func (msg MsgSetPauseStatus) Route() string

Route return the message type used for routing the message.

func (MsgSetPauseStatus) String

func (msg MsgSetPauseStatus) String() string

String implements fmt.Stringer

func (MsgSetPauseStatus) Type

func (msg MsgSetPauseStatus) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgSetPauseStatus) ValidateBasic

func (msg MsgSetPauseStatus) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to state.

type MsgUnblockAddress

type MsgUnblockAddress struct {
	Sender  sdk.AccAddress `json:"sender" yaml:"sender"`
	Denom   string         `json:"denom" yaml:"denom"`
	Address sdk.AccAddress `json:"address" yaml:"address"`
}

MsgUnblockAddress message type used by the issuer to unblock an address from holding or transferring tokens

func NewMsgUnblockAddress

func NewMsgUnblockAddress(sender sdk.AccAddress, denom string, addr sdk.AccAddress) MsgUnblockAddress

NewMsgUnblockAddress returns a new MsgUnblockAddress

func (MsgUnblockAddress) GetSignBytes

func (msg MsgUnblockAddress) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg

func (MsgUnblockAddress) GetSigners

func (msg MsgUnblockAddress) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign

func (MsgUnblockAddress) Route

func (msg MsgUnblockAddress) Route() string

Route return the message type used for routing the message.

func (MsgUnblockAddress) String

func (msg MsgUnblockAddress) String() string

String implements fmt.Stringer

func (MsgUnblockAddress) Type

func (msg MsgUnblockAddress) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgUnblockAddress) ValidateBasic

func (msg MsgUnblockAddress) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to state.

type Params

type Params struct {
	Assets Assets `json:"assets" yaml:"assets"`
}

Params governance parameters for the issuance module

func DefaultParams

func DefaultParams() Params

DefaultParams returns default params for issuance module

func NewParams

func NewParams(assets Assets) Params

NewParams returns a new params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

type QueryAssetParams

type QueryAssetParams struct {
	Denom string `json:"denom" yaml:"denom"`
}

QueryAssetParams params for querying an asset by denom

type RateLimit

type RateLimit struct {
	Active     bool          `json:"active" yaml:"active"`
	Limit      sdk.Int       `json:"limit" yaml:"limit"`
	TimePeriod time.Duration `json:"time_period" yaml:"time_period"`
}

RateLimit parameters for rate-limiting the supply of an issued asset

func NewRateLimit

func NewRateLimit(active bool, limit sdk.Int, timePeriod time.Duration) RateLimit

NewRateLimit initializes a new RateLimit

func (RateLimit) String

func (r RateLimit) String() string

String implements fmt.Stringer

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply keeper for module accounts (noalias)

Jump to

Keyboard shortcuts

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