token

package
v0.162.14 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenPegSymbol added in v0.131.11

func GetTokenPegSymbol(symbol string) string

Types

type DefaultStore added in v0.138.8

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

func (*DefaultStore) GetTokens added in v0.138.8

func (ts *DefaultStore) GetTokens() []*Token

type Manager

type Manager struct {
	RPCClient *rpc.Client
	// contains filtered or unexported fields
}

Manager is used for accessing token store. It changes the token store based on overridden tokens

func NewTokenManager

func NewTokenManager(
	db *sql.DB,
	RPCClient *rpc.Client,
	networkManager *network.Manager,
) *Manager

func (*Manager) DeleteCustom

func (tm *Manager) DeleteCustom(chainID uint64, address common.Address) error

func (*Manager) DiscoverToken

func (tm *Manager) DiscoverToken(ctx context.Context, chainID uint64, address common.Address) (*Token, error)

func (*Manager) FindSNT

func (tm *Manager) FindSNT(chainID uint64) *Token

func (*Manager) FindToken

func (tm *Manager) FindToken(network *params.Network, tokenSymbol string) *Token

func (*Manager) FindTokenByAddress added in v0.156.1

func (tm *Manager) FindTokenByAddress(chainID uint64, address common.Address) *Token

func (*Manager) GetAllTokens added in v0.115.5

func (tm *Manager) GetAllTokens() ([]*Token, error)

func (*Manager) GetAllTokensAndNativeCurrencies added in v0.131.11

func (tm *Manager) GetAllTokensAndNativeCurrencies() ([]*Token, error)

func (*Manager) GetBalance

func (tm *Manager) GetBalance(ctx context.Context, client *chain.ClientWithFallback, account common.Address, token common.Address) (*big.Int, error)

func (*Manager) GetBalances

func (tm *Manager) GetBalances(parent context.Context, clients map[uint64]*chain.ClientWithFallback, accounts, tokens []common.Address) (map[common.Address]map[common.Address]*hexutil.Big, error)

func (*Manager) GetBalancesByChain added in v0.115.5

func (tm *Manager) GetBalancesByChain(parent context.Context, clients map[uint64]*chain.ClientWithFallback, accounts, tokens []common.Address) (map[uint64]map[common.Address]map[common.Address]*hexutil.Big, error)

func (*Manager) GetChainBalance

func (tm *Manager) GetChainBalance(ctx context.Context, client *chain.ClientWithFallback, account common.Address) (*big.Int, error)

func (*Manager) GetCustoms

func (tm *Manager) GetCustoms() ([]*Token, error)

func (*Manager) GetCustomsByChainID

func (tm *Manager) GetCustomsByChainID(chainID uint64) ([]*Token, error)

func (*Manager) GetToken added in v0.159.2

func (tm *Manager) GetToken(chainID uint64, tokenSymbol string) *Token

GetToken returns token by chainID and tokenSymbol. Use ToToken for native token

func (*Manager) GetTokenBalance

func (tm *Manager) GetTokenBalance(ctx context.Context, client *chain.ClientWithFallback, account common.Address, token common.Address) (*big.Int, error)

func (*Manager) GetTokenBalanceAt added in v0.125.2

func (tm *Manager) GetTokenBalanceAt(ctx context.Context, client *chain.ClientWithFallback, account common.Address, token common.Address, blockNumber *big.Int) (*big.Int, error)

func (*Manager) GetTokens

func (tm *Manager) GetTokens(chainID uint64) ([]*Token, error)

func (*Manager) GetTokensByChainIDs added in v0.154.0

func (tm *Manager) GetTokensByChainIDs(chainIDs []uint64) ([]*Token, error)

func (*Manager) GetVisible

func (tm *Manager) GetVisible(chainIDs []uint64) (map[uint64][]*Token, error)

func (*Manager) IsTokenVisible

func (tm *Manager) IsTokenVisible(chainID uint64, address common.Address) (bool, error)

func (*Manager) LookupToken added in v0.159.2

func (tm *Manager) LookupToken(chainID *uint64, tokenSymbol string) (token *Token, isNative bool)

func (*Manager) LookupTokenIdentity added in v0.159.2

func (tm *Manager) LookupTokenIdentity(chainID uint64, address common.Address, native bool) *Token

func (*Manager) ToToken added in v0.115.5

func (tm *Manager) ToToken(network *params.Network) *Token

func (*Manager) Toggle

func (tm *Manager) Toggle(chainID uint64, address common.Address) error

func (*Manager) UpsertCustom

func (tm *Manager) UpsertCustom(token Token) error

type Token

type Token struct {
	Address common.Address `json:"address"`
	Name    string         `json:"name"`
	Symbol  string         `json:"symbol"`
	Color   string         `json:"color"`
	// Decimals defines how divisible the token is. For example, 0 would be
	// indivisible, whereas 18 would allow very small amounts of the token
	// to be traded.
	Decimals uint   `json:"decimals"`
	ChainID  uint64 `json:"chainId"`
	// PegSymbol indicates that the token is pegged to some fiat currency, using the
	// ISO 4217 alphabetic code. For example, an empty string means it is not
	// pegged, while "USD" means it's pegged to the United States Dollar.
	PegSymbol string `json:"pegSymbol"`
}

func (*Token) IsNative

func (t *Token) IsNative() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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