types

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Lock    = "lock"
	Deposit = "deposit"
	Future  = "future"
)
View Source
const (
	Feature  = "feature"
	Transfer = "transfer"
)
View Source
const (
	// ModuleKey is the name of the module
	ModuleName = "box"
	// StoreKey is the store key string for issue
	StoreKey = ModuleName
	// RouterKey is the message route for issue
	RouterKey = ModuleName
	// QuerierRoute is the querier route for issue
	QuerierRoute = ModuleName
	// Parameter store default namestore
	DefaultParamspace = ModuleName
)
View Source
const (
	IDPreStr = "box"
	Custom   = "custom"
	Gard     = "gard"
	Agard    = "agard"
)
View Source
const (
	QueryParams = "params"
	QueryList   = "list"
	QueryBox    = "query"
	QuerySearch = "search"
)
View Source
const (
	Create   = "create"
	Inject   = "inject"
	Cancel   = "cancel"
	Withdraw = "withdraw"
	Describe = "describe"
	Disable  = "disable"
)

action

View Source
const (
	BoxCreated   = "created"
	BoxInjecting = Inject + "ing"
	BoxActived   = "actived"
	BoxUndue     = "undue"
	BoxClosed    = "closed"
	BoxFinished  = "finished"
)

box status

View Source
const (
	LockBoxLocked   = "locked"
	LockBoxUnlocked = "unlocked"
)

lock box status

View Source
const (
	TypeMsgBoxCreate         = Create
	TypeMsgBoxWithdraw       = Withdraw
	TypeMsgBoxInterestInject = DepositBoxInterest + "_" + Inject
	TypeMsgBoxInterestCancel = DepositBoxInterest + "_" + Cancel
	TypeMsgBoxInject         = Inject
	TypeMsgBoxCancel         = Cancel
	TypeMsgBoxDescription    = Describe
	TypeMsgBoxDisableFeature = Disable + "_" + Future
)
View Source
const (
	KeyDelimiterString                   = ":"
	AgardDecimals                        = uint(1)
	GardDecimals                         = uint(18)
	MaxPrecision                         = uint(6)
	CodeInvalidGenesis      sdk.CodeType = 102
	BoxNameMaxLength                     = 32
	BoxDescriptionMaxLength              = 1024
)
View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName
)
View Source
const (
	DepositBoxInterest = "interest"
)

deposit box status

Variables

View Source
var (
	IdLength                    = 14
	BoxMaxId             uint64 = 99999999999999
	BoxMinId             uint64 = 10000000000000
	BoxMaxInstalment            = 99
	BoxMaxInjectInterest        = 100
)
View Source
var BoxType = map[string]string{Lock: "aa", Deposit: "ab", Future: "ac"}
View Source
var DepositOperation = map[string]uint{Inject: 1, Cancel: 2}
View Source
var Features = map[string]int{Transfer: 1}
View Source
var InterestOperation = map[string]uint{Inject: 1, Cancel: 2}

Functions

func CheckBoxType

func CheckBoxType(boxType string) sdk.Error

func CheckDepositOperation

func CheckDepositOperation(depositOperation string) sdk.Error

func CheckInterestOperation

func CheckInterestOperation(interestOperation string) sdk.Error

func GetBoxTypeValue

func GetBoxTypeValue(boxType string) (string, error)

func GetMustBoxTypeValue

func GetMustBoxTypeValue(boxType string) string

Types

type AddressInject added in v0.6.0

type AddressInject struct {
	Address sdk.AccAddress `json:"address"`
	Amount  sdk.Int        `json:"amount"`
}

func NewAddressInject added in v0.6.0

func NewAddressInject(address sdk.AccAddress, amount sdk.Int) AddressInject

func (AddressInject) String added in v0.6.0

func (bi AddressInject) String() string

type Box

type Box interface {
	GetId() string
	SetId(string)

	GetBoxType() string
	SetBoxType(string)

	GetStatus() string
	SetStatus(string)

	GetOwner() sdk.AccAddress
	SetOwner(sdk.AccAddress)

	GetCreatedTime() int64
	SetCreatedTime(int64)

	GetName() string
	SetName(string)

	GetTotalAmount() BoxToken
	SetTotalAmount(BoxToken)

	GetDescription() string
	SetDescription(string)

	IsTransferDisabled() bool
	SetTransferDisabled(bool)

	GetLock() LockBox
	SetLock(LockBox)

	GetDeposit() DepositBox
	SetDeposit(DepositBox)

	GetFuture() FutureBox
	SetFuture(FutureBox)

	String() string
}

Box interface

type BoxInfo

type BoxInfo struct {
	Id               string         `json:"id"`
	Status           string         `json:"status"`
	Owner            sdk.AccAddress `json:"owner"`
	Name             string         `json:"name"`
	BoxType          string         `json:"type"`
	CreatedTime      int64          `json:"created_time"`
	TotalAmount      BoxToken       `json:"total_amount"`
	Description      string         `json:"description"`
	TransferDisabled bool           `json:"transfer_disabled"`
	Lock             LockBox        `json:"lock"`
	Deposit          DepositBox     `json:"deposit"`
	Future           FutureBox      `json:"future"`
}

type BaseBoxInfo struct { }

func (BoxInfo) GetBoxType

func (bi BoxInfo) GetBoxType() string

func (BoxInfo) GetCreatedTime

func (bi BoxInfo) GetCreatedTime() int64

func (BoxInfo) GetDeposit

func (bi BoxInfo) GetDeposit() DepositBox

func (BoxInfo) GetDescription

func (bi BoxInfo) GetDescription() string

func (BoxInfo) GetFuture

func (bi BoxInfo) GetFuture() FutureBox

func (BoxInfo) GetId added in v0.6.0

func (bi BoxInfo) GetId() string

func (BoxInfo) GetLock

func (bi BoxInfo) GetLock() LockBox

func (BoxInfo) GetName

func (bi BoxInfo) GetName() string

func (BoxInfo) GetOwner

func (bi BoxInfo) GetOwner() sdk.AccAddress

func (BoxInfo) GetStatus added in v0.6.0

func (bi BoxInfo) GetStatus() string

func (BoxInfo) GetTotalAmount

func (bi BoxInfo) GetTotalAmount() BoxToken

func (BoxInfo) IsTransferDisabled added in v0.6.0

func (bi BoxInfo) IsTransferDisabled() bool

func (*BoxInfo) SetBoxType

func (bi *BoxInfo) SetBoxType(boxType string)

func (*BoxInfo) SetCreatedTime

func (bi *BoxInfo) SetCreatedTime(createdTime int64)

func (*BoxInfo) SetDeposit

func (bi *BoxInfo) SetDeposit(deposit DepositBox)

func (*BoxInfo) SetDescription

func (bi *BoxInfo) SetDescription(description string)

func (*BoxInfo) SetFuture

func (bi *BoxInfo) SetFuture(future FutureBox)

func (*BoxInfo) SetId added in v0.6.0

func (bi *BoxInfo) SetId(boxId string)

func (*BoxInfo) SetLock

func (bi *BoxInfo) SetLock(lock LockBox)

func (*BoxInfo) SetName

func (bi *BoxInfo) SetName(name string)

func (*BoxInfo) SetOwner

func (bi *BoxInfo) SetOwner(owner sdk.AccAddress)

func (*BoxInfo) SetStatus added in v0.6.0

func (bi *BoxInfo) SetStatus(boxStatus string)

func (*BoxInfo) SetTotalAmount

func (bi *BoxInfo) SetTotalAmount(totalAmount BoxToken)

func (*BoxInfo) SetTransferDisabled added in v0.6.0

func (bi *BoxInfo) SetTransferDisabled(transferDisabled bool)

func (BoxInfo) String

func (bi BoxInfo) String() string

nolint

type BoxInfos

type BoxInfos []BoxInfo

BoxInfos is an array of BoxInfo

func (BoxInfos) String

func (bi BoxInfos) String() string

nolint

type BoxToken

type BoxToken struct {
	Token    sdk.Coin `json:"token"`
	Decimals uint     `json:"decimals"`
}

func (BoxToken) String

func (bi BoxToken) String() string

nolint

type DepositBox

type DepositBox struct {
	StartTime          int64           `json:"start_time"`
	EstablishTime      int64           `json:"establish_time"`
	MaturityTime       int64           `json:"maturity_time"`
	BottomLine         sdk.Int         `json:"bottom_line"`
	Interest           BoxToken        `json:"interest"`
	Price              sdk.Int         `json:"price"`
	PerCoupon          sdk.Dec         `json:"per_coupon"`
	Share              sdk.Int         `json:"share"`
	TotalInject        sdk.Int         `json:"total_inject"`
	WithdrawalShare    sdk.Int         `json:"withdrawal_share"`
	WithdrawalInterest sdk.Int         `json:"withdrawal_interest"`
	InterestInjects    []AddressInject `json:"interest_injects"`
}

func (DepositBox) String

func (bi DepositBox) String() string

nolint

type DepositBoxInjectInterest added in v0.6.0

type DepositBoxInjectInterest struct {
	Address  sdk.AccAddress `json:"address"`
	Amount   sdk.Int        `json:"amount"`
	Interest sdk.Int        `json:"interest"`
}

func (DepositBoxInjectInterest) String added in v0.6.0

func (bi DepositBoxInjectInterest) String() string

nolint

type DepositBoxInjectInterestList added in v0.6.0

type DepositBoxInjectInterestList []DepositBoxInjectInterest

func (DepositBoxInjectInterestList) String added in v0.6.0

nolint

type FutureBox

type FutureBox struct {
	Injects         []AddressInject `json:"injects"`
	TimeLine        []int64         `json:"time"`
	Receivers       [][]string      `json:"receivers"`
	TotalWithdrawal sdk.Int         `json:"total_withdrawal"`
}

func (FutureBox) String

func (bi FutureBox) String() string

nolint

type LockBox

type LockBox struct {
	EndTime int64 `json:"end_time"`
}

func (LockBox) String

func (bi LockBox) String() string

nolint

Jump to

Keyboard shortcuts

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