model

package
v0.0.0-...-bd3dd7f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AaveV2AccountData

type AaveV2AccountData struct {
	TotalCollateralETH          *big.Int
	TotalDebtETH                *big.Int
	AvailableBorrowsETH         *big.Int
	CurrentLiquidationThreshold *big.Int
	Ltv                         *big.Int
	HealthFactor                *big.Int
}

type AaveV2UserReserveData

type AaveV2UserReserveData struct {
	CurrentATokenBalance     *big.Int
	CurrentStableDebt        *big.Int
	CurrentVariableDebt      *big.Int
	PrincipalStableDebt      *big.Int
	ScaledVariableDebt       *big.Int
	StableBorrowRate         *big.Int
	LiquidityRate            *big.Int
	StableRateLastUpdated    *big.Int
	UsageAsCollateralEnabled bool
}

type Block

type Block struct {
	Number          *big.Int       `json:"number"`
	Hash            common.Hash    `json:"hash"`
	Coinbase        common.Address `json:"coinbase"`
	ParentHash      common.Hash    `json:"parent_hash"`
	ReceiptHash     common.Hash    `json:"receipt_hash"`
	UncleHash       common.Hash    `json:"uncle_hash"`
	MixDigest       common.Hash    `json:"mix_digest"`
	Root            common.Hash    `json:"root"`
	Bloom           types.Bloom    `json:"bloom"`
	Nonce           [8]byte        `json:"nonce"`
	Extra           []byte         `json:"extra"`
	BaseFee         *big.Int       `json:"base_fee"`
	GasLimit        *big.Int       `json:"gas_limit"`
	GasUsed         uint64         `json:"gas_used"`
	Size            uint64         `json:"size"`
	Difficulty      *big.Int       `json:"difficulty"`
	TotalDifficulty *big.Int       `json:"total_difficulty"`
	Timestamp       time.Time      `json:"timestamp"`
}

type ChainbaseQueryRequest

type ChainbaseQueryRequest struct {
	Query  string `json:"query"`
	TaskId string `json:"task_id"`
	Page   int32  `json:"page"`
}

type ChainbaseQueryResponse

type ChainbaseQueryResponse[T any] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

type ChainbaseSQLMeta

type ChainbaseSQLMeta struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type ERC20Token

type ERC20Token struct {
	ContractAddress common.Address `gorm:"column:contract_address" ch:"contract_address" json:"contract_address,omitempty"`
	Name            string         `gorm:"column:name" ch:"name" json:"name,omitempty"`
	Symbol          string         `gorm:"column:symbol" ch:"symbol" json:"symbol,omitempty"`
	Decimals        uint8          `gorm:"column:decimals" ch:"decimals" json:"decimals,omitempty"`
}

type ERC20Transfer

type ERC20Transfer struct {
	BlockHash       common.Hash    `gorm:"column:block_hash" ch:"block_hash" json:"block_hash,omitempty"`
	BlockNumber     uint64         `gorm:"column:block_number" ch:"block_number" json:"block_number,omitempty"`
	TxHash          common.Hash    `gorm:"column:tx_hash" ch:"tx_hash" json:"tx_hash,omitempty"`
	ContractAddress common.Address `gorm:"column:contract_address" ch:"contract_address" json:"contract_address,omitempty"`
	From            common.Address `gorm:"column:from" ch:"from" json:"from,omitempty"`
	To              common.Address `gorm:"column:to" ch:"to" json:"to,omitempty"`
	Value           *big.Int       `gorm:"column:value" ch:"value" json:"value,omitempty"`
}

type ERC20TransferWithMetadata

type ERC20TransferWithMetadata struct {
	ERC20Token
	BlockHash       common.Hash    `gorm:"column:block_hash" ch:"block_hash" json:"block_hash,omitempty"`
	BlockNumber     uint64         `gorm:"column:block_number" ch:"block_number" json:"block_number,omitempty"`
	TxHash          common.Hash    `gorm:"column:tx_hash" ch:"tx_hash" json:"tx_hash,omitempty"`
	ContractAddress common.Address `gorm:"column:contract_address" ch:"contract_address" json:"contract_address,omitempty"`
	From            common.Address `gorm:"column:from" ch:"from" json:"from,omitempty"`
	To              common.Address `gorm:"column:to" ch:"to" json:"to,omitempty"`
	Value           *big.Int       `gorm:"column:value" ch:"value" json:"value,omitempty"`
}

func (*ERC20TransferWithMetadata) SetMeta

type ERC721Token

type ERC721Token struct {
	ContractAddress common.Address `gorm:"column:contract_address" ch:"contract_address" json:"contract_address,omitempty"`
	Name            string         `gorm:"column:name" ch:"name" json:"name,omitempty"`
	Symbol          string         `gorm:"column:symbol" ch:"symbol" json:"symbol,omitempty"`
	URI             string         `gorm:"column:uri" ch:"uri" json:"uri,omitempty"`
}

type ERC721Transfer

type ERC721Transfer struct {
	BlockHash       common.Hash    `gorm:"column:block_hash" ch:"block_hash" json:"block_hash,omitempty"`
	BlockNumber     uint64         `gorm:"column:block_number" ch:"block_number" json:"block_number,omitempty"`
	TxHash          common.Hash    `gorm:"column:tx_hash" ch:"tx_hash" json:"tx_hash,omitempty"`
	ContractAddress common.Address `gorm:"column:contract_address" ch:"contract_address" json:"contract_address,omitempty"`
	From            common.Address `gorm:"column:from" ch:"from" json:"from,omitempty"`
	To              common.Address `gorm:"column:to" ch:"to" json:"to,omitempty"`
	TokenID         *big.Int       `gorm:"column:token_id" ch:"token_id" json:"token_id,omitempty"`
}

type ERC721TransferWithMetadata

type ERC721TransferWithMetadata struct {
	ERC721Token
}

type EthereumLog

type EthereumLog types.Log

func (*EthereumLog) ToEventLog

func (l *EthereumLog) ToEventLog(blockHeader types.Header) EventLog

How EventLog looks like:

{
	"address": "0x5564886ca2c518d1964e5fcea4f423b41db9f561",
	"block_number": "141710",
	"block_timestamp": "2015-08-25 16:19:32",
	"data": "0x",
	"log_index": 0,
	"topic0": "0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc",
	"topic1": "0x6d616b6572000000000000000000000000000000000000000000000000000000",
	"topic2": "",
	"topic3": "",
	"topics_count": 2,
	"transaction_hash": "0x00efda1c9b71bb98139fc59a77b88b63f34d9f87b716f5f340ccf74535833dc4",
	"transaction_index": 0
  }

type EventLog

type EventLog struct {
	Address          string `json:"address,omitempty"`
	BlockNumber      string `json:"block_number,omitempty"`
	BlockTimestamp   string `json:"block_timestamp,omitempty"`
	Data             string `json:"data,omitempty"`
	LogIndex         uint   `json:"log_index,omitempty"`
	Topic0           string `json:"topic0,omitempty"`
	Topic1           string `json:"topic1,omitempty"`
	Topic2           string `json:"topic2,omitempty"`
	Topic3           string `json:"topic3,omitempty"`
	TopicsCount      int    `json:"topics_count,omitempty"`
	TransactionHash  string `json:"transaction_hash,omitempty"`
	TransactionIndex uint   `json:"transaction_index,omitempty"`
}

func (EventLog) ToEthereumLog

func (e EventLog) ToEthereumLog() types.Log

type Feed

type Feed struct {
	TxHash    common.Hash                 `json:"tx_hash"`
	From      common.Address              `json:"from"`
	To        common.Address              `json:"to"`
	GasUsed   uint64                      `json:"gas_used"`
	GasPrice  uint64                      `json:"gas_price"`
	MethodID  string                      `json:"method_id"`
	Network   constant.Network            `json:"network"`
	TokenLoss []ERC20TransferWithMetadata `json:"token_loss"`
	TokenGain []ERC20TransferWithMetadata `json:"token_gain"`
}

type FeedCursor

type FeedCursor struct {
	// Network          constant.Network `json:"network"`
	// AccountAddress   common.Address   `json:"account_address"`
	BlockNumber      uint64 `json:"block_number"`
	TransactionIndex uint64 `json:"transaction_index"`
}

type RPCBlock

type RPCBlock struct {
	Timestamp     string                `json:"timestamp"`
	BaseFeePerGas string                `json:"baseFeePerGas"`
	GasLimit      string                `json:"gasLimit"`
	Number        string                `json:"number"`
	Difficulty    string                `json:"difficulty"`
	Hash          string                `json:"hash"`
	Miner         string                `json:"miner"`
	Nonce         string                `json:"nonce"`
	Transactions  []RPCBlockTransaction `json:"transactions"`
}

func (*RPCBlock) GetCommonTransactionList

func (b *RPCBlock) GetCommonTransactionList() ([]RawTransaction, error)

func (*RPCBlock) GetOptimismTransactionList

func (b *RPCBlock) GetOptimismTransactionList() []RawOptimismTransaction

type RPCBlockTransaction

type RPCBlockTransaction struct {
	BlockHash            string `json:"blockHash,omitempty"`
	BlockNumber          string `json:"blockNumber,omitempty"`
	From                 string `json:"from,omitempty"`
	GasLimit             string `json:"gas,omitempty"`
	GasPrice             string `json:"gasPrice,omitempty"`
	MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas,omitempty"`
	MaxFeePerGas         string `json:"maxFeePerGas,omitempty"`
	Hash                 string `json:"hash,omitempty"`
	Input                string `json:"input,omitempty"`
	Nonce                string `json:"nonce,omitempty"`
	To                   string `json:"to,omitempty"`
	TransactionIndex     string `json:"transactionIndex,omitempty"`
	Value                string `json:"value,omitempty"`
	Type                 string `json:"type,omitempty"`
	ChainId              string `json:"chainId,omitempty"`

	// Optimism specific fields
	L1TxOrigin    string `json:"l1TxOrigin,omitempty"`
	L1BlockNumber string `json:"l1BlockNumber,omitempty"`
	L1Timestamp   string `json:"l1Timestamp,omitempty"`
	QueueOrigin   string `json:"queueOrigin,omitempty"`
}

type RPCReceipt

type RPCReceipt struct {
	TransactionHash   string `json:"transactionHash,omitempty"`
	TransactionIndex  string `json:"transactionIndex,omitempty"`
	BlockHash         string `json:"blockHash,omitempty"`
	BlockNumber       string `json:"blockNumber,omitempty"`
	From              string `json:"from,omitempty"`
	To                string `json:"to,omitempty"`
	CumulativeGasUsed string `json:"cumulativeGasUsed,omitempty"`
	GasUsed           string `json:"gasUsed,omitempty"`

	Status          string      `json:"status,omitempty"`
	GasPrice        string      `json:"gasPrice,omitempty"`
	ContractAddress string      `json:"contractAddress,omitempty"`
	Logs            []types.Log `json:"logs,omitempty"`

	// no such field in optimism
	EffectiveGasPrice string `json:"effectiveGasPrice,omitempty"`

	// optimism fields
	L1Fee       string `json:"l1Fee,omitempty"`
	L1FeeScalar string `json:"l1FeeScalar,omitempty"`
	L1GasPrice  string `json:"l1GasPrice,omitempty"`
	L1GasUsed   string `json:"l1GasUsed,omitempty"`
}

Optimism RPC Receipt Compatibility

func (*RPCReceipt) ToReceipt

func (r *RPCReceipt) ToReceipt() (*Receipt, error)

type RawOptimismTransaction

type RawOptimismTransaction struct {
	Hash                   string  `json:"hash,omitempty"`
	BlockHash              string  `json:"blockHash,omitempty"`
	BlockNumber            uint64  `json:"blockNumber,omitempty"`
	Timestamp              int64   `json:"timestamp"`
	From                   string  `json:"from,omitempty"`
	To                     string  `json:"to,omitempty"`
	Value                  string  `json:"value,omitempty"`
	TransactionFee         uint64  `json:"transactionFee"`
	L2GasPrice             uint64  `json:"l2GasPrice"`
	L2GasUsedByTransaction uint64  `json:"l2GasUsedByTransaction"`
	L1GasUsedByTransaction uint64  `json:"l1GasUsedByTransaction"`
	L1GasPrice             uint64  `json:"l1GasPrice"`
	L1FeeScalar            float64 `json:"l1FeeScalar"`
	Nonce                  uint64  `json:"nonce,omitempty"`
	TransactionIndex       uint    `json:"transactionIndex,omitempty"`
	ContractAddress        string  `json:"contractAddress,omitempty"`
	MethodID               string  `json:"methodID,omitempty"`
	Status                 uint64  `json:"status,omitempty"`
}

type RawTransaction

type RawTransaction struct {
	Hash              string `json:"hash,omitempty"`
	Status            uint64 `json:"status,omitempty"`
	BlockHash         string `json:"blockHash,omitempty"`
	BlockNumber       uint64 `json:"blockNumber,omitempty"`
	Timestamp         int64  `json:"timestamp"`
	From              string `json:"from,omitempty"`
	To                string `json:"to,omitempty"`
	Value             string `json:"value,omitempty"`
	TransactionFee    uint64 `json:"transactionFee"`
	GasPrice          uint64 `json:"gasPrice,omitempty"`
	GasLimit          uint64 `json:"gasLimit"`
	GasUsed           uint64 `json:"gas,omitempty"`
	BaseFee           uint64 `json:"baseFee"`
	MaxFeePerGas      uint64 `json:"maxFeePerGas,omitempty"`
	PriorityFeePerGas uint64 `json:"priorityFeePerGas,omitempty"`
	TxType            uint8  `json:"txType,omitempty"`
	MethodID          string `json:"methodID,omitempty"`
	Nonce             uint64 `json:"nonce,omitempty"`
	TransactionIndex  uint   `json:"transactionIndex,omitempty"`
	ContractAddress   string `json:"contractAddress,omitempty"`
}

type Receipt

type Receipt struct {
	TransactionHash   string  `json:"transactionHash,omitempty"`
	TransactionIndex  uint    `json:"transactionIndex,omitempty"`
	BlockHash         string  `json:"blockHash,omitempty"`
	BlockNumber       uint64  `json:"blockNumber,omitempty"`
	From              string  `json:"from,omitempty"`
	To                string  `json:"to,omitempty"`
	GasPrice          uint64  `json:"gasPrice"`
	GasUsed           uint64  `json:"gasUsed,omitempty"`
	EffectiveGasPrice uint64  `json:"effectiveGasPrice,omitempty"`
	ContractAddress   string  `json:"contractAddress,omitempty"`
	L1Fee             uint64  `json:"l1Fee,omitempty"`
	L1FeeScalar       float64 `json:"l1FeeScalar,omitempty"`
	L1GasPrice        uint64  `json:"l1GasPrice,omitempty"`
	L1GasUsed         uint64  `json:"l1GasUsed,omitempty"`
	Status            uint64  `json:"status,omitempty"`
}

type SQLQueryResp

type SQLQueryResp[T any] struct {
	TaskId    string             `json:"task_id"`
	Rows      int                `json:"rows"`
	RowsRead  int                `json:"rows_read"`
	BytesRead int64              `json:"bytes_read"`
	Elapsed   float64            `json:"elapsed"`
	Meta      []ChainbaseSQLMeta `json:"meta"`
	Result    T                  `json:"result"`
	ErrMsg    string             `json:"err_msg"`
}

type TokenChanges

type TokenChanges struct {
	TokenLoss []ERC20TransferWithMetadata `json:"token_loss"`
	TokenGain []ERC20TransferWithMetadata `json:"token_gain"`
}

type Transaction

type Transaction struct {
	BlockHash            string `json:"block_hash,omitempty"`
	BlockNumber          string `json:"block_number,omitempty"`
	BlockTimestamp       string `json:"block_timestamp,omitempty"`
	ContractAddress      string `json:"contract_address,omitempty"`
	CumulativeGasUsed    string `json:"cumulative_gas_used,omitempty"`
	EffectiveGasPrice    string `json:"effective_gas_price,omitempty"`
	FromAddress          string `json:"from_address,omitempty"`
	Gas                  string `json:"gas,omitempty"`
	GasPrice             string `json:"gas_price,omitempty"`
	GasUsed              string `json:"gas_used,omitempty"`
	Input                string `json:"input,omitempty"`
	LogsCount            int    `json:"logs_count,omitempty"`
	MaxFeePerGas         string `json:"max_fee_per_gas,omitempty"`
	MaxPriorityFeePerGas string `json:"max_priority_fee_per_gas,omitempty"`
	Nonce                string `json:"nonce,omitempty"`
	R                    string `json:"r,omitempty"`
	S                    string `json:"s,omitempty"`
	Status               string `json:"status,omitempty"`
	ToAddress            string `json:"to_address,omitempty"`
	TransactionHash      string `json:"transaction_hash,omitempty"`
	TransactionIndex     int    `json:"transaction_index,omitempty"`
	Type                 int    `json:"type,omitempty"`
	V                    string `json:"v,omitempty"`
	Value                string `json:"value,omitempty"`
}

Jump to

Keyboard shortcuts

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