gethlyleswaps

package
v2.0.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBColumns = []string{
	"id",
	"uuid",
	"chain_id",
	"exchange_id",
	"block_number",
	"index_number",
	"swap_date",
	"trade_type_id",
	"txn_hash",
	"maker_address",
	"maker_address_id",
	"is_buy",
	"price",
	"price_usd",
	"token1_price_usd",
	"total_amount_usd",
	"pair_address",
	"liquidity_pool_id",
	"token0_asset_id",
	"token1_asset_id",
	"token0_amount",
	"token1_amount",
	"description",
	"created_by",
	"created_at",
	"updated_by",
	"updated_at",
	"geth_process_job_id",
	"topics_str",
	"status_id",
	"base_asset_id",
	"oracle_price_usd",
	"oracle_price_asset_id",
}
View Source
var DBColumnsInsertGethSwaps = []string{
	"uuid",
	"chain_id",
	"exchange_id",
	"block_number",
	"index_number",
	"swap_date",
	"trade_type_id",
	"txn_hash",
	"maker_address",
	"maker_address_id",
	"is_buy",
	"price",
	"price_usd",
	"token1_price_usd",
	"total_amount_usd",
	"pair_address",
	"liquidity_pool_id",
	"token0_asset_id",
	"token1_asset_id",
	"token0_amount",
	"token1_amount",
	"description",
	"created_by",
	"created_at",
	"updated_by",
	"updated_at",
	"geth_process_job_id",
	"topics_str",
	"status_id",
	"base_asset_id",
	"oracle_price_usd",
	"oracle_price_asset_id",
}
View Source
var TestAllData = []GethSwap{TestData1, TestData2}
View Source
var TestData1 = GethSwap{
	ID:                 utils.Ptr[int](1),
	UUID:               "01ef85e8-2c26-441e-8c7f-71d79518ad72",
	ChainID:            utils.Ptr[int](1),
	ExchangeID:         utils.Ptr[int](2),
	BlockNumber:        utils.Ptr[uint64](17387265),
	IndexNumber:        utils.Ptr[uint](76),
	SwapDate:           utils.Ptr[time.Time](utils.SampleCreatedAtTime),
	TradeTypeID:        utils.Ptr[int](2),
	TxnHash:            "0x67775b7b31ff14d7a52c883e5ffe1a10cbdacb28c59728c5a78948863aa31b3b",
	MakerAddress:       "0x00000000000124d994209fbB955E0217B5C2ECA1",
	MakerAddressID:     utils.Ptr[int](12404),
	IsBuy:              utils.Ptr[bool](false),
	Price:              utils.Ptr[decimal.Decimal](decimal.NewFromFloat(0.0000000016482182)),
	PriceUSD:           utils.Ptr[decimal.Decimal](decimal.NewFromFloat(0.00000306905761197174)),
	Token1PriceUSD:     utils.Ptr[decimal.Decimal](decimal.NewFromFloat(0.01)),
	TotalAmountUSD:     utils.Ptr[decimal.Decimal](decimal.NewFromFloat(-2093.4883905833930747)),
	PairAddress:        "0xd101821c56B4405Af4A376cBe81FA0dC90207dC2",
	LiquidityPoolID:    utils.Ptr[int](1),
	Token0AssetId:      utils.Ptr[int](1),
	Token1AssetId:      utils.Ptr[int](2),
	Token0Amount:       utils.Ptr[decimal.Decimal](decimal.NewFromFloat(-682127433000000000000000000)),
	Token1Amount:       utils.Ptr[decimal.Decimal](decimal.NewFromFloat(1124294835794079411)),
	Description:        "Imported by Geth Dex Analyzer",
	CreatedBy:          "SYSTEM",
	CreatedAt:          utils.SampleCreatedAtTime,
	UpdatedBy:          "SYSTEM",
	UpdatedAt:          utils.SampleCreatedAtTime,
	GethProcessJobID:   utils.Ptr[int](10),
	TopicsStr:          []string{"Swap(address,uint256,uint256,uint256,uint256,address)", "Swap(address,address,int256,int256,uint160,uint128,int24)"},
	StatusID:           utils.Ptr[int](52),
	BaseAssetID:        utils.Ptr[int](1),
	OraclePriceUSD:     utils.Ptr[decimal.Decimal](decimal.NewFromFloat(1862.0457)),
	OraclePriceAssetID: utils.Ptr[int](1),
}
View Source
var TestData2 = GethSwap{
	ID:                 utils.Ptr[int](2),
	UUID:               "4f0d5402-7a7c-402d-a7fc-c56a02b13e03",
	ChainID:            utils.Ptr[int](1),
	ExchangeID:         utils.Ptr[int](2),
	BlockNumber:        utils.Ptr[uint64](20267173),
	IndexNumber:        utils.Ptr[uint](19),
	SwapDate:           utils.Ptr[time.Time](utils.SampleCreatedAtTime),
	TradeTypeID:        utils.Ptr[int](2),
	TxnHash:            "0xcdae57cf75ad8f3b8051ba0d8a9bcfc247e1416910f4850238d0e956ab9b82d5",
	MakerAddress:       "0xe75eD6F453c602Bd696cE27AF11565eDc9b46B0D",
	MakerAddressID:     utils.Ptr[int](9730),
	IsBuy:              utils.Ptr[bool](true),
	Price:              utils.Ptr[decimal.Decimal](decimal.NewFromFloat(0.0196828489853681)),
	PriceUSD:           utils.Ptr[decimal.Decimal](decimal.NewFromFloat(60.637139547661794576378192)),
	Token1PriceUSD:     nil,
	TotalAmountUSD:     utils.Ptr[decimal.Decimal](decimal.NewFromFloat(1684.2238633602744855)),
	PairAddress:        "0x53E79ef1Cf6aC0cDF6f1743C3BE3ad48fA3c5657",
	LiquidityPoolID:    utils.Ptr[int](2),
	Token0AssetId:      utils.Ptr[int](3),
	Token1AssetId:      utils.Ptr[int](4),
	Token0Amount:       utils.Ptr[decimal.Decimal](decimal.NewFromFloat(-546699996196503552)),
	Token1Amount:       utils.Ptr[decimal.Decimal](decimal.NewFromFloat(27775450424016896000)),
	Description:        "Imported by Geth Dex Analyzer",
	CreatedBy:          "SYSTEM",
	CreatedAt:          utils.SampleCreatedAtTime,
	UpdatedBy:          "SYSTEM",
	UpdatedAt:          utils.SampleCreatedAtTime,
	GethProcessJobID:   utils.Ptr[int](10),
	TopicsStr:          []string{"Swap(address,uint256,uint256,uint256,uint256,address)", "Swap(address,address,int256,int256,uint160,uint128,int24)"},
	StatusID:           utils.Ptr[int](52),
	BaseAssetID:        utils.Ptr[int](1),
	OraclePriceUSD:     utils.Ptr[decimal.Decimal](decimal.NewFromFloat(3080.70948432)),
	OraclePriceAssetID: utils.Ptr[int](1),
}

Functions

func AddGethSwapToMockRows

func AddGethSwapToMockRows(mock pgxmock.PgxPoolIface, dataList []GethSwap) *pgxmock.Rows

func DeleteGethSwapsByBaseAssetId

func DeleteGethSwapsByBaseAssetId(dbConnPgx utils.PgxIface, baseAssetID *int) error

func GetDistinctTransactionHashesFromAssetIdAndStartingBlock

func GetDistinctTransactionHashesFromAssetIdAndStartingBlock(dbConnPgx utils.PgxIface, assetID *int, startingBlock *uint64) ([]string, error)

func GetHighestBlockFromBaseAssetId

func GetHighestBlockFromBaseAssetId(dbConnPgx utils.PgxIface, assetID *int) (*uint64, error)

func GetNullAddressStrsFromSwaps

func GetNullAddressStrsFromSwaps(dbConnPgx utils.PgxIface, assetID *int) ([]string, error)

func GetTotalGethSwapsCount

func GetTotalGethSwapsCount(dbConnPgx utils.PgxIface) (*int, error)

func InsertGethSwap

func InsertGethSwap(dbConnPgx utils.PgxIface, gethSwap *GethSwap) (int, string, error)

func InsertGethSwaps

func InsertGethSwaps(dbConnPgx utils.PgxIface, gethSwaps []GethSwap) error

func RemoveGethSwap

func RemoveGethSwap(dbConnPgx utils.PgxIface, gethSwapID *int) error

func RemoveGethSwapsFromAssetIDAndStartBlockNumber

func RemoveGethSwapsFromAssetIDAndStartBlockNumber(dbConnPgx utils.PgxIface, baseAssetID *int, startBlockNumber *uint64) error

func UpdateGethSwap

func UpdateGethSwap(dbConnPgx utils.PgxIface, gethSwap *GethSwap) error

func UpdateGethSwapAddresses

func UpdateGethSwapAddresses(dbConnPgx utils.PgxIface, baseAssetID *int) error

Types

type GethSwap

type GethSwap struct {
	ID                 *int             `json:"id" db:"id"`                                    //1
	UUID               string           `json:"uuid" db:"uuid"`                                //2
	ChainID            *int             `json:"chainId" db:"chain_id"`                         //3
	ExchangeID         *int             `json:"exchangeId" db:"exchange_id"`                   //4
	BlockNumber        *uint64          `json:"blockNumber" db:"block_number"`                 //5
	IndexNumber        *uint            `json:"indexNumber" db:"index_number"`                 //6
	SwapDate           *time.Time       `json:"swapDate" db:"swap_date"`                       //7
	TradeTypeID        *int             `json:"tradeTypeId" db:"trade_type_id"`                //8
	TxnHash            string           `json:"txnHash" db:"txn_hash"`                         //9
	MakerAddress       string           `json:"makerAddress" db:"maker_address"`               //10
	MakerAddressID     *int             `json:"makerAddressId" db:"maker_address_id"`          //11
	IsBuy              *bool            `json:"isBuy" db:"is_buy"`                             //12
	Price              *decimal.Decimal `json:"price" db:"price"`                              //13
	PriceUSD           *decimal.Decimal `json:"priceUsd" db:"price_usd"`                       //14
	Token1PriceUSD     *decimal.Decimal `json:"token1PriceUsd" db:"token1_price_usd"`          //15
	TotalAmountUSD     *decimal.Decimal `json:"totalAmountUsd" db:"total_amount_usd"`          //16
	PairAddress        string           `json:"pairAddress" db:"pair_address"`                 //17
	LiquidityPoolID    *int             `json:"liquidityPoolId" db:"liquidity_pool_id"`        //18
	Token0AssetId      *int             `json:"token0Id" db:"token0_asset_id"`                 //19
	Token1AssetId      *int             `json:"token1Id" db:"token1_asset_id"`                 //20
	Token0Amount       *decimal.Decimal `json:"token0Amount" db:"token0_amount"`               //21
	Token1Amount       *decimal.Decimal `json:"token1Amount" db:"token1_amount"`               //22
	Description        string           `json:"description" db:"description"`                  //23
	CreatedBy          string           `json:"createdBy" db:"created_by"`                     //24
	CreatedAt          time.Time        `json:"createdAt" db:"created_at"`                     //25
	UpdatedBy          string           `json:"updatedBy" db:"updated_by"`                     //26
	UpdatedAt          time.Time        `json:"updatedAt" db:"updated_at"`                     //27
	GethProcessJobID   *int             `json:"gethProcessJobId" db:"geth_process_job_id"`     //28
	TopicsStr          []string         `json:"topicsStr" db:"topics_str"`                     //29
	StatusID           *int             `json:"statusId" db:"status_id"`                       //30
	BaseAssetID        *int             `json:"baseAssetId" db:"base_asset_id"`                //31
	OraclePriceUSD     *decimal.Decimal `json:"oraclePriceUsd" db:"oracle_price_usd"`          //32
	OraclePriceAssetID *int             `json:"oraclePriceAssetId" db:"oracle_price_asset_id"` //33
}

func GetGethSwap

func GetGethSwap(dbConnPgx utils.PgxIface, gethSwapID *int) (*GethSwap, error)

func GetGethSwapByBlockChain

func GetGethSwapByBlockChain(dbConnPgx utils.PgxIface, txnHash string, blockNumber *uint64, indexNumber *uint, makerAddressID, liquidityPoolID *int) (*GethSwap, error)

func GetGethSwapByFromBaseAssetAndBeforeBlockNumber

func GetGethSwapByFromBaseAssetAndBeforeBlockNumber(dbConnPgx utils.PgxIface, baseAssetID *int, blockNumber *uint64) ([]GethSwap, error)

func GetGethSwapByFromMakerAddress

func GetGethSwapByFromMakerAddress(dbConnPgx utils.PgxIface, makerAddress string) ([]GethSwap, error)

func GetGethSwapByFromMakerAddressId

func GetGethSwapByFromMakerAddressId(dbConnPgx utils.PgxIface, makerAddressID *int) ([]GethSwap, error)

func GetGethSwapByFromMakerAddressIdAndBeforeBlockNumber

func GetGethSwapByFromMakerAddressIdAndBeforeBlockNumber(dbConnPgx utils.PgxIface, baseAssetID, makerAddressID *int, blockNumber *uint64) ([]GethSwap, error)

func GetGethSwapByStartAndEndDates

func GetGethSwapByStartAndEndDates(dbConnPgx utils.PgxIface, startDate, endDate time.Time) ([]GethSwap, error)

func GetGethSwapByTxnHash

func GetGethSwapByTxnHash(dbConnPgx utils.PgxIface, txnHash string, baseAssetID *int) ([]GethSwap, error)

func GetGethSwapList

func GetGethSwapList(dbConnPgx utils.PgxIface) ([]GethSwap, error)

func GetGethSwapListByPagination

func GetGethSwapListByPagination(dbConnPgx utils.PgxIface, _start, _end *int, _order, _sort string, _filters []string) ([]GethSwap, error)

for refinedev

func GetGethSwapsByTxnHashes

func GetGethSwapsByTxnHashes(dbConnPgx utils.PgxIface, txnHashes []string, baseAssetID *int) ([]GethSwap, error)

bulk swap methods

type GethSwapAddress

type GethSwapAddress struct {
	MakerAddress   string `json:"makerAddress" db:"maker_address"`      //1
	MakerAddressID *int   `json:"makerAddressId" db:"maker_address_id"` //2
}

func GetDistinctMakerAddressesFromBaseTokenAssetID

func GetDistinctMakerAddressesFromBaseTokenAssetID(dbConnPgx utils.PgxIface, baseAssetID *int) ([]GethSwapAddress, error)

Jump to

Keyboard shortcuts

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