syncer

package
v0.0.103 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PROGRESS_SYNC_STATE = "user_info" // compatible
	PROGRESS_INIT_FEE   = "user_info.init_fee"
	PROGRESS_SNAPSHOT   = "user_info.snapshot"
)
View Source
var (
	ErrNotInEpoch = errors.New("not in epoch period")
)
View Source
var TEST_ERROR = errors.New("test error")

Functions

func GetOIFeeValue added in v0.0.66

func GetOIFeeValue(
	accounts []*mai3.MarginAccount, blockNumbers int64, cache map[string]decimal.Decimal,
	mai3Graph mai3.GraphInterface) (oi, totalFee, daoFee, totalFeeFactor, daoFeeFactor decimal.Decimal, err error)

func GetRemainMinutes added in v0.0.58

func GetRemainMinutes(timestamp int64, epoch *mining.Schedule) decimal.Decimal

Types

type MockBlockGraph1 added in v0.0.57

type MockBlockGraph1 struct{}

func NewMockBlockGraph1 added in v0.0.57

func NewMockBlockGraph1() *MockBlockGraph1

func (*MockBlockGraph1) GetBlockNumberWithTS added in v0.0.57

func (mockBlock *MockBlockGraph1) GetBlockNumberWithTS(timestamp int64) (int64, error)

func (*MockBlockGraph1) GetLatestBlockNumberAndTS added in v0.0.87

func (mockBlock *MockBlockGraph1) GetLatestBlockNumberAndTS() (int64, int64, error)

func (*MockBlockGraph1) GetTimestampWithBN added in v0.0.75

func (mockBlock *MockBlockGraph1) GetTimestampWithBN(blockNumber int64) (int64, error)

type MockMAI3Graph1 added in v0.0.57

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

func NewMockMAI3Graph1 added in v0.0.57

func NewMockMAI3Graph1() *MockMAI3Graph1

func (*MockMAI3Graph1) GetMarkPriceWithBlockNumberAddrIndex added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) GetMarkPriceWithBlockNumberAddrIndex(blockNumber int64, poolAddr string, perpIndex int) (decimal.Decimal, error)

func (*MockMAI3Graph1) GetMarkPrices added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) GetMarkPrices(blockNumber int64) (map[string]decimal.Decimal, error)

func (*MockMAI3Graph1) GetPerpIDWithUSDBased added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) GetPerpIDWithUSDBased(symbol string) (string, error)

func (*MockMAI3Graph1) GetUsersBasedOnBlockNumber added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) GetUsersBasedOnBlockNumber(blockNumber int64) ([]mai3.User, error)

func (*MockMAI3Graph1) InBTCInverseContractWhiteList added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) InBTCInverseContractWhiteList(perpID string) (bool, string)

func (*MockMAI3Graph1) InETHInverseContractWhiteList added in v0.0.57

func (mockMAI3 *MockMAI3Graph1) InETHInverseContractWhiteList(perpID string) (bool, string)

func (*MockMAI3Graph1) InSATSInverseContractWhiteList added in v0.0.66

func (mockMAI3 *MockMAI3Graph1) InSATSInverseContractWhiteList(perpID string) (bool, string)

type MockMAI3Graph2 added in v0.0.57

type MockMAI3Graph2 struct{}

func NewMockMAI3Graph2 added in v0.0.57

func NewMockMAI3Graph2() *MockMAI3Graph2

func (*MockMAI3Graph2) GetMarkPriceWithBlockNumberAddrIndex added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) GetMarkPriceWithBlockNumberAddrIndex(blockNumber int64, poolAddr string, perpIndex int) (decimal.Decimal, error)

func (*MockMAI3Graph2) GetMarkPrices added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) GetMarkPrices(blockNumber int64) (map[string]decimal.Decimal, error)

func (*MockMAI3Graph2) GetPerpIDWithUSDBased added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) GetPerpIDWithUSDBased(symbol string) (string, error)

func (*MockMAI3Graph2) GetUsersBasedOnBlockNumber added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) GetUsersBasedOnBlockNumber(blockNumber int64) ([]mai3.User, error)

func (*MockMAI3Graph2) InBTCInverseContractWhiteList added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) InBTCInverseContractWhiteList(perpID string) (bool, string)

func (*MockMAI3Graph2) InETHInverseContractWhiteList added in v0.0.57

func (mockMAI3 *MockMAI3Graph2) InETHInverseContractWhiteList(perpID string) (bool, string)

func (*MockMAI3Graph2) InSATSInverseContractWhiteList added in v0.0.66

func (mockMAI3 *MockMAI3Graph2) InSATSInverseContractWhiteList(perpID string) (bool, string)

type MockMultiBlockGraphs added in v0.0.57

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

func NewMockMultiBlockGraphsMultiChain added in v0.0.57

func NewMockMultiBlockGraphsMultiChain() *MockMultiBlockGraphs

func NewMockMultiBlockGraphsOneChain added in v0.0.57

func NewMockMultiBlockGraphsOneChain() *MockMultiBlockGraphs

func (*MockMultiBlockGraphs) GetMultiBlockNumberWithTS added in v0.0.57

func (mockMultiBlocks *MockMultiBlockGraphs) GetMultiBlockNumberWithTS(timestamp int64) ([]int64, error)

type MockMultiMAI3Graphs added in v0.0.57

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

func NewMockMultiMAI3GraphsMultiChain added in v0.0.57

func NewMockMultiMAI3GraphsMultiChain() *MockMultiMAI3Graphs

func NewMockMultiMAI3GraphsOneChain added in v0.0.57

func NewMockMultiMAI3GraphsOneChain() *MockMultiMAI3Graphs

func (*MockMultiMAI3Graphs) GetMai3GraphInterface added in v0.0.57

func (mockMultiMAI3Graphs *MockMultiMAI3Graphs) GetMai3GraphInterface(
	index int) (mai3.GraphInterface, error)

func (*MockMultiMAI3Graphs) GetMultiMarkPrices added in v0.0.57

func (mockMultiMAI3Graphs *MockMultiMAI3Graphs) GetMultiMarkPrices(
	blockNumbers []int64) (map[string]decimal.Decimal, error)

func (*MockMultiMAI3Graphs) GetMultiUsersBasedOnMultiBlockNumbers added in v0.0.57

func (mockMultiMAI3Graphs *MockMultiMAI3Graphs) GetMultiUsersBasedOnMultiBlockNumbers(
	blockNumbers []int64) ([][]mai3.User, error)

type Syncer

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

func NewSyncer

func NewSyncer(
	ctx context.Context, logger logging.Logger, multiMAI3GraphClient *mai3.MultiClient,
	multiBlockGraphClient *block.MultiClient, defaultEpochStartTime int64, syncDelaySeconds int64,
	snapshotInterval int64,
) *Syncer

func (*Syncer) Run

func (s *Syncer) Run() error

Jump to

Keyboard shortcuts

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