token

package
v0.0.0-...-581f9f3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package asset allows individuals and companies to create and issue their own tokens.

[More Details](https://www.irisnet.org/docs/features/asset.html)

Index

Constants

View Source
const (
	ModuleName = "token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool string

func (Bool) Marshal

func (b Bool) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (Bool) MarshalJSON

func (b Bool) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (Bool) String

func (b Bool) String() string

func (Bool) ToBool

func (b Bool) ToBool() bool

func (*Bool) Unmarshal

func (b *Bool) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type Fees

type Fees struct {
	Exist    bool     `json:"exist"`     // indicate if the token has existed
	IssueFee sdk.Coin `json:"issue_fee"` // issue fee
	MintFee  sdk.Coin `json:"mint_fee"`  // mint fee
}

Fees is for the token fees query output

type FungibleToken

type FungibleToken struct {
	Symbol        string         `json:"symbol" yaml:"symbol"`
	Name          string         `json:"name" yaml:"name"`
	Scale         uint8          `json:"scale" yaml:"scale"`
	MinUnit       string         `json:"min_unit" yaml:"min_unit"`
	InitialSupply uint64         `json:"initial_supply" yaml:"initial_supply"`
	MaxSupply     uint64         `json:"max_supply" yaml:"max_supply"`
	Mintable      bool           `json:"mintable" yaml:"mintable"`
	Owner         sdk.AccAddress `json:"owner" yaml:"owner"`
}

Token defines a struct for the fungible token

func (FungibleToken) Convert

func (t FungibleToken) Convert() interface{}

func (FungibleToken) GetInitialSupply

func (t FungibleToken) GetInitialSupply() uint64

GetInitialSupply implements exported.TokenI

func (FungibleToken) GetMaxSupply

func (t FungibleToken) GetMaxSupply() uint64

GetMaxSupply implements exported.TokenI

func (FungibleToken) GetMinUnit

func (t FungibleToken) GetMinUnit() string

GetMinUnit implements exported.TokenI

func (FungibleToken) GetMintable

func (t FungibleToken) GetMintable() bool

GetMintable implements exported.TokenI

func (FungibleToken) GetName

func (t FungibleToken) GetName() string

GetName implements exported.TokenI

func (FungibleToken) GetOwner

func (t FungibleToken) GetOwner() sdk.AccAddress

GetOwner implements exported.TokenI

func (FungibleToken) GetScale

func (t FungibleToken) GetScale() uint8

GetScale implements exported.TokenI

func (FungibleToken) GetSymbol

func (t FungibleToken) GetSymbol() string

GetSymbol implements exported.TokenI

type MsgEditToken

type MsgEditToken struct {
	Symbol    string         `json:"symbol"` //  symbol of token
	Owner     sdk.AccAddress `json:"owner"`  //  owner of token
	MaxSupply uint64         `json:"max_supply"`
	Mintable  Bool           `json:"mintable"` //  mintable of token
	Name      string         `json:"name"`
}

MsgEditToken for editing a specified token

func (MsgEditToken) GetSignBytes

func (msg MsgEditToken) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgEditToken) GetSigners

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

GetSigners implements Msg

func (MsgEditToken) Route

func (msg MsgEditToken) Route() string

func (MsgEditToken) Type

func (msg MsgEditToken) Type() string

Type implements Msg

func (MsgEditToken) ValidateBasic

func (msg MsgEditToken) ValidateBasic() error

ValidateBasic implements Msg

type MsgIssueToken

type MsgIssueToken struct {
	Symbol        string         `json:"symbol"`
	Name          string         `json:"name"`
	Scale         uint8          `json:"scale"`
	MinUnit       string         `json:"min_unit"`
	InitialSupply uint64         `json:"initial_supply"`
	MaxSupply     uint64         `json:"max_supply"`
	Mintable      bool           `json:"mintable"`
	Owner         sdk.AccAddress `json:"owner"`
}

MsgIssueToken

func (MsgIssueToken) GetSignBytes

func (msg MsgIssueToken) GetSignBytes() []byte

Implements Msg.

func (MsgIssueToken) GetSigners

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

Implements Msg.

func (MsgIssueToken) Route

func (msg MsgIssueToken) Route() string

func (MsgIssueToken) Type

func (msg MsgIssueToken) Type() string

Implements Msg.

func (MsgIssueToken) ValidateBasic

func (msg MsgIssueToken) ValidateBasic() error

Implements Msg.

type MsgMintToken

type MsgMintToken struct {
	Symbol string         `json:"symbol"` // the symbol of the token
	Owner  sdk.AccAddress `json:"owner"`  // the current owner address of the token
	To     sdk.AccAddress `json:"to"`     // address of minting token to
	Amount uint64         `json:"amount"` // amount of minting token
}

MsgMintToken for minting the token to a specified address

func (MsgMintToken) GetSignBytes

func (msg MsgMintToken) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgMintToken) GetSigners

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

GetSigners implements Msg

func (MsgMintToken) Route

func (msg MsgMintToken) Route() string

func (MsgMintToken) Type

func (msg MsgMintToken) Type() string

Type implements Msg

func (MsgMintToken) ValidateBasic

func (msg MsgMintToken) ValidateBasic() error

ValidateBasic implements Msg

type MsgTransferTokenOwner

type MsgTransferTokenOwner struct {
	SrcOwner sdk.AccAddress `json:"src_owner"` // the current owner address of the token
	DstOwner sdk.AccAddress `json:"dst_owner"` // the new owner
	Symbol   string         `json:"symbol"`    // the token symbol
}

MsgTransferTokenOwner for transferring the token owner

func (MsgTransferTokenOwner) GetSignBytes

func (msg MsgTransferTokenOwner) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgTransferTokenOwner) GetSigners

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

GetSigners implements Msg

func (MsgTransferTokenOwner) Route

func (msg MsgTransferTokenOwner) Route() string

func (MsgTransferTokenOwner) Type

func (msg MsgTransferTokenOwner) Type() string

Type implements Msg

func (MsgTransferTokenOwner) ValidateBasic

func (msg MsgTransferTokenOwner) ValidateBasic() error

type Params

type Params struct {
	TokenTaxRate      sdk.Dec  `json:"token_tax_rate"`       // e.g., 40%
	IssueTokenBaseFee sdk.Coin `json:"issue_token_base_fee"` // e.g., 300000*10^18iris-atto
	MintTokenFeeRatio sdk.Dec  `json:"mint_token_fee_ratio"` // e.g., 10%
}

token params

type Token

type Token interface {
	QueryToken(symbol string) (sdk.Token, error)
	QueryTokens(owner string) (sdk.Tokens, error)
	QueryFees(symbol string) (Fees, error)
	QueryParams() (Params, error)
}

func NewClient

func NewClient(bc sdk.BaseClient) Token

type TokenI

type TokenI interface {
	GetSymbol() string
	GetName() string
	GetScale() uint8
	GetMinUnit() string
	GetInitialSupply() uint64
	GetMaxSupply() uint64
	GetMintable() bool
	GetOwner() sdk.AccAddress
}

type Tokens

type Tokens []TokenI

func (Tokens) Convert

func (ts Tokens) Convert() interface{}

Jump to

Keyboard shortcuts

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