entities

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: AGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TRONDecimals  = 6
	ISWAPDecimals = 8
	BTTDecimals   = 18
	BNBDecimals   = 18
	TRON          = *newCurrency(TRONDecimals, "TRX", "Tron")
	BNB           = *newCurrency(BNBDecimals, "BNB", "Tron")
	BTT           = *newCurrency(BTTDecimals, "BTT", "Tron")
)
View Source
var WETH = map[constants.ChainID]Token{
	constants.MAINNET:    NewToken(constants.MAINNET, "0x891CDB91D149F23B1A45D9C5CA78A88D0CB44C18", TRONDecimals, "WTRX", "Wrapped TRX"),
	constants.SHASTA:     NewToken(constants.SHASTA, "0xB970B980C520EC3F49921C2727BFA6DE79E7226A", TRONDecimals, "WTRX", "Wrapped TRX"),
	constants.NILE:       NewToken(constants.NILE, "0x8f44113A985076431b77f6078f0929f949cB8836", TRONDecimals, "WTRX", "Wrapped TRX"),
	constants.BTTMainnet: NewToken(constants.BTTMainnet, "0x23181F21DEa5936e24163FFABa4Ea3B316B57f3C", BTTDecimals, "WBTT", "Wrapped Bittorrent"),
	constants.BSCMainnet: NewToken(constants.BSCMainnet, "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", BNBDecimals, "WBNB", "Wrapped BNB"),
}

Functions

func CurrencyEquals

func CurrencyEquals(currencyA, currencyB Currency) bool

CurrencyEquals checks the currency equality

Types

type Currency

type Currency struct {
	Decimals int    `json:"decimals,omitempty" bson:"decimals"`
	Symbol   string `json:"symbol,omitempty" bson:"symbol"`
	Name     string `json:"name,omitempty" bson:"name"`
}

func ETHER

func ETHER(chainID constants.ChainID) *Currency

func (*Currency) Equals

func (c *Currency) Equals(other *Currency) bool

type Token

type Token struct {
	Currency `bson:"inline"`
	ChainID  constants.ChainID `json:"chain_id,omitempty" bson:"chainId"`
	Address  string            `json:"address,omitempty" bson:"address"`
}

Token the ERC20 based crypto token

func NewToken

func NewToken(chainID constants.ChainID, address string, decimals int, symbol, name string) Token

NewToken used as the main constructior for tokens

func (*Token) Equal

func (t *Token) Equal(other *Token) bool

Equal checking the token equalitiy

func (*Token) SortsBefore

func (t *Token) SortsBefore(other *Token) bool

SortsBefore sorts the tokens based on addresses

func (*Token) Wrapped

func (t *Token) Wrapped() *Token

Wrapped returns the wrapped token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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