prepare

package
v1.0.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTxParam

func BuildTxParam(
	state TxParamState,
	param *BeforeTxParam,
) (txParam *txtool.GTxParam, e error)

func CreatePkr

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

func GenTxParam

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

func IsPk

func IsPk(addr c_type.PKr) bool

Types

type BeforeTxParam

type BeforeTxParam struct {
	Fee        assets.Token
	GasPrice   big.Int
	Utxos      Utxos
	RefundTo   c_type.PKr
	Receptions []Reception
	Cmds       Cmds
}

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

func (self *Cmds) ToPkr() (ret *c_type.PKr)

func (*Cmds) Valid

func (self *Cmds) Valid() bool

type DefaultTxParamState

type DefaultTxParamState struct {
}

func (*DefaultTxParamState) GetAnchor

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

func (*DefaultTxParamState) GetAxisGasLimit

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

func (*DefaultTxParamState) GetOut

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

func (*DefaultTxParamState) GetPkgById

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

type PkgCloseCmd

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

func (*PkgCloseCmd) Asset

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

type PkgCreateCmd

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

type PkgTransferCmd

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

type PreTxParam

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

type Reception

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

type TxParamGenerator

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

type TxParamState

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

type Utxo

type Utxo struct {
	Root  c_type.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 []c_type.Uint256)

Jump to

Keyboard shortcuts

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