syncer

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EMPTY_SCHEDULE = errors.New("empty schedule")
View Source
var NOT_IN_EPOCH = errors.New("not in epoch period")
View Source
var Transport = &http.Transport{
	DialContext: (&net.Dialer{
		Timeout: 500 * time.Millisecond,
	}).DialContext,
	TLSHandshakeTimeout: 1000 * time.Millisecond,
	MaxIdleConns:        100,
	IdleConnTimeout:     30 * time.Second,
}

Functions

This section is empty.

Types

type Block added in v0.0.2

type Block struct {
	ID        string `json:"id"`
	Number    string `json:"number"`
	Timestamp string `json:"timestamp"`
}

type BlockSyncer added in v0.0.2

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

func NewBlockSyncer added in v0.0.2

func NewBlockSyncer(ctx context.Context, logger logging.Logger, blockSyncerGraphUrl string, startTime *time.Time) *BlockSyncer

func (*BlockSyncer) Init added in v0.0.2

func (s *BlockSyncer) Init()

func (*BlockSyncer) Run added in v0.0.2

func (s *BlockSyncer) Run() error

type MarginAccount added in v0.0.2

type MarginAccount struct {
	ID       string          `json:"id"`
	Position decimal.Decimal `json:"position"`
}

type Syncer

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

func NewSyncer

func NewSyncer(
	ctx context.Context, logger logging.Logger, mai3GraphUrl string,
	blockGraphUrl string, blockStartTime *time.Time,
) *Syncer

func (*Syncer) GetMarkPriceBasedOnBlockNumber added in v0.0.2

func (s *Syncer) GetMarkPriceBasedOnBlockNumber(blockNumber int64, poolAddr string, perpetualIndex int) (*decimal.Decimal, error)

func (*Syncer) GetPoolAddrIndexUserID added in v0.0.2

func (s *Syncer) GetPoolAddrIndexUserID(marginAccountID string) (poolAddr, userId string, perpetualIndex int, err error)

func (*Syncer) GetUsersBasedOnBlockNumber added in v0.0.2

func (s *Syncer) GetUsersBasedOnBlockNumber(blockNumber int64) ([]User, error)

func (*Syncer) Init added in v0.0.2

func (s *Syncer) Init()

func (*Syncer) Run

func (s *Syncer) Run() error

func (*Syncer) TimestampToBlockNumber added in v0.0.2

func (s *Syncer) TimestampToBlockNumber(startTime int64) (int64, error)

type User added in v0.0.2

type User struct {
	ID             string          `json:"id"`
	StakedMCB      decimal.Decimal `json:"stakedMCB"`
	TotalFee       decimal.Decimal `json:"totalFee"`
	MarginAccounts []*MarginAccount
}

Jump to

Keyboard shortcuts

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