tokendata

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package tokendata contains the token data service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImmutableTokenData

type ImmutableTokenData interface {
	// Decimals gets the number of decimals for a token
	Decimals() uint8
	// TokenID gets the tokenID
	TokenID() string
	// TokenAddress gets the Token's address
	TokenAddress() string
}

ImmutableTokenData contains immutable token data (decimals and tokenID) as long as the token ID of an address does not change, this data is guaranteed to be accurate.

type Service

type Service interface {
	// GetTokenData attempts to get token data from the cache otherwise its fetched from the bridge config
	GetTokenData(ctx context.Context, chainID uint32, token common.Address) (ImmutableTokenData, error)
	// GetPoolTokenData attempts to get pool token data from the cache otherwise its fetched from the erc20 interface
	GetPoolTokenData(ctx context.Context, chainID uint32, token common.Address, swapService fetcher.SwapService) (ImmutableTokenData, error)
}

Service provides data about tokens using either a cache or bridgeconfig cache keys sare always ${KEY_NAME}_CHAIN_ID_ADDRESS so unless a token changes tokenID's (not the other way around), data is guaranteed to be accurate.

func NewTokenDataService

func NewTokenDataService(service fetcher.Service, tokenSymbolToIDs map[string]string) (Service, error)

NewTokenDataService creates a new token data service.

Jump to

Keyboard shortcuts

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