service

package
v0.0.0-...-571c95a Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package service provides the unipan service TODO(bonedaddy): enable gas price estimation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

Factory provides swap factory monitoring capabilities and is designed to listen for new tokens

func NewFactory

func NewFactory(logger *zap.Logger, uc *uniswap.Client, db *database.Database, auther *utils.Authorizer, cfg *config.Config) *Factory

NewFactory returns a new factory wrapper client

func (*Factory) Watch

func (f *Factory) Watch(ctx context.Context, start *uint64, addrOverride *common.Address) error

Watch listens for new pair creation events if addrOverride is true use that instead of the default factory address configuration

type Pair

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

Pair provides pair monitoring capabilities to watch for liquidity additions in order to trigger a purchase

func NewPair

func NewPair(
	cfg *config.Config,
	logger *zap.Logger,
	uc *uniswap.Client,
	db *database.Database,
	auth *utils.Authorizer,
	basePair common.Address,
	token common.Address,
	pairAddr common.Address) *Pair

NewPair returns a new pair monitoring client

func (*Pair) Watch

func (p *Pair) Watch(ctx context.Context, deployBlock uint64) error

Watch monitors the pair waiting for liquidity to be added

type Service

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

Service prvoides the unipan backend service

func New

func New(
	ctx context.Context,
	cfg *config.Config,
	logger *zap.Logger,
	db *database.Database,
	auther *utils.Authorizer,
	pan *uniswap.Client, uni *uniswap.Client) *Service

New returns a new unipan service

func (*Service) StartFactoryWatchers

func (s *Service) StartFactoryWatchers(uniStart, panStart *uint64, addrOverride *common.Address) error

StartFactoryWatchers is used to start factory watcher services if uniStart is not nil we start monitoring uniswap events at that block if panStart is not nil we start monitoring pancakeswap events at that block if addrOverride is not nil we use that address for both factory contracts

Jump to

Keyboard shortcuts

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