services

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	// RetrieveTrades is used to get logs from the "OrderSettled" event preps market contract within given block range
	RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)

	// RetrieveTradesLimit is used to get all trades and their additional data from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveTradesLimit(limit uint64) ([]*models.Trade, error)

	// RetrieveOrders is used to get logs from the "OrderCommitted" event preps market contract within given block range
	RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)

	// RetrieveOrdersLimit is used to get all orders and their additional data from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveOrdersLimit(limit uint64) ([]*models.Order, error)

	// RetrieveMarketUpdates is used to get logs from the "MarketUpdated" event preps market contract within given block
	// range
	RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error)

	// RetrieveMarketUpdatesLimit is used to get all market updates and their additional data from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)

	// RetrieveLiquidations is used to get logs from the "PositionLiquidated" event preps market contract within given block
	// range
	RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error)

	// RetrieveLiquidationsLimit is used to get all liquidations and their additional data from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error)

	// GetPosition is used to get "Position" data struct from the latest block from the perps market with given data
	GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error)

	// GetMarketMetadata is used to get market metadata by given market ID
	GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error)

	// GetMarketSummary is used to get market summary by given market ID
	GetMarketSummary(marketID *big.Int) (*models.MarketSummary, error)

	// GetMarketIDs is used to get market IDs from the smart contract
	GetMarketIDs() ([]*big.Int, error)

	// FormatAccount is used to get account, and it's additional data from the contract by given account id
	FormatAccount(id *big.Int) (*models.Account, error)

	// FormatAccounts is used to get all accounts and their additional data from the contract
	FormatAccounts() ([]*models.Account, error)

	// FormatAccountsLimit is used to get all accounts and their additional data from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	FormatAccountsLimit(limit uint64) ([]*models.Account, error)
}

IService is a service layer interface

func NewService

func NewService(
	rpc *ethclient.Client,
	core *coreGoerli.CoreGoerli,
	coreFirstBlock uint64,
	spotMarket *spotMarketGoerli.SpotMarketGoerli,
	spotMarketFirstBlock uint64,
	perpsMarket *perpsMarketGoerli.PerpsMarketGoerli,
	perpsMarketFirstBlock uint64,
) IService

NewService is used to get instance of Service

type Service

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

Service is an implementation of IService interface

func (*Service) FormatAccount added in v0.1.2

func (s *Service) FormatAccount(id *big.Int) (*models.Account, error)

func (*Service) FormatAccounts added in v0.1.2

func (s *Service) FormatAccounts() ([]*models.Account, error)

func (*Service) FormatAccountsLimit added in v0.1.2

func (s *Service) FormatAccountsLimit(limit uint64) ([]*models.Account, error)

func (*Service) GetMarketIDs added in v0.1.7

func (s *Service) GetMarketIDs() ([]*big.Int, error)

func (*Service) GetMarketMetadata added in v0.1.6

func (s *Service) GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error)

func (*Service) GetMarketSummary added in v0.1.7

func (s *Service) GetMarketSummary(marketID *big.Int) (*models.MarketSummary, error)

func (*Service) GetPosition added in v0.0.2

func (s *Service) GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error)

func (*Service) RetrieveLiquidations added in v0.1.3

func (s *Service) RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error)

func (*Service) RetrieveLiquidationsLimit added in v0.1.3

func (s *Service) RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error)

func (*Service) RetrieveMarketUpdates added in v0.1.1

func (s *Service) RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error)

func (*Service) RetrieveMarketUpdatesLimit added in v0.1.4

func (s *Service) RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)

func (*Service) RetrieveOrders added in v0.1.0

func (s *Service) RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)

func (*Service) RetrieveOrdersLimit added in v0.1.4

func (s *Service) RetrieveOrdersLimit(limit uint64) ([]*models.Order, error)

func (*Service) RetrieveTrades

func (s *Service) RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)

func (*Service) RetrieveTradesLimit added in v0.1.4

func (s *Service) RetrieveTradesLimit(limit uint64) ([]*models.Trade, error)

Jump to

Keyboard shortcuts

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