common

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 5 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

func SourcePriceStrings

func SourcePriceStrings() []string

SourcePriceStrings 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 (
	ChainSolana Chain = iota + 1 // solana
)

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 SolanaTradelog

type SolanaTradelog struct {
	BlockTimestamp time.Time `json:"timestamp"`
	BlockNumber    uint64    `json:"block_number"`
	TxHash         string    `json:"tx_hash"`
	Sender         string    `json:"sender"`

	TokenInAddress  string  `json:"token_in_address"`
	TokenInAmount   float64 `json:"token_in_amount"`
	TokenInUsdtRate float64 `json:"token_in_usdt_rate"`

	TokenOutAddress  string  `json:"token_out_address"`
	TokenOutAmount   float64 `json:"token_out_amount"`
	TokenOutUsdtRate float64 `json:"token_out_usdt_rate"`

	SolUsdtRate float64 `json:"sol_usdt_rate"`

	CurrentTokenInUsdtRate  float64
	CurrentTokenOutUsdtRate float64
	Profit                  float64 `json:"profit"`
	GetCurrentRateFail      bool
}

type SolanaTransferlog

type SolanaTransferlog struct {
	BlockTimestamp time.Time `json:"timestamp"`
	BlockNumber    uint64    `json:"block_number"`
	TxHash         string    `json:"tx_hash"`

	FromAddress string `json:"from_address"`
	ToAddress   string `json:"to_address"`

	TokenAddress string  `json:"token_in_address"`
	TokenAmount  float64 `json:"token_in_amount"`
	IsCexIn      bool    `json:"is_cex_in"`

	CurrentTokenUsdtRate float64
	GetCurrentRateFail   bool
}

type SourcePrice

type SourcePrice uint64

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

const (
	SourcePriceCex SourcePrice = iota + 1 // cex
	SourcePriceDex                        // dex
)

func SourcePriceString

func SourcePriceString(s string) (SourcePrice, error)

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

func SourcePriceValues

func SourcePriceValues() []SourcePrice

SourcePriceValues returns all values of the enum

func (SourcePrice) IsASourcePrice

func (i SourcePrice) IsASourcePrice() bool

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

func (SourcePrice) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface for SourcePrice

func (SourcePrice) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface for SourcePrice

func (*SourcePrice) Scan

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

func (SourcePrice) String

func (i SourcePrice) String() string

func (*SourcePrice) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaler interface for SourcePrice

func (*SourcePrice) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface for SourcePrice

func (SourcePrice) Value

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

type Token

type Token struct {
	UsdPrice    float64     `json:"usdPrice"`
	Address     string      `json:"tokenAddress"`
	Symbol      string      `json:"symbol"`
	ChainID     string      `json:"chainId"`
	SourcePrice SourcePrice `json:"sourcePrice"`
}

Jump to

Keyboard shortcuts

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