prepare

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: GPL-3.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTxParam

func BuildTxParam(
	state TxParamState,
	utxos Utxos,
	refundTo *keys.PKr,
	receptions []Reception,
	cmds *Cmds,
	fee *assets.Token,
	gasPrice *big.Int,
) (txParam *txtool.GTxParam, e error)

func CreatePkr

func CreatePkr(pk *keys.Uint512, index uint64) keys.PKr

func GenTxParam

func GenTxParam(param *PreTxParam, gen TxParamGenerator, state TxParamState) (txParam *txtool.GTxParam, e error)

func IsPk

func IsPk(addr keys.PKr) bool

Types

type CKState

type CKState struct {
	// contains filtered or unexported fields
}

func NewCKState

func NewCKState(outPlus bool, fee *assets.Token) (ret CKState)

func (*CKState) AddIn

func (self *CKState) AddIn(asset *assets.Asset) (added bool, e error)

func (*CKState) AddOut

func (self *CKState) AddOut(asset *assets.Asset) (added bool, e error)

func (*CKState) Check

func (self *CKState) Check() (e error)

func (*CKState) CheckTicket

func (self *CKState) CheckTicket() (e error)

func (*CKState) CheckToken

func (self *CKState) CheckToken() (e error)

func (*CKState) GetList

func (self *CKState) GetList() (tkns []assets.Token, tkts []assets.Ticket)

type Cmds

type Cmds struct {
	//Share
	BuyShare *stx.BuyShareCmd
	//Pool
	RegistPool *stx.RegistPoolCmd
	ClosePool  *stx.ClosePoolCmd
	//Contract
	Contract *stx.ContractCmd
	//Package
	PkgCreate   *PkgCreateCmd
	PkgTransfer *PkgTransferCmd
	PkgClose    *PkgCloseCmd
}

func (*Cmds) InAsset

func (self *Cmds) InAsset() (asset *assets.Asset, e error)

func (*Cmds) OutAsset

func (self *Cmds) OutAsset() *assets.Asset

func (*Cmds) Valid

func (self *Cmds) Valid() bool

type DefaultTxParamState

type DefaultTxParamState struct {
}

func (*DefaultTxParamState) GetAnchor

func (self *DefaultTxParamState) GetAnchor(roots []keys.Uint256) (wits []txtool.Witness, e error)

func (*DefaultTxParamState) GetOut

func (self *DefaultTxParamState) GetOut(root *keys.Uint256) (out *localdb.RootState)

func (*DefaultTxParamState) GetPkgById

func (self *DefaultTxParamState) GetPkgById(id *keys.Uint256) (ret *localdb.ZPkg)

func (*DefaultTxParamState) GetSeroGasLimit

func (self *DefaultTxParamState) GetSeroGasLimit(to *common.Address, tfee *assets.Token, gasPrice *big.Int) (gaslimit uint64, e error)

type PkgCloseCmd

type PkgCloseCmd struct {
	Id  keys.Uint256
	Key keys.Uint256
}

func (*PkgCloseCmd) Asset

func (self *PkgCloseCmd) Asset() (ret assets.Asset, e error)

type PkgCreateCmd

type PkgCreateCmd struct {
	Id    keys.Uint256
	PKr   keys.PKr
	Asset assets.Asset
	Memo  keys.Uint512
}

type PkgTransferCmd

type PkgTransferCmd struct {
	Id  keys.Uint256
	PKr keys.PKr
}

type PreTxParam

type PreTxParam struct {
	From       keys.Uint512
	RefundTo   *keys.PKr
	Receptions []Reception
	Cmds       Cmds
	Fee        assets.Token
	GasPrice   *big.Int
	Roots      []keys.Uint256
}

type Reception

type Reception struct {
	Addr  keys.PKr
	Asset assets.Asset
}

type TxParamGenerator

type TxParamGenerator interface {
	FindRoots(pk *keys.Uint512, currency string, amount *big.Int) (utxos Utxos, remain big.Int)
	FindRootsByTicket(pk *keys.Uint512, tickets map[keys.Uint256]keys.Uint256) (roots Utxos, remain map[keys.Uint256]keys.Uint256)
	GetRoot(root *keys.Uint256) (utxos *Utxo)
	DefaultRefundTo(from *keys.Uint512) (ret *keys.PKr)
}

type TxParamState

type TxParamState interface {
	GetAnchor(roots []keys.Uint256) (wits []txtool.Witness, e error)
	GetOut(root *keys.Uint256) (out *localdb.RootState)
	GetPkgById(id *keys.Uint256) (ret *localdb.ZPkg)
	GetSeroGasLimit(to *common.Address, tfee *assets.Token, gasPrice *big.Int) (gaslimit uint64, e error)
}

type Utxo

type Utxo struct {
	Root  keys.Uint256
	Asset assets.Asset
}

type Utxos

type Utxos []Utxo

func SelectUtxos

func SelectUtxos(param *PreTxParam, generator TxParamGenerator) (utxos Utxos, e error)

func (*Utxos) Roots

func (self *Utxos) Roots() (roots []keys.Uint256)

Jump to

Keyboard shortcuts

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