pairs

package
v0.0.0-...-da9fee4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ERC20Token

type ERC20Token struct {
	Address  common.Address
	Name     string
	Symbol   string
	Decimals uint8
}

ERC20Token represents a single ERC20 token

func NewERC20Token

func NewERC20Token(address common.Address, symbol string, decimals uint8) ERC20Token

type PairHandler

type PairHandler struct {
	Pairs         map[string]TokenPair
	ProtocolPairs map[string][]ProtocolPair
	// contains filtered or unexported fields
}

PairHandler manages operations related to token pairs

func NewPairHandler

func NewPairHandler(redisUrl string) *PairHandler

NewPairHandler creates a new PairHandler instance

func (*PairHandler) AddPair

func (ph *PairHandler) AddPair(token0, token1 ERC20Token)

AddPair adds a new token pair to the handler

func (*PairHandler) AddProtocolPair

func (ph *PairHandler) AddProtocolPair(ctx context.Context, protocolName, contractAddress string, pair TokenPair)

AddProtocolPair adds a new protocol pair to the handler

func (*PairHandler) FindProtocolsForPair

func (ph *PairHandler) FindProtocolsForPair(token0Address, token1Address string) []ProtocolPair

FindProtocolsForPair finds all protocols that include the specified token pair

func (*PairHandler) GetPair

func (ph *PairHandler) GetPair(token0Address, token1Address string) (TokenPair, bool)

GetPair retrieves a token pair from the handler

func (*PairHandler) GetProtocolPairs

func (ph *PairHandler) GetProtocolPairs(token0Address, token1Address string) []ProtocolPair

GetProtocolPairs retrieves all protocol pairs for a given token pair

type ProtocolPair

type ProtocolPair struct {
	ProtocolName    string
	ContractAddress string
	Pair            TokenPair
}

ProtocolPair represents a DeFi protocol contract address and its associated token pair

func NewProtocolPair

func NewProtocolPair(protocolName, contractAddress string, pair TokenPair) ProtocolPair

type TokenHandler

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

func NewTokenHandler

func NewTokenHandler(redisUrl string, nodeUrl string) *TokenHandler

func (*TokenHandler) GetTokenData

func (th *TokenHandler) GetTokenData(ctx context.Context, address string) (string, error)

type TokenPair

type TokenPair struct {
	Token0 ERC20Token
	Token1 ERC20Token
}

TokenPair represents a pair of ERC20 tokens

func NewTokenPair

func NewTokenPair(token0, token1 ERC20Token) TokenPair

Jump to

Keyboard shortcuts

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