miner

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 21 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ZKLOCK_SUBMITTER_MINER_ADDR_PRE = "zklock_submitter_miner_addr_"
)

Variables

This section is empty.

Functions

func CVSquare

func CVSquare(rateRatios []*big.Int, scale *big.Int) *big.Int

func NewRing

func NewRing(filledOrders []*types.FilledOrder) *types.Ring

func PriceRateCVSquare

func PriceRateCVSquare(ringState *types.Ring) (*big.Int, error)

func PriceValid

func PriceValid(a2BOrder *types.OrderState, b2AOrder *types.OrderState) bool

成环之后才可计算能否成交,否则不需计算,判断是否能够成交,不能使用除法计算

func ReducedRate

func ReducedRate(ringState *types.Ring) *big.Rat

Types

type Evaluator

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

func NewEvaluator

func NewEvaluator(marketCapProvider marketcap.MarketCapProvider, minerOptions config.MinerOptions) *Evaluator

func (*Evaluator) ComputeRing

func (e *Evaluator) ComputeRing(ringState *types.Ring) error

func (*Evaluator) SetMatcher

func (e *Evaluator) SetMatcher(matcher Matcher)

type Matcher

type Matcher interface {
	Start()
	Stop()
	GetAccountAvailableAmount(address, tokenAddress, spender common.Address) (*big.Rat, error)
}

type Miner

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

func NewMiner

func NewMiner(submitter *RingSubmitter, matcher Matcher, evaluator *Evaluator, marketCapProvider marketcap.MarketCapProvider) *Miner

func (*Miner) Start

func (minerInstance *Miner) Start()

func (*Miner) Stop

func (minerInstance *Miner) Stop()

type NormalSenderAddress

type NormalSenderAddress struct {
	Address         common.Address
	GasPriceLimit   *big.Int
	MaxPendingTtl   int
	MaxPendingCount int64

	Nonce *big.Int
}

type RingSubmitFailed

type RingSubmitFailed struct {
	RingState *types.Ring
	// contains filtered or unexported fields
}

type RingSubmitter

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

保存ring,并将ring发送到区块链,同样需要分为待完成和已完成

func NewSubmitter

func NewSubmitter(options config.MinerOptions, dbService dao.RdsServiceImpl, brokers []string) (*RingSubmitter, error)

func (*RingSubmitter) GenerateRingSubmitInfo

func (submitter *RingSubmitter) GenerateRingSubmitInfo(ringState *types.Ring) (*types.RingSubmitInfo, error)

type SplitMinerAddress

type SplitMinerAddress struct {
	Address    common.Address
	FeePercent float64
	StartFee   float64

	Nonce *big.Int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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