types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultCodeSpace btypes.CodespaceType = "bank"

	CodeInvalidInput                btypes.CodeType = 201 // 基础数据输入有误
	CodeSenderAccountNotExists      btypes.CodeType = 202 // 转出账户不存在
	CodeSenderAccountCoinsNotEnough btypes.CodeType = 203 // 转出账户余额不足
)

Transfer errors reserve 200 ~ 299.

Variables

View Source
var (
	// 事件类型
	EventTypeTransfer       = "transfer"                    // 转账
	EventTypeSend           = "send"                        // 发送
	EventTypeReceive        = "receive"                     // 接收
	EventTypeInvariantCheck = types.EventTypeInvariantCheck // 数据检查
	EventTypeRelease        = "release"                     // 锁定释放

	// 事件参数
	AttributeKeyModule  = "bank"    // 模块名
	AttributeKeyAddress = "address" // 账户地址
	AttributeKeyQOS     = "qos"     // QOS
	AttributeKeyQSCs    = "qscs"    // QSC代币
	AttributeKeySender  = "sender"  // 数据检查发送账户地址
	AttributeKeyHeight  = "height"  // 高度
)

Functions

func ErrInvalidInput

func ErrInvalidInput(msg string) btypes.Error

func ErrSenderAccountCoinsNotEnough

func ErrSenderAccountCoinsNotEnough() btypes.Error

func ErrSenderAccountNotExists

func ErrSenderAccountNotExists() btypes.Error

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

创世数据校验

Types

type GenesisState

type GenesisState struct {
	Accounts []*qtypes.QOSAccount `json:"accounts"`
	LockInfo *LockInfo            `json:"lock_info"`
}

创世状态

func DefaultGenesisState

func DefaultGenesisState() GenesisState

默认创世状态

func NewGenesisState

func NewGenesisState(accounts []*qtypes.QOSAccount, info *LockInfo) GenesisState

type LockInfo added in v0.0.8

type LockInfo struct {
	LockedAccount   types.AccAddress `json:"locked_account"`   // 锁定账户地址
	Receiver        types.AccAddress `json:"receiver"`         // 接收账户地址
	TotalAmount     types.BigInt     `json:"total_amount"`     // 总锁定QOS
	ReleasedAmount  types.BigInt     `json:"released_amount"`  // 已释放QOS
	ReleaseTime     time.Time        `json:"release_time"'`    // 下一次释放时间
	ReleaseInterval int64            `json:"release_interval"` // 释放间隔,以天为单位
	ReleaseTimes    int64            `json:"release_times"`    // 释放次数
}

锁定-释放账户信息

func NewLockInfo added in v0.0.8

func NewLockInfo(lockedAccount, receiver types.AccAddress, totalAmount, releasedAmount types.BigInt, releaseTime time.Time, releaseInterval, releaseTimes int64) LockInfo

type TransItem

type TransItem struct {
	Address btypes.AccAddress `json:"addr"` // 账户地址
	QOS     btypes.BigInt     `json:"qos"`  // QOS
	QSCs    types.QSCs        `json:"qscs"` // QSCs
}

func (TransItem) Valid added in v0.0.8

func (item TransItem) Valid() error

数据校验

type TransItems

type TransItems []TransItem

func (TransItems) IsEmpty

func (items TransItems) IsEmpty() bool

是否为空

func (TransItems) Match

func (items TransItems) Match(itemsB TransItems) error

判断转账列表是否匹配

func (TransItems) Valid added in v0.0.8

func (items TransItems) Valid() error

数据校验

Jump to

Keyboard shortcuts

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