Versions in this module Expand all Collapse all v0 v0.0.1 May 5, 2023 Changes in this version + var ErrDifferentChain = errors.New("different chain") + var ErrDifferentCurrencies = errors.New("different currencies") + var ErrSameAddress = errors.New("same address") + var MaxUint256 = new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16) + var OneHundred = NewFraction(big.NewInt(100), big.NewInt(1)) + var WETH9 = map[uint]*Token + type BaseCurrency struct + func (c *BaseCurrency) ChainId() uint + func (c *BaseCurrency) Decimals() uint + func (c *BaseCurrency) Equal(other Currency) bool + func (c *BaseCurrency) IsNative() bool + func (c *BaseCurrency) IsToken() bool + func (c *BaseCurrency) Name() string + func (c *BaseCurrency) Symbol() string + func (c *BaseCurrency) Wrapped() *Token + type Currency interface + ChainId func() uint + Decimals func() uint + Equal func(other Currency) bool + IsNative func() bool + IsToken func() bool + Name func() string + Symbol func() string + Wrapped func() *Token + func NewNative(wrapped *Token, symbol, name string) Currency + type CurrencyAmount struct + Currency Currency + DecimalScale *big.Int + func FromFractionalAmount(currency Currency, numerator *big.Int, denominator *big.Int) *CurrencyAmount + func FromRawAmount(currency Currency, rawAmount *big.Int) *CurrencyAmount + func (ca *CurrencyAmount) Add(other *CurrencyAmount) *CurrencyAmount + func (ca *CurrencyAmount) Divide(other *Fraction) *CurrencyAmount + func (ca *CurrencyAmount) Multiply(other *Fraction) *CurrencyAmount + func (ca *CurrencyAmount) Subtract(other *CurrencyAmount) *CurrencyAmount + func (ca *CurrencyAmount) ToExact() string + func (ca *CurrencyAmount) ToFixed(decimalPlaces int32) string + func (ca *CurrencyAmount) ToSignificant(significantDigits int32) string + func (ca *CurrencyAmount) Wrapped() *CurrencyAmount + type Ether struct + func EtherOnChain(chainId uint) *Ether + func (e *Ether) Equal(other Currency) bool + func (e *Ether) Wrapped() *Token + type Fraction struct + Denominator *big.Int + Numerator *big.Int + func NewFraction(numerator, denominator *big.Int) *Fraction + func (f *Fraction) Add(other *Fraction) *Fraction + func (f *Fraction) Divide(other *Fraction) *Fraction + func (f *Fraction) EqualTo(other *Fraction) bool + func (f *Fraction) GreaterThan(other *Fraction) bool + func (f *Fraction) Invert() *Fraction + func (f *Fraction) LessThan(other *Fraction) bool + func (f *Fraction) Multiply(other *Fraction) *Fraction + func (f *Fraction) Quotient() *big.Int + func (f *Fraction) Remainder() *Fraction + func (f *Fraction) Subtract(other *Fraction) *Fraction + func (f *Fraction) ToFixed(decimalPlaces int32) string + func (f *Fraction) ToSignificant(significantDigits int32) string + type Native struct + func (n *Native) Equal(other Currency) bool + func (n *Native) Wrapped() *Token + type Percent struct + func NewPercent(numerator, denominator *big.Int) *Percent + func (p *Percent) Add(other *Percent) *Percent + func (p *Percent) Divide(other *Percent) *Percent + func (p *Percent) Multiply(other *Percent) *Percent + func (p *Percent) Subtract(other *Percent) *Percent + func (p *Percent) ToFixed(decimalPlaces int32) string + func (p *Percent) ToSignificant(significantDigits int32) string + type Price struct + BaseCurrency Currency + QuoteCurrency Currency + Scalar *Fraction + func NewPrice(baseCurrency, quoteCurrency Currency, denominator, numerator *big.Int) *Price + func (p *Price) Invert() *Price + func (p *Price) Multiply(other *Price) (*Price, error) + func (p *Price) Quote(currencyAmount *CurrencyAmount) (*CurrencyAmount, error) + func (p *Price) ToFixed(decimalPlaces int32) string + func (p *Price) ToSignificant(significantDigits int32) string + type Rounding int + const RoundDown + const RoundHalfUp + const RoundUp + type Token struct + Address common.Address + func NewToken(chainID uint, address common.Address, decimals uint, symbol string, ...) *Token + func (t *Token) Equal(other Currency) bool + func (t *Token) SortsBefore(other *Token) (bool, error) + func (t *Token) Wrapped() *Token + type TradeType int + const ExactInput + const ExactOutput