exchange

package
v0.0.0-...-93382e6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: GPL-3.0 Imports: 29 Imported by: 0

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)

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

Jump to

Keyboard shortcuts

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