daemons

package
v0.0.0-...-8b20efb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLifeSpan     = 30 * time.Second
	DefaultLifeSpanHalf = DefaultLifeSpan / 2
)
View Source
const (
	DaemonNameSushiswapPools = "sushiswapPools"
	SushiswapGraphURI        = "https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork"
)
View Source
const (
	DaemonNameUniswapV2Pools = "uniswapV2Pools"
	UniswapV2GraphURI        = "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2"
)
View Source
const (
	DaemonNameTokenPriceBalancer = "tokenpriceBalancer"

	TokenPriceBalancerURI = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer" // #nosec G101
)
View Source
const (
	DaemonNameBalancerPools = "balanerPools"
)
View Source
const (
	DaemonNameMergedPoolInfos = "mergePoolInfos"
)
View Source
const (
	DaemonNameTokenList = "tokenlist"
)

Variables

This section is empty.

Functions

func NewTokenPriceBalancer

func NewTokenPriceBalancer(l Logger) *tokenPriceBalancer

Types

type BalancerPoolInfo

type BalancerPoolInfo struct {
	ID              string `json:"id"`
	SwapFee         string `json:"swapFee"`
	TotalSwapFee    string `json:"totalSwapFee"`
	TotalSwapVolume string `json:"totalSwapVolume"`
	TotalShares     string `json:"totalShares"`
	Liquidity       string `json:"liquidity"`
	TotalWeight     string `json:"totalWeight"`
	TotalSupply     string `json:"totalSupply"`
	Tokens          []struct {
		ID           string `json:"id"`
		Address      string `json:"address"`
		Balance      string `json:"balance"`
		Decimals     int    `json:"decimals"`
		Symbol       string `json:"symbol"`
		DenormWeight string `json:"denormWeight"`
	} `json:"tokens"`
}

type Daemon

type Daemon interface {
	Run(ctx context.Context)
	GetData() IMap
}

func Get

func Get(name string) (Daemon, bool)

func NewBalancerPoolsDaemon

func NewBalancerPoolsDaemon(l Logger, topLiquidity uint) Daemon

func NewMergedPoolInfosDaemon

func NewMergedPoolInfosDaemon(l Logger) Daemon

func NewSushiswapPoolsDaemon

func NewSushiswapPoolsDaemon(l Logger) Daemon

func NewTokenListDaemon

func NewTokenListDaemon(l Logger) Daemon

func NewUniswapV2PoolsDaemon

func NewUniswapV2PoolsDaemon(l Logger, topLiquidity uint) Daemon

TODO:: a more versatile constrcutor

type IMap

type IMap interface {
	Map(func(ele interface{}))
}

type Logger

type Logger interface {
	Error(e ...interface{})
}

type PoolInfos

type PoolInfos []types.PoolInfo

func (PoolInfos) Map

func (p PoolInfos) Map(f func(ele interface{}))

type PriceInfo

type PriceInfo struct {
	Address string `json:"id"`
	Symbol  string `json:"symbol"`
	Price   string `json:"price"`
}

type PriceInfos

type PriceInfos []PriceInfo

func (PriceInfos) Map

func (p PriceInfos) Map(f func(ele interface{}))

type SushiswapPoolInfo

type SushiswapPoolInfo struct {
	ID     string `json:"id"`
	Token0 struct {
		ID             string `json:"id"`
		Name           string `json:"name"`
		Symbol         string `json:"symbol"`
		TotalLiquidity string `json:"totalLiquidity"`
	} `json:"token0"`
	Token1 struct {
		ID             string `json:"id"`
		Name           string `json:"name"`
		Symbol         string `json:"symbol"`
		TotalLiquidity string `json:"totalLiquidity"`
	} `json:"token1"`
	Reserve0           string `json:"reserve0"`
	Reserve1           string `json:"reserve1"`
	ReserveUSD         string `json:"reserveUSD"`
	ReserveETH         string `json:"reserveETH"`
	TotalSupply        string `json:"totalSupply"`
	VolumeUSD          string `json:"volumeUSD"`
	VolumeToken0       string `json:"volumeToken0"`
	VolumeToken1       string `json:"volumeToken1"`
	Token0Price        string `json:"token0Price"`
	Token1Price        string `json:"token1Price"`
	TrackedReserveETH  string `json:"tracktedReserveETH"`
	UntractedVolumeUSD string `json:"untractedVolumeUSD"`
}

type TokenInfos

type TokenInfos map[string]types.Token

func NewTokenInfos

func NewTokenInfos() TokenInfos

func (TokenInfos) Get

func (t TokenInfos) Get(s string) (types.Token, bool)

func (TokenInfos) HasSymbol

func (t TokenInfos) HasSymbol(s string) bool

func (TokenInfos) Map

func (t TokenInfos) Map(f func(ele interface{}))

type TokenListToken

type TokenListToken struct {
	ChainID  uint64 `json:"chainId"`
	Address  string `json:"address"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	LogoURI  string `json:"logoURI,omitempty"`
}

type UniswapV2PoolInfo

type UniswapV2PoolInfo struct {
	ID     string `json:"id"`
	Token0 struct {
		ID     string `json:"id"`
		Name   string `json:"name"`
		Symbol string `json:"symbol"`
	} `json:"token0"`
	Token1 struct {
		ID     string `json:"id"`
		Name   string `json:"name"`
		Symbol string `json:"symbol"`
	} `json:"token1"`
	Reserve0     string `json:"reserve0"`
	Reserve1     string `json:"reserve1"`
	ReserveUSD   string `json:"reserveUSD"`
	ReserveETH   string `json:"reserveETH"`
	TotalSupply  string `json:"totalSupply"`
	VolumeUSD    string `json:"volumeUSD"`
	VolumeToken0 string `json:"volumeToken0"`
	VolumeToken1 string `json:"volumeToken1"`
	Token0Price  string `json:"token0Price"`
	Token1Price  string `json:"token1Price"`
}

Jump to

Keyboard shortcuts

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