util

package
v0.0.0-...-491e088 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SideBuy = "buy"
View Source
const SideSell = "sell"

Variables

View Source
var (
	SupportTokens  map[string]types.Token // token symbol to entity
	AllTokens      map[string]types.Token
	SupportMarkets map[string]types.Token // token symbol to contract hex address
	AllMarkets     []string
	AllTokenPairs  []TokenPair
	SymbolTokenMap map[common.Address]string
)
View Source
var MarketBaseOrder = map[string]uint8{"BAR": 5, "LRC": 10, "WETH": 20, "DAI": 30}

Functions

func AddressToAlias

func AddressToAlias(t string) string

func AddressToToken

func AddressToToken(t common.Address) (*types.Token, error)

func AliasToAddress

func AliasToAddress(t string) common.Address

func CalculatePrice

func CalculatePrice(amountS, amountB string, s, b string) float64

func GetSide

func GetSide(s, b string) string

func GetSymbolWithAddress

func GetSymbolWithAddress(address common.Address) (string, error)

func Initialize

func Initialize(options config.MarketOptions)

func IsAddress

func IsAddress(token string) bool

func IsSupportedMarket

func IsSupportedMarket(market string) bool

func StartRefreshCron

func StartRefreshCron(option config.MarketOptions)

func StringToFloat

func StringToFloat(token string, amount string) float64

func TokenRegister

func TokenRegister(input eventemitter.EventData) error

func TokenUnRegister

func TokenUnRegister(input eventemitter.EventData) error

func UnWrap

func UnWrap(market string) (s, b string)

func UnWrapToAddress

func UnWrapToAddress(market string) (s, b common.Address)

func WethTokenAddress

func WethTokenAddress() common.Address

func WrapMarket

func WrapMarket(s, b string) (market string, err error)

func WrapMarketByAddress

func WrapMarketByAddress(s, b string) (market string, err error)

Types

type TokenPair

type TokenPair struct {
	TokenS common.Address
	TokenB common.Address
}

type TokenStandard

type TokenStandard uint8

Jump to

Keyboard shortcuts

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