perpsv3_Go

package module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 12 Imported by: 0

README

perpsv3-Go

This repository contains a Go library for interacting with smart contracts related to a Synthetix V3 DeFi protocol. It includes components to work with Core, Spot Market, and Perps Market contracts deployed on the Optimism mainnet and Optimistic Goerli testnet.

Table of Contents

Getting started

To install a library use:

go get github.com/gateway-fm/perpsv3-Go
go mod tidy

A usage example:

package main

import (
	"log"

	perpsv3_Go "github.com/gateway-fm/perpsv3-Go"
	"github.com/gateway-fm/perpsv3-Go/config"
)

func main() {
	perpsLib, err := perpsv3_Go.Create(config.GetGoerliDefaultPerpsvConfig())
	if err != nil {
		log.Fatal(err)
	}
	//...
}

Configuration

You can use a default configurations. For now only two default configurations are available:

A configuration for Goerli Optimistic testnet:

func GetGoerliDefaultPerpsvConfig() *PerpsvConfig {
	return &PerpsvConfig{
		RPC: "https://rpc.goerli.optimism.gateway.fm",
		ContractAddresses: &ContractAddresses{
			Core:        "0x76490713314fCEC173f44e99346F54c6e92a8E42",
			SpotMarket:  "0x5FF4b3aacdeC86782d8c757FAa638d8790799E83",
			PerpsMarket: "0xf272382cB3BE898A8CdB1A23BE056fA2Fcf4513b",
		},
		FirstContractBlocks: &FirstContractBlocks{
			Core:        11664658,
			SpotMarket:  10875051,
			PerpsMarket: 12708889,
		},
		ConnectionTimeout: time.Second * 30,
		ReadTimeout:       time.Second * 15,
	}
}

And a configuration for Optimism mainnet. Be informed that mainnet configs will return an error at this version due to the luck of Perps Market contract address on mainnnet.

func GetOptimismDefaultPerpsvConfig() *PerpsvConfig {
	return &PerpsvConfig{
		RPC: "https://rpc.optimism.gateway.fm",
		ContractAddresses: &ContractAddresses{
			Core:        "0xffffffaEff0B96Ea8e4f94b2253f31abdD875847",
			SpotMarket:  "0x38908Ee087D7db73A1Bd1ecab9AAb8E8c9C74595",
			PerpsMarket: "",
		},
		FirstContractBlocks: &FirstContractBlocks{
			Core:        94847041,
			SpotMarket:  94846457,
			PerpsMarket: 0,
		},
		ConnectionTimeout: time.Second * 30,
		ReadTimeout:       time.Second * 15,
	}
}

You can use you own configuration by creating a Config instance:

package main

import (
	"log"
	perpsv3_Go "github.com/gateway-fm/perpsv3-Go"
	"github.com/gateway-fm/perpsv3-Go/config"
)

func main() {
	conf := &config.PerpsvConfig{
		RPC: "https://rpc.optimism.gateway.fm",
		//...
	}

	perpsLib, err := perpsv3_Go.Create(conf)
	if err != nil {
		log.Fatal(err)
	}
	//...
}

API Reference

Trades
Model

Using Trades services you operate with Trades model which represents a OrderSettled event of Perps Market smart-contract with some additional fields:

type Trade struct {
	// Event fields:
	MarketID         uint64          // ID of the market used for the trade
	AccountID        uint64          // ID of the account used for the trade
	FillPrice        *big.Int        // Price at which the order was settled
	PnL              *big.Int        // PL of the previous closed position
	AccruedFunding   *big.Int        // Accrued funding of the previous closed position
	SizeDelta        *big.Int        // Size delta from the order
	NewSize          *big.Int        // New size of the position after settlement
	TotalFees        *big.Int        // Amount of fees collected by the protocol
	ReferralFees     *big.Int        // Amount of fees collected by the referrer
	CollectedFees    *big.Int        // Amount of fees collected by the fee collector
	SettlementReward *big.Int        // Amount of fees collected by the settler
	TrackingCode     [32]byte        // Optional code for integrator tracking purposes
	Settler          common.Address  // Address of the settler of the order
	// Additional fields:
	BlockNumber      uint64          // Block number where the trade was settled
	BlockTimestamp   uint64          // Timestamp of the block where the trade was settled
	TransactionHash  string          // Hash of the transaction where the trade was settled
}
RetrieveTrades()

To get trades for specific block range use the RetrieveTrades function:

func RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error) {}
  • Default value for fromBlock is a first contract block that you give in the configs
  • Default value for toBlock is a latest blockchain block
  • To use default values set 0 for fromBlock and nil for toBlock
  • For specific block data use same values for fromBlock and toBlock
  • For all contract data use default values
  • For a range of blocks use required block IDs

Warning

If you want to query more than 20 000 block or query old block be sure you use a private PRC provider

RetrieveTradesLimit()

To get all trades with RPC provider block limiration use the RetrieveTrades function:

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

The function will query blocks several times from the first contract block to the latest block until all blocks are queried. If the contract was deployed a long time ago the function can take more than 1 minute to work.

  • Default value for limit is a 20 000 blocks per one query
ListenTrades()

To subscribe on the contract OrederSettled event use the ListenTrades function.

func ListenTrades() (*events.TradeSubscription, error) {}

The goroutine will return events as a Trade model on the TradesChan chanel and errors on the ErrChan chanel. To close the subscription use the Close function.

You can see an example of the usage here:

package main

import (
	"fmt"
	"log"
	"time"

	perpsv3_Go "github.com/gateway-fm/perpsv3-Go"
	"github.com/gateway-fm/perpsv3-Go/config"
)

func main() {
	lib, err := perpsv3_Go.Create(config.GetGoerliDefaultPerpsvConfig())
	if err != nil {
		log.Fatal(err)
	}

	subs, err := lib.ListenTrades()
	if err != nil {
		log.Fatal(err)
	}

	stopChan := make(chan struct{})

	// handle events
	go func() {
		for {
			select {
			case <-stopChan:
				subs.Close()
				return
			case err = <-subs.ErrChan:
				log.Println(err.Error())
			case trade := <-subs.TradesChan:
				fmt.Println(trade.AccountID)
				fmt.Println(trade.AccruedFunding)
			}
		}
	}()

	time.Sleep(10 * time.Second)

	// stop listening
	close(stopChan)

	time.Sleep(5 * time.Second)

}
Orders
Model

Using Orders services you operate with Orders model which represents a OrderCommitted event of Perps Market smart-contract with some additional fields:

type Order struct {
    // Event fields:
	MarketID        uint64          // ID of the market used for the trade
	AccountID       uint64          // ID of the account used for the trade
    OrderType       uint8           // Represents the transaction type (0 at the time of writing)
	SizeDelta       *big.Int        // Requested change in size of the order
    AcceptablePrice *big.Int        // Maximum or minimum accepted price to settle the order.
    SettlementTime  uint64          // Time at which the order can be settled.
    ExpirationTime  uint64          // Time at which the order expired.
    TrackingCode    [32]byte        // Optional code for integrator tracking purposes.
    Sender          common.Address  // Address of the sender of the order.
    // Additional fields:
    BlockNumber      uint64         // Block number where the trade was settled
    BlockTimestamp   uint64         // Timestamp of the block where the trade was settled
}
RetrieveOrders()

To get orders for specific block range use the RetrieveOrders function:

func RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error) {}
  • Default value for fromBlock is a first contract block that you give in the configs
  • Default value for toBlock is a latest blockchain block
  • To use default values set 0 for fromBlock and nil for toBlock
  • For specific block data use same values for fromBlock and toBlock
  • For all contract data use default values
  • For a range of blocks use required block IDs

Warning

If you want to query more than 20 000 block or query old block be sure you use a private PRC provider

RetrieveOrdersLimit()

To get all orders with RPC provider block limitation use the RetrieveOrdersLimit function:

func RetrieveOrdersLimit(limit uint64) ([]*models.Order, error) {}

The function will query blocks several times from the first contract block to the latest block until all blocks are queried. If the contract was deployed a long time ago the function can take more than 1 minute to work.

  • Default value for limit is a 20 000 blocks per one query
ListenOrders()

To subscribe on the contract OrederCommitted event use the ListenOrders function.

func ListenOrders() (*events.OrderSubscription, error) {}

The goroutine will return events as a Order model on the OrdersChan chanel and errors on the ErrChan chanel. To close the subscription use the Close function.

Markets

You can query current market IDs, current market metadata and current market summary

Models
type MarketMetadata struct {
    MarketID *big.Int // is a market ID value
    Name     string   // is a market name value
    Symbol   string   // is a market symbol value for example 'ETH'
}
type MarketSummary struct {
	MarketID               *big.Int // Represents the ID of the market
	Skew                   *big.Int // Represents the skew of the market
	Size                   *big.Int // Represents the size of the market
	MaxOpenInterest        *big.Int // Represents the maximum open interest of the market
	CurrentFundingRate     *big.Int // Represents the current funding rate of the market
	CurrentFundingVelocity *big.Int // Represents the current funding velocity of the market
	IndexPrice             *big.Int // Represents the index price of the market
}
GetMarketIds()

To get available market IDs use GetMarketIDs function

func GetMarketIDs() ([]*big.Int, error) {}
GetMarketMetadata()

To get current market metadata by given market ID use GetMarketMetadata function

func GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error) {}
GetMarketSummary()

To get current market summary by given market ID use GetMarketSummary function

func GetMarketSummary(marketID *big.Int) (*models.MarketSummary, error) {}
GetFoundingRate()

To get current founding rate by given market ID use GetFoundingRate function

func GetFoundingRate(id *big.Int) (*big.Int, error) {}
MarketUpdate
Models

Using MarketData services you operate with MarketUpdate model which represents a MarketUpdated event of Perps Market smart-contract with some additional fields:

type MarketUpdate struct {
	// Event fields
    MarketID               uint64  // ID of the market.
    Price                  uint64  // Price at the time of the event.
    Skew                   int64   // Market skew at the time of the event. Positive values indicate more longs.
    Size                   uint64  // Size of the entire market after settlement.
    SizeDelta              int64   // Change in market size during the update.
    CurrentFundingRate     int64   // Current funding rate of the market.
    CurrentFundingVelocity int64   // Current rate of change of the funding rate.
	// Additional fields
    BlockNumber            uint64  // Block number at which the market data was fetched.
    BlockTimestamp         uint64  // Timestamp of the block at which the market data was fetched.
    TransactionHash        string  // Hash of the transaction where the market update occurred.
}

You can also use MarketDataBig model, it will operate with big.Int value types instead of uint64 and int64. Only methods with Big suffix can operate with this model

type MarketUpdateBig struct {
	MarketID               *big.Int
	Price                  *big.Int
	Skew                   *big.Int
	Size                   *big.Int
	SizeDelta              *big.Int
	CurrentFundingRate     *big.Int
	CurrentFundingVelocity *big.Int
	BlockNumber            uint64
	BlockTimestamp         uint64
	TransactionHash        string
}
RetrieveMarketUpdates() / RetrieveMarketUpdatesBig()

To get market update data for specific block range use the RetrieveMarketUpdates or RetrieveMarketUpdatesBig functions:

func RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error) {}
func RetrieveMarketUpdatesBig(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdateBig, error) {}
  • Default value for fromBlock is a first contract block that you give in the configs
  • Default value for toBlock is a latest blockchain block
  • To use default values set 0 for fromBlock and nil for toBlock
  • For specific block data use same values for fromBlock and toBlock
  • For all contract data use default values
  • For a range of blocks use required block IDs

Warning

If you want to query more than 20 000 block or query old block be sure you use a private PRC provider

RetrieveMarketUpdatesLimit() / RetrieveMarketUpdatesBigLimit()

To get all market updates with RPC provider block limitation use the RetrieveMarketUpdatesLimit or RetrieveMarketUpdatesBigLimit functions:

func RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error) {}
func RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, error) {}

The function will query blocks several times from the first contract block to the latest block until all blocks are queried. If the contract was deployed a long time ago the function can take more than 1 minute to work.

  • Default value for limit is a 20 000 blocks per one query
ListenMarketUpdate() / ListenMarketUpdatesBig()

To subscribe on the contract MarketUpdated event use the ListenMarketUpdates or ListenMarketUpdatesBig functions.

func ListenMarketUpdates() (*events.MarketUpdateSubscription, error)
func ListenMarketUpdatesBig() (*MarketUpdateSubscriptionBig, error)

The goroutine will return events as a MarketUpdate or MarketUpdateBig model on the MarketUpdateChan chanel and errors on the ErrChan chanel. To close the subscription use the Close function.

Positions
Model

Using Positions services you operate with Position model which represents a OpenPosition data struct of Perps Market smart-contract with some additional fields:

type Position struct {
	// Data from the contract
	TotalPnl       *big.Int // Represents the total profit and loss for the position
	AccruedFunding *big.Int // Represents the accrued funding for the position
	PositionSize   *big.Int // Represents the size of the position
	// Data from the latest block
	BlockNumber    uint64   // Represents the block number at which the position data was fetched
	BlockTimestamp uint64   // Represents the timestamp of the block at which the position data was fetched
}
GetPosition()

To get Position by reading contract with getOpenPosition method use the GetPosition function:

func GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error) {}

It will return data from the contract in the latest block. Function can return contract error if the market ID is invalid. If account ID is invalid it will return model with blank fields.

Liquidations
Model

Using Liquidations services you operate with Liquidation model which represents a PositionLiquidated event of Perps Market smart-contract with some additional fields:

type Liquidation struct {
	// Event fields
	MarketID            uint64   // ID of the market used for the order.
	AccountID           uint64   // ID of the account used for the order.
	AmountLiquidated    *big.Int // amount liquidated.
	CurrentPositionSize *big.Int // position size after liquidation.
	// Additional fields
	BlockNumber         uint64   // Block number where the order was committed.
	BlockTimestamp      uint64   // Timestamp of the block where the order was committed.
}
RetrieveLiquidations()

To get liquidations for specific block range use the RetrieveLiquidations function:

func RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error) {}
  • Default value for fromBlock is a first contract block that you give in the configs
  • Default value for toBlock is a latest blockchain block
  • To use default values set 0 for fromBlock and nil for toBlock
  • For specific block data use same values for fromBlock and toBlock
  • For all contract data use default values

Warning

If you want to query more than 20 000 block or query old block be sure you use a private PRC provider

RetrieveLiquidationsLimit()

To get all luquidations with RPC provider block limitation use the RetrieveLiquidationsLimit function:

func RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error) {}

The function will query blocks several times from the first contract block to the latest block until all blocks are queried. If the contract was deployed a long time ago the function can take more than 1 minute to work.

  • Default value for limit is a 20 000 blocks per one query
ListenLiquidations()

To subscribe on the contract PositionLiquidated event use the ListenLiquidations function.

func ListenLiquidations() (*LiquidationSubscription, error) {}

The goroutine will return events as a Liquidation model on the LiquidationsChan chanel and errors on the ErrChan chanel. To close the subscription use the Close function.

License

This project is licensed under the MIT License.# asatruPythonE2E

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBaseAndromedaDefaultConfig added in v0.1.26

func GetBaseAndromedaDefaultConfig(rpcURL string) *config.PerpsvConfig

func GetBaseMainnetDefaultConfig added in v0.3.1

func GetBaseMainnetDefaultConfig(rpcURL string) *config.PerpsvConfig

func GetBaseSepoliaDefaultConfig added in v0.3.6

func GetBaseSepoliaDefaultConfig(rpcURL string) *config.PerpsvConfig

func GetOptimismGoerliDefaultConfig added in v0.1.26

func GetOptimismGoerliDefaultConfig(rpcURL string) *config.PerpsvConfig

Types

type IPerpsv3

type IPerpsv3 interface {
	// RetrieveTrades is used to get logs from the "OrderSettled" event perps market contract within given block range
	//   - use 0 for fromBlock to use default value of a first contract block
	//   - use nil for toBlock to use default value of a last blockchain block
	RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)

	// RetrieveTradesLimit is used to get all "OrderSettled" events and their additional data from the contract
	// with given block search limit. If given limit is 0 function will set default value to 20 000 blocks
	RetrieveTradesLimit(limit uint64) ([]*models.Trade, error)

	// RetrieveOrders is used to get logs from the "OrderCommitted" event perps market contract within given block range
	//   - use 0 for fromBlock to use default value of a first contract block
	//   - use nil for toBlock to use default value of a last blockchain block
	RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)

	// RetrieveOrdersLimit is used to get all "OrderCommitted" events and their additional data from the contract
	// with given block search limit. If given limit is 0 function will set default value to 20 000 blocks
	RetrieveOrdersLimit(limit uint64) ([]*models.Order, error)

	// RetrieveMarketUpdates is used to get logs from the "MarketUpdated" event perps market contract within given block
	// range
	//   - use 0 for fromBlock to use default value of a first contract block
	//   - use nil for toBlock to use default value of a last blockchain block
	RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error)

	// RetrieveMarketUpdatesBig is used to get logs from the "MarketUpdated" event perps market contract within given block
	// range
	//   - use 0 for fromBlock to use default value of a first contract block
	//   - use nil for toBlock to use default value of a last blockchain block
	// It will return a MarketUpdateBig model with big.Int values
	RetrieveMarketUpdatesBig(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdateBig, error)

	// RetrieveMarketUpdatesLimit is used to get all "MarketUpdated" events and their additional data from the contract
	// with given block search limit. If given limit is 0 function will set default value to 20 000 blocks
	RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)

	// RetrieveMarketUpdatesBigLimit is used to get all "MarketUpdated" events and their additional data from the contract
	// with given block search limit. If given limit is 0 function will set default value to 20 000 blocks
	// It will return a MarketUpdateBig model with big.Int values
	RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, error)

	// RetrieveLiquidations is used to get logs from the "PositionLiquidated" event perps market contract within given block
	// range
	//   - use 0 for fromBlock to use default value of a first contract block
	//   - use nil for toBlock to use default value of a last blockchain block
	RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error)

	// RetrieveLiquidationsLimit is used to get all "PositionLiquidated" events 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)

	// RetrieveAccountLiquidationsLimit is used to get all account liquidated events from the contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveAccountLiquidationsLimit(limit uint64) ([]*models.AccountLiquidated, error)

	// RetrieveUSDMintedLimit is used to get all `usdMinted` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveUSDMintedLimit(limit uint64) ([]*models.USDMinted, error)

	// RetrieveUSDMintedLimit is used to get all `usdMinted` events from the Core contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveUSDMinted(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDMinted, error)

	// RetrieveUSDBurnedLimit is used to get all `usdBurned` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveUSDBurnedLimit(limit uint64) ([]*models.USDBurned, error)

	// RetrieveUSDBurnedLimit is used to get all `usdBurned` events from the Core contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveUSDBurned(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDBurned, error)

	// RetrieveDelegationUpdatedLimit is used to get all `DelegationUpdated` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveDelegationUpdatedLimit(limit uint64) ([]*models.DelegationUpdated, error)

	// RetrieveDelegationUpdated is used to get all `DelegationUpdated` events with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveDelegationUpdated(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.DelegationUpdated, error)

	// RetrieveCollateralWithdrawnLimit is used to get all `Withdrawn` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveCollateralWithdrawnLimit(limit uint64) ([]*models.CollateralWithdrawn, error)

	// RetrieveCollateralWithdrawnLimit is used to get all `Withdrawn` events from the Core contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveCollateralWithdrawn(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralWithdrawn, error)

	// RetrieveCollateralDepositedLimit is used to get all `Deposited` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveCollateralDepositedLimit(limit uint64) ([]*models.CollateralDeposited, error)

	// RetrieveCollateralDepositedLimit is used to get all `Deposited` events from the Core contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveCollateralDeposited(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralDeposited, error)

	// RetrieveRewardClaimedLimit is used to get all `RewardClaimed` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveRewardClaimedLimit(limit uint64) ([]*models.RewardClaimed, error)
	RetrieveRewardClaimed(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.RewardClaimed, error)

	// RetrieveRewardDistributedLimit is used to get all `RewardDistributed` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveRewardDistributedLimit(limit uint64) ([]*models.RewardDistributed, error)
	RetrieveRewardDistributed(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.RewardDistributed, error)

	// RetrieveMarketUSDDepositedLimit is used to get all `MarketUSDDeposited` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveMarketUSDDepositedLimit(limit uint64) ([]*models.MarketUSDDeposited, error)

	// RetrieveMarketUSDWithdrawnLimit is used to get all `MarketUSDWithdrawn` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveMarketUSDWithdrawnLimit(limit uint64) ([]*models.MarketUSDWithdrawn, error)

	// RetrieveMarketRegistered is used to get all `MarketRegistered` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveMarketRegistered(limit uint64) ([]*models.MarketRegistered, error)

	// RetrieveMarketRegisteredOpts is used to get all `MarketRegistered` events with given start block, end block and block search
	//	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveMarketRegisteredOpts(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.MarketRegistered, error)

	// RetrievePoolCreatedLimit is used to get all `PoolCreated` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrievePoolCreatedLimit(limit uint64) ([]*models.PoolCreated, error)
	RetrievePoolCreated(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.PoolCreated, error)

	// RetrieveLiquidationsCoreLimit is used to get all `Liquidation` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveLiquidationsCoreLimit(limit uint64) ([]*models.CoreLiquidation, error)
	RetrieveLiquidationsCore(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CoreLiquidation, error)

	// RetrieveVaultLiquidationsCoreLimit is used to get all `VaultLiquidation` events from the Core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveVaultLiquidationsCoreLimit(limit uint64) ([]*models.CoreVaultLiquidation, error)
	RetrieveVaultLiquidationsCore(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CoreVaultLiquidation, error)

	// ListenTrades is used to subscribe on the contract "OrderSettled" event. The goroutine will return events on the
	// TradesChan chanel and errors on the ErrChan chanel.
	// To close the subscription use events.TradeSubscription `Close` function
	ListenTrades() (*events.TradeSubscription, error)

	// ListenOrders is used to subscribe on the contract "OrderCommitted" event. The goroutine will return events on the
	// OrdersChan chanel and errors on the ErrChan chanel.
	// To close the subscription use events.OrderSubscription `Close` function
	ListenOrders() (*events.OrderSubscription, error)

	// ListenMarketUpdates is used to subscribe on the contract "MarketUpdated" event. The goroutine will return events
	// on the MarketUpdateChan chanel and errors on the ErrChan chanel.
	// To close the subscription use events.MarketUpdateSubscription `Close` function
	ListenMarketUpdates() (*events.MarketUpdateSubscription, error)

	// ListenMarketUpdatesBig is used to subscribe on the contract "MarketUpdated" event. The goroutine will return events
	// on the MarketUpdateChan chanel and errors on the ErrChan chanel.
	// To close the subscription use events.MarketUpdateSubscription `Close` function
	ListenMarketUpdatesBig() (*events.MarketUpdateSubscriptionBig, error)

	// ListenLiquidations is used to subscribe on the contract "PositionLiquidated" event. The goroutine will return events
	// on the LiquidationsChan chanel and errors on the ErrChan chanel.
	// To close the subscription use events.LiquidationSubscription `Close` function
	ListenLiquidations() (*events.LiquidationSubscription, error)

	// ListenAccountCreated is used to listen to all 'AccountCreated' contract events and return them as models.Account
	// struct and return errors on ErrChan chanel
	ListenAccountCreated() (*events.AccountCreatedSubscription, error)

	// ListenAccountCreatedCore is used to listen to all 'AccountCreated' core contract events and return them as models.Account
	// struct and return errors on ErrChan chanel
	ListenAccountCreatedCore() (*events.AccountCreatedCoreSubscription, error)

	// ListenAccountLiquidated is used to listen to all 'AccountLiquidated' contract events and return them as models.AccountLiquidated
	// struct and return errors on ErrChan chanel
	ListenAccountLiquidated() (*events.AccountLiquidatedSubscription, error)

	// ListenAccountPermissionRevoked is used to listen to all 'PermissionRevoked' contract events and return them as models.PermissionChanged
	// struct and return errors on ErrChan chanel
	ListenAccountPermissionRevoked() (*events.AccountPermissionRevokedSubscription, error)

	// ListenAccountPermissionGranted is used to listen to all 'PermissionGranted' contract events and return them as models.PermissionChanged
	// struct and return errors on ErrChan chanel
	ListenAccountPermissionGranted() (*events.AccountPermissionGrantedSubscription, error)

	// ListenUSDMinted is used to listen to all 'USDMinted' Core contract events and return them as models.USDMinted
	// struct and return errors on ErrChan chanel
	ListenUSDMinted() (*events.USDMintedSubscription, error)

	// ListenUSDBurned is used to listen to all 'USDBurned' Core contract events and return them as models.USDBurned
	// struct and return errors on ErrChan chanel
	ListenUSDBurned() (*events.USDBurnedSubscription, error)

	// ListenDelegationUpdated is used to listen to all 'DelegationUpdated' Core contract events and return them as models.DelegationUpdated
	// struct and return errors on ErrChan chanel
	ListenDelegationUpdated() (*events.DelegationUpdatedSubscription, error)

	// ListenCollateralWithdrawn is used to listen to all 'Withdrawn' Core contract events and return them as models.CollateralWithdrawn
	// struct and return errors on ErrChan chanel
	ListenCollateralWithdrawn() (*events.CollateralWithdrawnSubscription, error)

	// ListenCollateralDeposited is used to listen to all 'Deposited' Core contract events and return them as models.CollateralDeposited
	// struct and return errors on ErrChan chanel
	ListenCollateralDeposited() (*events.CollateralDepositedSubscription, error)

	// ListenRewardDistributed is used to listen to all 'RewardDistributed' Core contract events and return them as models.RewardDistributed
	// struct and return errors on ErrChan chanel
	ListenRewardDistributed() (*events.RewardDistributedSubscription, error)

	// ListenRewardClaimed is used to listen to all 'RewardClaimed' Core contract events and return them as models.RewardClaimed
	// struct and return errors on ErrChan chanel
	ListenRewardClaimed() (*events.RewardClaimedSubscription, error)

	// ListenMarketUSDWithdrawn is used to listen to all 'MarketUSDWithdrawn' Core contract events and return them as models.MarketUSDWithdrawn
	// struct and return errors on ErrChan chanel
	ListenMarketUSDWithdrawn() (*events.MarketUSDWithdrawnSubscription, error)

	// ListenMarketUSDDeposited is used to listen to all 'MarketUSDDeposited' Core contract events and return them as models.MarketUSDDeposited
	// struct and return errors on ErrChan chanel
	ListenMarketUSDDeposited() (*events.MarketUSDDepositedSubscription, error)

	// ListenMarketRegistered is used to listen to all 'MarketRegistered' Core contract events and return them as models.MarketRegistered
	// struct and return errors on ErrChan chanel
	ListenMarketRegistered() (*events.MarketRegisteredSubscription, error)

	// ListenPoolCreated is used to listen to all 'PoolCreated' Core contract events and return them as models.PoolCreated
	// struct and return errors on ErrChan chanel
	ListenPoolCreated() (*events.PoolCreatedSubscription, error)

	// ListenVaultLiquidationsCore is used to listen to all 'VaultLiquidations' Core contract events and return them as models.CoreVaultLiquidation
	// struct and return errors on ErrChan chanel
	ListenVaultLiquidationsCore() (*events.VaultLiquidationsCoreSubscription, error)

	// ListenLiquidationsCore is used to listen to all 'Liquidations' Core contract events and return them as models.CoreLiquidation
	// struct and return errors on ErrChan chanel
	ListenLiquidationsCore() (*events.LiquidationsCoreSubscription, error)

	// ListenAccountTransfer is used to listen to all 'Transfer' Account contract events and return them as models.AccountTransfer
	// struct and return errors on ErrChan chanel
	ListenAccountTransfer() (*events.AccountTransferSubscription, error)

	// ListenAccountCorePermissionRevoked is used to listen to all 'PermissionRevoked' Core contract events and return them as models.PermissionChanged
	// struct and return errors on ErrChan chanel
	ListenAccountCorePermissionRevoked() (*events.AccountCorePermissionRevokedSubscription, error)

	// ListenAccountCorePermissionGranted is used to listen to all 'PermissionGranted' Core contract events and return them as models.PermissionChanged
	// struct and return errors on ErrChan chanel
	ListenAccountCorePermissionGranted() (*events.AccountCorePermissionGrantedSubscription, error)

	// GetPosition is used to get position data struct from latest block with given params
	// Function can return contract error if market ID is invalid
	GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error)

	// GetMarketMetadata is used to get market metadata by given market ID. Given market id cannot be nil and should exist
	// in the smart contract
	GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error)

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

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

	// GetFoundingRate is used to get current market founding rate by given market ID
	GetFoundingRate(marketId *big.Int) (*big.Int, error)

	// GetAvailableMargin is used to get available margin for given account ID
	GetAvailableMargin(accountId *big.Int) (*big.Int, error)

	// GetLiquidationParameters is used to get liquidation params for given market ID
	GetLiquidationParameters(marketId *big.Int) (*models.LiquidationParameters, error)

	// GetFundingParameters is used to get funding params for given market ID
	GetFundingParameters(marketId *big.Int) (*models.FundingParameters, error)

	// GetAccountLastInteraction is used to get accounts last interaction for given account ID
	GetAccountLastInteraction(accountId *big.Int) (*big.Int, error)

	// GetAccountOwner is used to get accounts owner address for given account ID
	GetAccountOwner(accountId *big.Int) (string, error)

	// GetCollateralAmount is used to get accounts collateral amount for given market ID
	GetCollateralAmount(accountId *big.Int, marketId *big.Int) (*big.Int, error)

	// GetRequiredMaintenanceMargin is used to get required maintenance margin for given account ID
	GetRequiredMaintenanceMargin(accountId *big.Int) (*big.Int, error)

	// GetCollateralPrice is used to get collateral price for given block number and collateralType
	GetCollateralPrice(blockNumber *big.Int, collateralType common.Address) (*models.CollateralPrice, error)

	// GetVaultDebt is used to get vault debt for given pool ID and collateralType
	GetVaultDebt(poolID *big.Int, collateralType common.Address) (*big.Int, error)

	// GetVaultDebtHistorical is used to get vault debt for given pool ID, collateralType and block number
	GetVaultDebtHistorical(poolID *big.Int, collateralType common.Address, blockNumber *big.Int) (*big.Int, error)

	// GetVaultCollateral is used to get vault collateral for given pool ID and collateralType
	GetVaultCollateral(poolID *big.Int, collateralType common.Address) (amount *big.Int, value *big.Int, err error)

	// GetVaultCollateralHistorical is used to get vault collateral for given pool ID, collateralType and block number
	GetVaultCollateralHistorical(poolID *big.Int, collateralType common.Address, blockNumber *big.Int) (amount *big.Int, value *big.Int, err error)

	// GetPoolConfiguration is used to get MarketConfigurations array
	GetPoolConfiguration(poolID *big.Int) (*models.PoolConfiguration, error)

	// GetPoolName is used to get pool name from given PoolID
	GetPoolName(poolID *big.Int) (string, error)

	// GetAccountCollateralCore is used to get account collateral data for given account ID and collateral type
	GetAccountCollateralCore(accountId *big.Int, collateralType common.Address) (*models.AccountCollateral, error)

	// GetAccountAvailableCollateral is used to get account available collateral data for given account ID and collateral type
	GetAccountAvailableCollateral(accountId *big.Int, collateralType common.Address) (*big.Int, error)

	// GetCollateralConfigurations is used to get CollateralConfiguration data
	GetCollateralConfigurations(hideDisabled bool) ([]*models.CollateralConfiguration, 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)

	// FormatAccountCore is used to get all accounts and their additional data from the core contract with given block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	FormatAccountCore(id *big.Int) (*models.Account, error)

	// FormatAccountsCoreLimit 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
	FormatAccountsCoreLimit(limit uint64) ([]*models.Account, error)

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

	// RetrieveChangeOwner is used to get all owner changes and additional data from the contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrieveChangeOwner(fromBlock, toBlock, limit uint64) ([]*models.AccountTransfer, error)

	// RetrievePermissionRevoked is used to get all the revoked permission and additional data from the contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrievePermissionRevoked(fromBlock, toBlock, limit uint64) ([]*models.PermissionChanged, error)

	// RetrievePermissionGranted is used to get all the granted permission and additional data from the contract with given start block, end block and block search
	// limit. For most public RPC providers the value for limit is 20 000 blocks
	RetrievePermissionGranted(fromBlock, toBlock, limit uint64) ([]*models.PermissionChanged, error)

	// Config is used to get current lib config
	Config() *config.PerpsvConfig

	// Close used to stop the lib work
	Close()
}

IPerpsv3 is an interface for perpsv3 lib

func Create

func Create(conf *config.PerpsvConfig) (IPerpsv3, error)

Create used to get Perpsv3 instance with given configuration settings

type Perpsv3

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

Perpsv3 is a main perpsv3 lib object, it is implementing IPerpsv3 interface

func (*Perpsv3) Close

func (p *Perpsv3) Close()

func (*Perpsv3) Config added in v0.0.2

func (p *Perpsv3) Config() *config.PerpsvConfig

func (*Perpsv3) FormatAccount added in v0.1.2

func (p *Perpsv3) FormatAccount(id *big.Int) (*models.Account, error)

func (*Perpsv3) FormatAccountCore added in v0.11.0

func (p *Perpsv3) FormatAccountCore(id *big.Int) (*models.Account, error)

func (*Perpsv3) FormatAccounts added in v0.1.2

func (p *Perpsv3) FormatAccounts() ([]*models.Account, error)

func (*Perpsv3) FormatAccountsCore added in v0.18.0

func (p *Perpsv3) FormatAccountsCore(fromBlock, toBlock, limit uint64) ([]*models.Account, error)

func (*Perpsv3) FormatAccountsCoreLimit added in v0.13.0

func (p *Perpsv3) FormatAccountsCoreLimit(limit uint64) ([]*models.Account, error)

func (*Perpsv3) FormatAccountsLimit added in v0.1.2

func (p *Perpsv3) FormatAccountsLimit(limit uint64) ([]*models.Account, error)

func (*Perpsv3) GetAccountAvailableCollateral added in v0.11.0

func (p *Perpsv3) GetAccountAvailableCollateral(accountId *big.Int, collateralType common.Address) (*big.Int, error)

func (*Perpsv3) GetAccountCollateralCore added in v0.11.0

func (p *Perpsv3) GetAccountCollateralCore(accountId *big.Int, collateralType common.Address) (*models.AccountCollateral, error)

func (*Perpsv3) GetAccountLastInteraction added in v0.1.21

func (p *Perpsv3) GetAccountLastInteraction(accountId *big.Int) (*big.Int, error)

func (*Perpsv3) GetAccountOwner added in v0.1.21

func (p *Perpsv3) GetAccountOwner(accountId *big.Int) (string, error)

func (*Perpsv3) GetAvailableMargin added in v0.1.15

func (p *Perpsv3) GetAvailableMargin(accountId *big.Int) (*big.Int, error)

func (*Perpsv3) GetCollateralAmount added in v0.3.0

func (p *Perpsv3) GetCollateralAmount(accountId *big.Int, marketId *big.Int) (*big.Int, error)

func (*Perpsv3) GetCollateralConfigurations added in v0.11.0

func (p *Perpsv3) GetCollateralConfigurations(hideDisabled bool) ([]*models.CollateralConfiguration, error)

func (*Perpsv3) GetCollateralPrice added in v0.3.10

func (p *Perpsv3) GetCollateralPrice(blockNumber *big.Int, collateralType common.Address) (*models.CollateralPrice, error)

func (*Perpsv3) GetFoundingRate added in v0.1.12

func (p *Perpsv3) GetFoundingRate(marketId *big.Int) (*big.Int, error)

func (*Perpsv3) GetFundingParameters added in v0.1.17

func (p *Perpsv3) GetFundingParameters(marketId *big.Int) (*models.FundingParameters, error)

func (*Perpsv3) GetLiquidationParameters added in v0.1.16

func (p *Perpsv3) GetLiquidationParameters(marketId *big.Int) (*models.LiquidationParameters, error)

func (*Perpsv3) GetMarketIDs added in v0.1.7

func (p *Perpsv3) GetMarketIDs() ([]*big.Int, error)

func (*Perpsv3) GetMarketMetadata added in v0.1.6

func (p *Perpsv3) GetMarketMetadata(marketID *big.Int) (*models.MarketMetadata, error)

func (*Perpsv3) GetMarketSummary added in v0.1.7

func (p *Perpsv3) GetMarketSummary(marketID *big.Int) (*models.MarketSummary, error)

func (*Perpsv3) GetPoolConfiguration added in v0.7.0

func (p *Perpsv3) GetPoolConfiguration(poolID *big.Int) (*models.PoolConfiguration, error)

func (*Perpsv3) GetPoolName added in v0.9.0

func (p *Perpsv3) GetPoolName(poolID *big.Int) (string, error)

func (*Perpsv3) GetPosition added in v0.0.2

func (p *Perpsv3) GetPosition(accountID *big.Int, marketID *big.Int) (*models.Position, error)

func (*Perpsv3) GetRequiredMaintenanceMargin added in v0.1.24

func (p *Perpsv3) GetRequiredMaintenanceMargin(accountId *big.Int) (*big.Int, error)

func (*Perpsv3) GetVaultCollateral added in v0.6.0

func (p *Perpsv3) GetVaultCollateral(poolID *big.Int, collateralType common.Address) (amount *big.Int, value *big.Int, err error)

func (*Perpsv3) GetVaultCollateralHistorical added in v0.10.0

func (p *Perpsv3) GetVaultCollateralHistorical(poolID *big.Int, collateralType common.Address, blockNumber *big.Int) (amount *big.Int, value *big.Int, err error)

func (*Perpsv3) GetVaultDebt added in v0.6.0

func (p *Perpsv3) GetVaultDebt(poolID *big.Int, collateralType common.Address) (*big.Int, error)

func (*Perpsv3) GetVaultDebtHistorical added in v0.10.0

func (p *Perpsv3) GetVaultDebtHistorical(poolID *big.Int, collateralType common.Address, blockNumber *big.Int) (*big.Int, error)

func (*Perpsv3) ListenAccountCorePermissionGranted added in v0.15.0

func (p *Perpsv3) ListenAccountCorePermissionGranted() (*events.AccountCorePermissionGrantedSubscription, error)

func (*Perpsv3) ListenAccountCorePermissionRevoked added in v0.15.0

func (p *Perpsv3) ListenAccountCorePermissionRevoked() (*events.AccountCorePermissionRevokedSubscription, error)

func (*Perpsv3) ListenAccountCreated added in v0.1.20

func (p *Perpsv3) ListenAccountCreated() (*events.AccountCreatedSubscription, error)

func (*Perpsv3) ListenAccountCreatedCore added in v0.14.0

func (p *Perpsv3) ListenAccountCreatedCore() (*events.AccountCreatedCoreSubscription, error)

func (*Perpsv3) ListenAccountLiquidated added in v0.1.20

func (p *Perpsv3) ListenAccountLiquidated() (*events.AccountLiquidatedSubscription, error)

func (*Perpsv3) ListenAccountPermissionGranted added in v0.1.20

func (p *Perpsv3) ListenAccountPermissionGranted() (*events.AccountPermissionGrantedSubscription, error)

func (*Perpsv3) ListenAccountPermissionRevoked added in v0.1.20

func (p *Perpsv3) ListenAccountPermissionRevoked() (*events.AccountPermissionRevokedSubscription, error)

func (*Perpsv3) ListenAccountTransfer added in v0.15.0

func (p *Perpsv3) ListenAccountTransfer() (*events.AccountTransferSubscription, error)

func (*Perpsv3) ListenCollateralDeposited added in v0.3.9

func (p *Perpsv3) ListenCollateralDeposited() (*events.CollateralDepositedSubscription, error)

func (*Perpsv3) ListenCollateralWithdrawn added in v0.3.9

func (p *Perpsv3) ListenCollateralWithdrawn() (*events.CollateralWithdrawnSubscription, error)

func (*Perpsv3) ListenDelegationUpdated added in v0.3.8

func (p *Perpsv3) ListenDelegationUpdated() (*events.DelegationUpdatedSubscription, error)

func (*Perpsv3) ListenLiquidations added in v0.1.3

func (p *Perpsv3) ListenLiquidations() (*events.LiquidationSubscription, error)

func (*Perpsv3) ListenLiquidationsCore added in v0.12.0

func (p *Perpsv3) ListenLiquidationsCore() (*events.LiquidationsCoreSubscription, error)

func (*Perpsv3) ListenMarketRegistered added in v0.8.0

func (p *Perpsv3) ListenMarketRegistered() (*events.MarketRegisteredSubscription, error)

func (*Perpsv3) ListenMarketUSDDeposited added in v0.6.0

func (p *Perpsv3) ListenMarketUSDDeposited() (*events.MarketUSDDepositedSubscription, error)

func (*Perpsv3) ListenMarketUSDWithdrawn added in v0.6.0

func (p *Perpsv3) ListenMarketUSDWithdrawn() (*events.MarketUSDWithdrawnSubscription, error)

func (*Perpsv3) ListenMarketUpdates added in v0.1.1

func (p *Perpsv3) ListenMarketUpdates() (*events.MarketUpdateSubscription, error)

func (*Perpsv3) ListenMarketUpdatesBig added in v0.1.9

func (p *Perpsv3) ListenMarketUpdatesBig() (*events.MarketUpdateSubscriptionBig, error)

func (*Perpsv3) ListenOrders added in v0.1.0

func (p *Perpsv3) ListenOrders() (*events.OrderSubscription, error)

func (*Perpsv3) ListenPoolCreated added in v0.9.0

func (p *Perpsv3) ListenPoolCreated() (*events.PoolCreatedSubscription, error)

func (*Perpsv3) ListenRewardClaimed added in v0.4.0

func (p *Perpsv3) ListenRewardClaimed() (*events.RewardClaimedSubscription, error)

func (*Perpsv3) ListenRewardDistributed added in v0.4.0

func (p *Perpsv3) ListenRewardDistributed() (*events.RewardDistributedSubscription, error)

func (*Perpsv3) ListenTrades

func (p *Perpsv3) ListenTrades() (*events.TradeSubscription, error)

func (*Perpsv3) ListenUSDBurned added in v0.3.8

func (p *Perpsv3) ListenUSDBurned() (*events.USDBurnedSubscription, error)

func (*Perpsv3) ListenUSDMinted added in v0.3.7

func (p *Perpsv3) ListenUSDMinted() (*events.USDMintedSubscription, error)

func (*Perpsv3) ListenVaultLiquidationsCore added in v0.12.0

func (p *Perpsv3) ListenVaultLiquidationsCore() (*events.VaultLiquidationsCoreSubscription, error)

func (*Perpsv3) RetrieveAccountLiquidationsLimit added in v0.1.20

func (p *Perpsv3) RetrieveAccountLiquidationsLimit(limit uint64) ([]*models.AccountLiquidated, error)

func (*Perpsv3) RetrieveChangeOwner added in v0.20.0

func (p *Perpsv3) RetrieveChangeOwner(fromBlock, toBlock, limit uint64) ([]*models.AccountTransfer, error)

func (*Perpsv3) RetrieveCollateralDeposited added in v0.18.0

func (p *Perpsv3) RetrieveCollateralDeposited(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralDeposited, error)

func (*Perpsv3) RetrieveCollateralDepositedLimit added in v0.3.9

func (p *Perpsv3) RetrieveCollateralDepositedLimit(limit uint64) ([]*models.CollateralDeposited, error)

func (*Perpsv3) RetrieveCollateralWithdrawn added in v0.18.0

func (p *Perpsv3) RetrieveCollateralWithdrawn(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CollateralWithdrawn, error)

func (*Perpsv3) RetrieveCollateralWithdrawnLimit added in v0.3.9

func (p *Perpsv3) RetrieveCollateralWithdrawnLimit(limit uint64) ([]*models.CollateralWithdrawn, error)

func (*Perpsv3) RetrieveDelegationUpdated added in v0.17.0

func (p *Perpsv3) RetrieveDelegationUpdated(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.DelegationUpdated, error)

func (*Perpsv3) RetrieveDelegationUpdatedLimit added in v0.3.8

func (p *Perpsv3) RetrieveDelegationUpdatedLimit(limit uint64) ([]*models.DelegationUpdated, error)

func (*Perpsv3) RetrieveLiquidations added in v0.1.3

func (p *Perpsv3) RetrieveLiquidations(fromBlock uint64, toBLock *uint64) ([]*models.Liquidation, error)

func (*Perpsv3) RetrieveLiquidationsCore added in v0.11.0

func (p *Perpsv3) RetrieveLiquidationsCore(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CoreLiquidation, error)

func (*Perpsv3) RetrieveLiquidationsCoreLimit added in v0.17.2

func (p *Perpsv3) RetrieveLiquidationsCoreLimit(limit uint64) ([]*models.CoreLiquidation, error)

func (*Perpsv3) RetrieveLiquidationsLimit added in v0.1.3

func (p *Perpsv3) RetrieveLiquidationsLimit(limit uint64) ([]*models.Liquidation, error)

func (*Perpsv3) RetrieveMarketRegistered added in v0.8.0

func (p *Perpsv3) RetrieveMarketRegistered(limit uint64) ([]*models.MarketRegistered, error)

func (*Perpsv3) RetrieveMarketRegisteredOpts added in v0.19.0

func (p *Perpsv3) RetrieveMarketRegisteredOpts(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.MarketRegistered, error)

func (*Perpsv3) RetrieveMarketUSDDepositedLimit added in v0.6.0

func (p *Perpsv3) RetrieveMarketUSDDepositedLimit(limit uint64) ([]*models.MarketUSDDeposited, error)

func (*Perpsv3) RetrieveMarketUSDWithdrawnLimit added in v0.6.0

func (p *Perpsv3) RetrieveMarketUSDWithdrawnLimit(limit uint64) ([]*models.MarketUSDWithdrawn, error)

func (*Perpsv3) RetrieveMarketUpdates added in v0.1.1

func (p *Perpsv3) RetrieveMarketUpdates(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdate, error)

func (*Perpsv3) RetrieveMarketUpdatesBig added in v0.1.8

func (p *Perpsv3) RetrieveMarketUpdatesBig(fromBlock uint64, toBLock *uint64) ([]*models.MarketUpdateBig, error)

func (*Perpsv3) RetrieveMarketUpdatesBigLimit added in v0.1.8

func (p *Perpsv3) RetrieveMarketUpdatesBigLimit(limit uint64) ([]*models.MarketUpdateBig, error)

func (*Perpsv3) RetrieveMarketUpdatesLimit added in v0.1.4

func (p *Perpsv3) RetrieveMarketUpdatesLimit(limit uint64) ([]*models.MarketUpdate, error)

func (*Perpsv3) RetrieveOrders added in v0.1.0

func (p *Perpsv3) RetrieveOrders(fromBlock uint64, toBLock *uint64) ([]*models.Order, error)

func (*Perpsv3) RetrieveOrdersLimit added in v0.1.4

func (p *Perpsv3) RetrieveOrdersLimit(limit uint64) ([]*models.Order, error)

func (*Perpsv3) RetrievePermissionGranted added in v0.20.0

func (p *Perpsv3) RetrievePermissionGranted(fromBlock, toBlock, limit uint64) ([]*models.PermissionChanged, error)

func (*Perpsv3) RetrievePermissionRevoked added in v0.20.0

func (p *Perpsv3) RetrievePermissionRevoked(fromBlock, toBlock, limit uint64) ([]*models.PermissionChanged, error)

func (*Perpsv3) RetrievePoolCreated added in v0.9.0

func (p *Perpsv3) RetrievePoolCreated(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.PoolCreated, error)

func (*Perpsv3) RetrievePoolCreatedLimit added in v0.17.2

func (p *Perpsv3) RetrievePoolCreatedLimit(limit uint64) ([]*models.PoolCreated, error)

func (*Perpsv3) RetrieveRewardClaimed added in v0.17.3

func (p *Perpsv3) RetrieveRewardClaimed(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.RewardClaimed, error)

func (*Perpsv3) RetrieveRewardClaimedLimit added in v0.4.0

func (p *Perpsv3) RetrieveRewardClaimedLimit(limit uint64) ([]*models.RewardClaimed, error)

func (*Perpsv3) RetrieveRewardDistributed added in v0.17.3

func (p *Perpsv3) RetrieveRewardDistributed(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.RewardDistributed, error)

func (*Perpsv3) RetrieveRewardDistributedLimit added in v0.4.0

func (p *Perpsv3) RetrieveRewardDistributedLimit(limit uint64) ([]*models.RewardDistributed, error)

func (*Perpsv3) RetrieveTrades

func (p *Perpsv3) RetrieveTrades(fromBlock uint64, toBLock *uint64) ([]*models.Trade, error)

func (*Perpsv3) RetrieveTradesLimit added in v0.1.4

func (p *Perpsv3) RetrieveTradesLimit(limit uint64) ([]*models.Trade, error)

func (*Perpsv3) RetrieveUSDBurned added in v0.18.0

func (p *Perpsv3) RetrieveUSDBurned(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDBurned, error)

func (*Perpsv3) RetrieveUSDBurnedLimit added in v0.3.8

func (p *Perpsv3) RetrieveUSDBurnedLimit(limit uint64) ([]*models.USDBurned, error)

func (*Perpsv3) RetrieveUSDMinted added in v0.18.0

func (p *Perpsv3) RetrieveUSDMinted(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.USDMinted, error)

func (*Perpsv3) RetrieveUSDMintedLimit added in v0.3.7

func (p *Perpsv3) RetrieveUSDMintedLimit(limit uint64) ([]*models.USDMinted, error)

func (*Perpsv3) RetrieveVaultLiquidationsCore added in v0.11.0

func (p *Perpsv3) RetrieveVaultLiquidationsCore(fromBlock uint64, toBlock uint64, limit uint64) ([]*models.CoreVaultLiquidation, error)

func (*Perpsv3) RetrieveVaultLiquidationsCoreLimit added in v0.17.2

func (p *Perpsv3) RetrieveVaultLiquidationsCoreLimit(limit uint64) ([]*models.CoreVaultLiquidation, error)

Directories

Path Synopsis
contracts
mocks
events
Package mock_events is a generated GoMock package.
Package mock_events is a generated GoMock package.
service
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.
pkg
utils

Jump to

Keyboard shortcuts

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