types

package
Version: 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: 6 Imported by: 0

Documentation

Index

Constants

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

	CodeInvalidInput              btypes.CodeType = 101 // 基础数据输入有误
	CodeQSCNotExists              btypes.CodeType = 102 // 联盟币不存在
	CodeApproveExists             btypes.CodeType = 103 // 预授权已存在
	CodeApproveNotExists          btypes.CodeType = 104 // 预授权不存在
	CodeFromAccountNotExists      btypes.CodeType = 105 // 授权账户不存在
	CodeApproveNotEnough          btypes.CodeType = 106 // 授权不足
	CodeFromAccountCoinsNotEnough btypes.CodeType = 107 // 授权账户余额不足
)

Approve errors reserve 100 ~ 199.

View Source
const (
	MapperName = "approve"
)

Variables

View Source
var (
	// 事件类型
	EventTypeCreateApprove   = "create-approve"   // 创建预授权
	EventTypeIncreaseApprove = "increase-approve" // 增加预授权
	EventTypeDecreaseApprove = "decrease-approve" // 减少预授权
	EventTypeUseApprove      = "use-approve"      // 使用预授权
	EventTypeCancelApprove   = "cancel-approve"   // 取消预授权

	// 事件参数
	AttributeKeyModule      = "approve"      // 模块
	AttributeKeyApproveFrom = "approve-from" // 授权账户
	AttributeKeyApproveTo   = "approve-to"   // 被授权账户
)
View Source
var (
	ApproveKey = []byte{0x01} // 预授权存储前缀
)

Functions

func BuildApproveByFromKey added in v0.0.9

func BuildApproveByFromKey(from []byte) []byte

func BuildApproveKey added in v0.0.6

func BuildApproveKey(from []byte, to []byte) []byte

func ErrApproveExists added in v0.0.6

func ErrApproveExists() btypes.Error

func ErrApproveNotEnough added in v0.0.6

func ErrApproveNotEnough() btypes.Error

func ErrApproveNotExists added in v0.0.6

func ErrApproveNotExists() btypes.Error

func ErrFromAccountCoinsNotEnough added in v0.0.6

func ErrFromAccountCoinsNotEnough() btypes.Error

func ErrFromAccountNotExists added in v0.0.6

func ErrFromAccountNotExists() btypes.Error

func ErrInvalidInput added in v0.0.6

func ErrInvalidInput(msg string) btypes.Error

func ErrQSCNotExists added in v0.0.6

func ErrQSCNotExists() btypes.Error

func GetApprovePrefixKey added in v0.0.6

func GetApprovePrefixKey() []byte

func ValidateGenesis added in v0.0.6

func ValidateGenesis(gs GenesisState) error

校验创世状态

Types

type Approve

type Approve struct {
	From btypes.AccAddress `json:"from"` // 授权账号
	To   btypes.AccAddress `json:"to"`   // 被授权账号
	QOS  btypes.BigInt     `json:"qos"`  // QOS
	QSCs types.QSCs        `json:"qscs"` // QSCs
}

授权 Common 结构

func NewApprove

func NewApprove(from btypes.AccAddress, to btypes.AccAddress, qos btypes.BigInt, qscs types.QSCs) Approve

func (Approve) Equals

func (approve Approve) Equals(approveB Approve) bool

重写Equals

func (Approve) IsGT

func (approve Approve) IsGT(qos btypes.BigInt, qscs types.QSCs) bool

是否大于

func (Approve) IsGTE

func (approve Approve) IsGTE(qos btypes.BigInt, qscs types.QSCs) bool

是否大于等于

func (Approve) IsNotNegative

func (approve Approve) IsNotNegative() bool

是否为非负值

func (Approve) IsPositive

func (approve Approve) IsPositive() bool

是否为正值

func (Approve) Minus

func (approve Approve) Minus(qos btypes.BigInt, qscs types.QSCs) Approve

Minus

func (Approve) Negative

func (approve Approve) Negative() Approve

返回相反值

func (Approve) Plus

func (approve Approve) Plus(qos btypes.BigInt, qscs types.QSCs) Approve

Plus

func (Approve) String

func (approve Approve) String() string

输出字符串

func (Approve) Valid added in v0.0.8

func (approve Approve) Valid() error

校验

type GenesisState added in v0.0.6

type GenesisState struct {
	Approves []Approve `json:"approves"`
}

创世状态

func DefaultGenesisState added in v0.0.6

func DefaultGenesisState() GenesisState

func NewGenesisState added in v0.0.6

func NewGenesisState(approves []Approve) GenesisState

Jump to

Keyboard shortcuts

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