timing_matcher

package
v0.0.0-...-491e088 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderHashPrefix          = "matcher_orderhash_"
	OwnerPrefix              = "matcher_owner_"
	RingHashPrefix           = "matcher_ringhash_"
	RoundPrefix              = "matcher_round_"
	FailedRingPrefix         = "failed_ring_"
	FailedOrderPrefix        = "failed_order_"
	RinghashToUniqueIdPrefix = "ringhash_uniqid_"
)

orderhash ringhash matchedstate owner tokenS orderhash ringhash orderhash+owner+tokens round orderhash

Variables

This section is empty.

Functions

func AddFailedRingCache

func AddFailedRingCache(uniqueId, txhash common.Hash, orderhashes []common.Hash)

func AddMinedRing

func AddMinedRing(ringState *types.RingSubmitInfo)

添加已经提交了的环路

func CacheRinghashToUniqueId

func CacheRinghashToUniqueId(ringhash, uniqueId common.Hash)

func CachedMatchedRing

func CachedMatchedRing(ringhash common.Hash) (bool, error)

func CachedRinghashes

func CachedRinghashes() ([]common.Hash, error)

func DealtAmount

func DealtAmount(orderhash common.Hash) (dealtAmountS, dealtAmountB *big.Rat, err error)

func FilledAmountS

func FilledAmountS(owner, tokenS common.Address) (filledAmountS *big.Rat, err error)

func GetUniqueIdByRinghash

func GetUniqueIdByRinghash(ringhash common.Hash) (common.Hash, error)

func OrderExecuteFailedCount

func OrderExecuteFailedCount(orderhash common.Hash) (int64, error)

func RemoveMinedRingAndReturnOrderhashes

func RemoveMinedRingAndReturnOrderhashes(ringhash common.Hash) ([]common.Hash, error)

func RingExecuteFailedCount

func RingExecuteFailedCount(uniqueId common.Hash) (int64, error)

Types

type CandidateRing

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

type CandidateRingList

type CandidateRingList []CandidateRing

func (CandidateRingList) Len

func (ringList CandidateRingList) Len() int

func (CandidateRingList) Less

func (ringList CandidateRingList) Less(i, j int) bool

func (CandidateRingList) Swap

func (ringList CandidateRingList) Swap(i, j int)

type Market

type Market struct {
	TokenA     common.Address
	TokenB     common.Address
	AtoBOrders map[common.Hash]*types.OrderState
	BtoAOrders map[common.Hash]*types.OrderState

	AtoBOrderHashesExcludeNextRound []common.Hash
	BtoAOrderHashesExcludeNextRound []common.Hash
	// contains filtered or unexported fields
}

func NewMarket

func NewMarket(protocolAddress *ethaccessor.ProtocolAddress, tokenS, tokenB common.Address, matcher *TimingMatcher, om ordermanager.OrderManager) *Market

func (*Market) GenerateCandidateRing

func (market *Market) GenerateCandidateRing(orders ...*types.OrderState) (*CandidateRing, error)

type OrderMatchedState

type OrderMatchedState struct {
	//ringHash      common.Hash `json:"ringhash"`
	FilledAmountS *types.Rat `json:"filled_amount_s"`
	FilledAmountB *types.Rat `json:"filled_amount_b"`
}

type TimingMatcher

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

func NewTimingMatcher

func NewTimingMatcher(matcherOptions *config.TimingMatcher, submitter *miner.RingSubmitter, evaluator *miner.Evaluator, om ordermanager.OrderManager, accountManager *marketLib.AccountManager, rds dao.RdsService) *TimingMatcher

func (*TimingMatcher) GetAccountAvailableAmount

func (matcher *TimingMatcher) GetAccountAvailableAmount(address, tokenAddress, spender common.Address) (*big.Rat, error)

func (*TimingMatcher) Start

func (matcher *TimingMatcher) Start()

func (*TimingMatcher) Stop

func (matcher *TimingMatcher) Stop()

Jump to

Keyboard shortcuts

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