exchange

package
v1.0.1-rc6-dev-review2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: GPL-3.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJob

func AddJob(spec string, run RunFunc) *cron.Cron

func DecOuts

func DecOuts(outs []txtool.Out, skr *c_type.PKr) (douts []txtool.DOut)

func SetUtxoForVersion0

func SetUtxoForVersion0(b *Utxo, v0 *Utxo_Version0)

func SetUtxoForVersion1

func SetUtxoForVersion1(b *Utxo, v1 *Utxo_Version1)

func SetVersion0ForUtxo

func SetVersion0ForUtxo(v0 *Utxo_Version0, b *Utxo)

func SetVersion1ForUtxo

func SetVersion1ForUtxo(v1 *Utxo_Version1, b *Utxo)

Types

type Account

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

type BlockInfo

type BlockInfo struct {
	Num  uint64
	Hash c_type.Uint256
	Ins  []c_type.Uint256
	Outs []Utxo
}

type Exchange

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

func CurrentExchange

func CurrentExchange() *Exchange

func NewExchange

func NewExchange(dbpath string, txPool *core.TxPool, accountManager *accounts.Manager, autoMerge bool) (exchange *Exchange)

func (*Exchange) ClearTxParam

func (self *Exchange) ClearTxParam(txParam *txtool.GTxParam) (count int)

func (*Exchange) ClearUsedFlagForPK

func (self *Exchange) ClearUsedFlagForPK(pk *c_type.Uint512) (count int)

func (*Exchange) ClearUsedFlagForRoot

func (self *Exchange) ClearUsedFlagForRoot(root c_type.Uint256) (count int)

func (*Exchange) DefaultRefundTo

func (self *Exchange) DefaultRefundTo(pk *c_type.Uint512) (ret *c_type.PKr)

func (*Exchange) FindPkgById

func (self *Exchange) FindPkgById(id *c_type.Uint256) (pkg *Pkg)

func (*Exchange) FindPkgs

func (self *Exchange) FindPkgs(pk *c_type.Uint512, from bool) (pkgs []Pkg)

func (*Exchange) FindRoots

func (self *Exchange) FindRoots(pk *c_type.Uint512, currency string, amount *big.Int) (roots prepare.Utxos, remain big.Int)

func (*Exchange) FindRootsByTicket

func (self *Exchange) FindRootsByTicket(pk *c_type.Uint512, tickets []assets.Ticket) (roots prepare.Utxos, remain map[c_type.Uint256]c_type.Uint256)

func (*Exchange) GenMergeTx

func (self *Exchange) GenMergeTx(mp *MergeParam) (txParam *txtool.GTxParam, e error)

func (*Exchange) GenTx

func (self *Exchange) GenTx(param prepare.PreTxParam) (txParam *txtool.GTxParam, e error)

func (*Exchange) GenTxWithSign

func (self *Exchange) GenTxWithSign(param prepare.PreTxParam) (pretx *txtool.GTxParam, tx *txtool.GTx, e error)

func (*Exchange) GetBalances

func (self *Exchange) GetBalances(pk c_type.Uint512) (balances map[string]*big.Int, tickets map[string][]*common.Hash)

func (*Exchange) GetBlocksInfo

func (self *Exchange) GetBlocksInfo(start, end uint64) (blocks []BlockInfo, err error)

func (*Exchange) GetCurrencyNumber

func (self *Exchange) GetCurrencyNumber(pk c_type.Uint512) uint64

func (*Exchange) GetLockedBalances

func (self *Exchange) GetLockedBalances(pk c_type.Uint512) (balances map[string]*big.Int)

func (*Exchange) GetMaxAvailable

func (self *Exchange) GetMaxAvailable(pk c_type.Uint512, currency string) (amount *big.Int)

func (*Exchange) GetPkr

func (self *Exchange) GetPkr(pk *c_type.Uint512, index *c_type.Uint256) (pkr c_type.PKr, err error)

func (*Exchange) GetRecordsByPk

func (self *Exchange) GetRecordsByPk(pk *c_type.Uint512, begin, end uint64) (records []Utxo, err error)

func (*Exchange) GetRecordsByPkr

func (self *Exchange) GetRecordsByPkr(pkr c_type.PKr, begin, end uint64) (records []Utxo, err error)

func (*Exchange) GetRecordsByTxHash

func (self *Exchange) GetRecordsByTxHash(txHash c_type.Uint256) (records []Utxo, err error)

func (*Exchange) GetRoot

func (self *Exchange) GetRoot(root *c_type.Uint256) (utxos *prepare.Utxo)

func (*Exchange) GetRootByNil

func (self *Exchange) GetRootByNil(Nil c_type.Uint256) (root *c_type.Uint256)

func (*Exchange) GetUtxoNum

func (self *Exchange) GetUtxoNum(pk c_type.Uint512) map[string]uint64

func (*Exchange) IgnorePkrUtxos

func (self *Exchange) IgnorePkrUtxos(pkr c_type.PKr, ignore bool) (utxos []Utxo, e error)

func (*Exchange) Merge

func (self *Exchange) Merge(pk *c_type.Uint512, currency string, force bool) (count int, txhash c_type.Uint256, e error)

func (*Exchange) SetBalancePkr

func (self *Exchange) SetBalancePkr(pk *c_type.Uint512, pkr c_type.PKr) error

type FetchJob

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

type HandleUtxoFunc

type HandleUtxoFunc func(utxo Utxo)

type MergeParam

type MergeParam struct {
	From     c_type.Uint512
	To       *c_type.PKr
	Currency string
	Zcount   uint64
	Left     uint64
}

type MergeUtxos

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

type PkKey

type PkKey struct {
	Num uint64
	// contains filtered or unexported fields
}

type Pkg

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

type PkrAccount

type PkrAccount struct {
	Pkr c_type.PKr
	// contains filtered or unexported fields
}

type PkrKey

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

type RunFunc

type RunFunc func()

type RunJob

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

func (*RunJob) Run

func (r *RunJob) Run()

type Utxo

type Utxo struct {
	Pkr    c_type.PKr
	Root   c_type.Uint256
	TxHash c_type.Uint256
	Nil    c_type.Uint256
	Num    uint64
	Asset  assets.Asset
	IsZ    bool
	Ignore bool
	// contains filtered or unexported fields
}

func (*Utxo) DecodeRLP

func (b *Utxo) DecodeRLP(s *rlp.Stream) error

func (*Utxo) EncodeRLP

func (b *Utxo) EncodeRLP(w io.Writer) error

func (*Utxo) NilTxType

func (utxo *Utxo) NilTxType() string

type UtxoList

type UtxoList []Utxo

func (UtxoList) Len

func (list UtxoList) Len() int

func (UtxoList) Less

func (list UtxoList) Less(i, j int) bool

func (UtxoList) Roots

func (list UtxoList) Roots() (roots prepare.Utxos)

func (UtxoList) Swap

func (list UtxoList) Swap(i, j int)

type Utxo_Version0

type Utxo_Version0 struct {
	Pkr    c_type.PKr
	Root   c_type.Uint256
	TxHash c_type.Uint256
	Nil    c_type.Uint256
	Num    uint64
	Asset  assets.Asset
	IsZ    bool
}

type Utxo_Version1

type Utxo_Version1 struct {
	Ignore bool
}

Jump to

Keyboard shortcuts

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