common

package
v0.0.0-...-edcad5e Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainStrings

func ChainStrings() []string

ChainStrings returns a slice of all String values of the enum

Types

type Chain

type Chain uint64

enumer -type=Chain -linecomment -json=true -text=true -sql=true

const (
	ChainBase Chain = iota + 1 // base
)

func ChainString

func ChainString(s string) (Chain, error)

ChainString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ChainValues

func ChainValues() []Chain

ChainValues returns all values of the enum

func (Chain) IsAChain

func (i Chain) IsAChain() bool

IsAChain returns "true" if the value is listed in the enum definition. "false" otherwise

func (Chain) MarshalJSON

func (i Chain) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Chain

func (Chain) MarshalText

func (i Chain) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Chain

func (*Chain) Scan

func (i *Chain) Scan(value interface{}) error

func (Chain) String

func (i Chain) String() string

func (*Chain) UnmarshalJSON

func (i *Chain) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Chain

func (*Chain) UnmarshalText

func (i *Chain) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Chain

func (Chain) Value

func (i Chain) Value() (driver.Value, error)

type CrawlResult

type CrawlResult struct {
	Trades []Tradelog `json:"trades"`
}

CrawlResult is result of the crawl

type EvmConfig

type EvmConfig struct {
	Enable              bool
	WsKey               string
	FromBlock           int
	MaxWorkers          int
	MaxBlocksForWorker  int
	WaitForConfirmation int
}

type Routes

type Routes struct {
	LogIndex        uint             `json:"log_index"`
	TokenInAddress  ethereum.Address `json:"token_in_address"`
	TokenInAmount   float64          `json:"token_in_amount"`
	TokenInUsdtRate float64          `json:"token_in_usdt_rate"`
	AmountIn        *big.Int         `json:"-"`

	TokenOutAddress  ethereum.Address `json:"token_out_address"`
	TokenOutAmount   float64          `json:"token_out_amount"`
	TokenOutUsdtRate float64          `json:"token_out_usdt_rate"`
	AmountOut        *big.Int         `json:"-"`
	Exchange         ethereum.Address `json:"exchange"`
}

type SwapLogData

type SwapLogData struct {
	AmountIn         *big.Int
	AmountOut        *big.Int
	Address          ethereum.Address
	RecipientAddress ethereum.Address
	TokenIn          ethereum.Address
	TokenOut         ethereum.Address
}

type TokenBalance

type TokenBalance struct {
	Address string  `json:"address"`
	Amount  float64 `json:"amount"`
}

human-friendly

type TokenContractInfo

type TokenContractInfo struct {
	Decimal uint8
	Symbol  string
	Name    string
}

type Tradelog

type Tradelog struct {
	BlockTimestamp time.Time        `json:"timestamp"`
	BlockNumber    uint64           `json:"block_number"`
	TxIndex        uint             `json:"tx_index"`
	TxHash         ethereum.Hash    `json:"tx_hash"`
	Sender         ethereum.Address `json:"sender"`

	TokenInAddress  ethereum.Address `json:"token_in_address"`
	TokenInAmount   float64          `json:"token_in_amount"`
	AmountIn        *big.Int
	TokenInUsdtRate float64 `json:"token_in_usdt_rate"`

	TokenOutAddress  ethereum.Address `json:"token_out_address"`
	TokenOutAmount   float64          `json:"token_out_amount"`
	AmountOut        *big.Int
	TokenOutUsdtRate float64 `json:"token_out_usdt_rate"`
	Routes           []byte  `json:"routes"`

	NativeTokenUsdtRate float64 `json:"native_token_usdt_rate"`
}

type TransferLogData

type TransferLogData struct {
	From    ethereum.Address
	To      ethereum.Address
	Value   *big.Int
	Raw     types.Log // Blockchain specific contextual infos
	IsCexIn bool
}

type Transferlog

type Transferlog struct {
	BlockTimestamp time.Time     `json:"timestamp"`
	BlockNumber    uint64        `json:"block_number"`
	TxIndex        uint          `json:"tx_index"`
	TxHash         ethereum.Hash `json:"tx_hash"`

	FromAddress ethereum.Address `json:"from_address"`
	ToAddress   ethereum.Address `json:"to_address"`

	TokenAddress ethereum.Address `json:"token_in_address"`
	TokenAmount  float64          `json:"token_in_amount"`
	IsCexIn      bool             `json:"is_cex_in"`
	Exchange     ethereum.Address `json:"exchange"`
}

Jump to

Keyboard shortcuts

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