types

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 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 (
	// 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"
	QueryDepositList   = "deposit"
	QueryDepositAmount = "deposit-amount"
	QuerySearch        = "search"
)
View Source
const (
	BoxCreated    = "created"
	BoxDepositing = "depositing"
	BoxActived    = "actived"
	BoxClosed     = "closed"
	BoxFinished   = "finished"
)

box status

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

lock box status

View Source
const (
	Injection = "injection"
	DepositTo = "deposit-to"
	Fetch     = "fetch"
)
View Source
const (
	TypeMsgBoxCreateLock     = "box_create_lock"
	TypeMsgBoxCreateDeposit  = "box_create_deposit"
	TypeMsgBoxCreateFuture   = "box_create_future"
	TypeMsgBoxInterest       = "box_interest"
	TypeMsgBoxDeposit        = "box_deposit"
	TypeMsgBoxFuture         = "box_future"
	TypeMsgBoxDescription    = "box_description"
	TypeMsgBoxDisableFeature = "box_disable_feature"
)
View Source
const (
	KeyDelimiterString                   = ":"
	AgardDecimal                         = uint(1)
	GardDecimal                          = 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

View Source
const (
	Trade = "trade"
)

Variables

View Source
var (
	BoxMaxId                uint64 = 99999999999999
	BoxMinId                uint64 = 10000000000000
	BoxMaxInstalment               = 99
	BoxMaxInjectionInterest        = 100
)
View Source
var BoxType = map[string]string{Lock: "aa", Deposit: "ab", Future: "ac"}
View Source
var DepositOperation = map[string]uint{DepositTo: 1, Fetch: 2}
View Source
var Features = map[string]int{Trade: 1}
View Source
var InterestOperation = map[string]uint{Injection: 1, Fetch: 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 AddressDeposit

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

func NewAddressDeposit

func NewAddressDeposit(address sdk.AccAddress, amount sdk.Int) AddressDeposit

func (AddressDeposit) String

func (bi AddressDeposit) String() string

type Box

type Box interface {
	GetBoxId() string
	SetBoxId(string)

	GetBoxType() string
	SetBoxType(string)

	GetBoxStatus() string
	SetBoxStatus(string)

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

	GetCreatedTime() int64
	SetCreatedTime(int64)

	GetName() string
	SetName(string)

	GetTotalAmount() BoxToken
	SetTotalAmount(BoxToken)

	GetDescription() string
	SetDescription(string)

	IsTradeDisabled() bool
	SetTradeDisabled(bool)

	GetLock() LockBox
	SetLock(LockBox)

	GetDeposit() DepositBox
	SetDeposit(DepositBox)

	GetFuture() FutureBox
	SetFuture(FutureBox)

	String() string
}

Box interface

type BoxDeposit

type BoxDeposit struct {
	Amount   sdk.Int `json:"amount"`
	Interest sdk.Int `json:"interest"`
}

func NewBoxDeposit

func NewBoxDeposit(amount sdk.Int) *BoxDeposit

func NewZeroBoxDeposit

func NewZeroBoxDeposit() *BoxDeposit

func (BoxDeposit) String

func (bi BoxDeposit) String() string

nolint

type BoxInfo

type BoxInfo struct {
	BoxId         string         `json:"box_id"`
	BoxStatus     string         `json:"box_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"`
	TradeDisabled bool           `json:"trade_disabled"`
	Lock          LockBox        `json:"lock"`
	Deposit       DepositBox     `json:"deposit"`
	Future        FutureBox      `json:"future"`
}

type BaseBoxInfo struct { }

func (BoxInfo) GetBoxId

func (bi BoxInfo) GetBoxId() string

func (BoxInfo) GetBoxStatus

func (bi BoxInfo) GetBoxStatus() string

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) 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) GetTotalAmount

func (bi BoxInfo) GetTotalAmount() BoxToken

func (BoxInfo) IsTradeDisabled

func (bi BoxInfo) IsTradeDisabled() bool

func (*BoxInfo) SetBoxId

func (bi *BoxInfo) SetBoxId(boxId string)

func (*BoxInfo) SetBoxStatus

func (bi *BoxInfo) SetBoxStatus(boxStatus string)

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) 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) SetTotalAmount

func (bi *BoxInfo) SetTotalAmount(totalAmount BoxToken)

func (*BoxInfo) SetTradeDisabled

func (bi *BoxInfo) SetTradeDisabled(tradeDisabled 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"`
	TotalDeposit       sdk.Int          `json:"total_deposit"`
	InterestInjections []AddressDeposit `json:"interest_injections"`
}

func (DepositBox) String

func (bi DepositBox) String() string

nolint

type DepositBoxDepositInterest

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

func NewDepositBoxDepositInterest

func NewDepositBoxDepositInterest(address sdk.AccAddress, amount sdk.Int, interest sdk.Int) DepositBoxDepositInterest

func (DepositBoxDepositInterest) String

func (bi DepositBoxDepositInterest) String() string

nolint

type DepositBoxDepositInterestList

type DepositBoxDepositInterestList []DepositBoxDepositInterest

func (DepositBoxDepositInterestList) String

nolint

type FutureBox

type FutureBox struct {
	MiniMultiple uint             `json:"mini_multiple"`
	Deposits     []AddressDeposit `json:"deposits"`
	TimeLine     []int64          `json:"time"`
	Receivers    [][]string       `json:"receivers"`
	Distributed  []int64          `json:"distributed"`
}

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