service

package
v0.0.0-...-709c288 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressMonitor

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

func NewAddressMonitor

func NewAddressMonitor(sn domain.Sniper, addrs ...domain.NamedAddress) *AddressMonitor

func (*AddressMonitor) Monitor

func (m *AddressMonitor) Monitor(ctx context.Context, tx *types.Transaction)

type Bee

type Bee struct {
	RawPK        *ecdsa.PrivateKey
	PendingNonce uint64
}

func NewBee

func NewBee(
	rawPK *ecdsa.PrivateKey,
	pn uint64,
) *Bee

type EthClient

type EthClient interface {
	bind.ContractBackend

	SendTransaction(context.Context, *types.Transaction) error

	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

	BlockByNumber(context.Context, *big.Int) (b *types.Block, err error)

	NetworkID(context.Context) (*big.Int, error)
}

type EthClientCluster

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

func NewEthClientCluster

func NewEthClientCluster(d ...EthClient) *EthClientCluster

func (*EthClientCluster) BlockByNumber

func (e *EthClientCluster) BlockByNumber(ctx context.Context, n *big.Int) (b *types.Block, err error)

func (*EthClientCluster) CallContract

func (e *EthClientCluster) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*EthClientCluster) CodeAt

func (e *EthClientCluster) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

func (*EthClientCluster) EstimateGas

func (e *EthClientCluster) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

func (*EthClientCluster) FilterLogs

func (e *EthClientCluster) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*EthClientCluster) HeaderByNumber

func (e *EthClientCluster) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*EthClientCluster) NetworkID

func (e *EthClientCluster) NetworkID(ctx context.Context) (*big.Int, error)

func (*EthClientCluster) NewLoadBalancedContext

func (e *EthClientCluster) NewLoadBalancedContext(ctx context.Context) context.Context

func (*EthClientCluster) PendingCodeAt

func (e *EthClientCluster) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*EthClientCluster) PendingNonceAt

func (e *EthClientCluster) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*EthClientCluster) SendTransaction

func (e *EthClientCluster) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*EthClientCluster) SubscribeFilterLogs

func (e *EthClientCluster) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*EthClientCluster) SuggestGasPrice

func (e *EthClientCluster) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*EthClientCluster) SuggestGasTipCap

func (e *EthClientCluster) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

func (*EthClientCluster) TransactionByHash

func (e *EthClientCluster) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)

func (*EthClientCluster) TransactionReceipt

func (e *EthClientCluster) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

type Monitor

type Monitor func(context.Context, *types.Transaction)

type MonitorEngine

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

func NewMonitorEngine

func NewMonitorEngine(m ...Monitor) *MonitorEngine

func (*MonitorEngine) Monitor

func (e *MonitorEngine) Monitor(ctx context.Context, tx *types.Transaction)

type Sniper

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

func NewSniper

func NewSniper(
	e sniperETHClient,
	f sniperFactoryClient,
	s []*Bee,
	sn domain.Sniper,
) *Sniper

func (*Sniper) Snipe

func (c *Sniper) Snipe(ctx context.Context, gas *big.Int) error

Snipe cloggs the mempool triggering our Trigger contract for performing the swap

gas provided will be used on all txs. It's ideal to use the same gas as the addLiq tx so our txs gets the same priority as the addLiq one

Snipe is concurrently safe

type UniswapLiquidity

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

func NewUniswapLiquidity

func NewUniswapLiquidity(
	e uniswapLiquidityETHClient,
	s uniswapLiquiditySniperClient,
	sn domain.Sniper,
	gasMultiplier *big.Float,
) (*UniswapLiquidity, error)

func (*UniswapLiquidity) Add

func (u *UniswapLiquidity) Add(ctx context.Context, tx *types.Transaction, pending bool) error

Add checks when the tx is of addLiquidity in an UniswapV2 AMM fork. If all our checks regarding the snipe passes (eg. the devs adding a minimum liquidity that we expect) then we invoke the snipe

func (*UniswapLiquidity) AddETH

func (u *UniswapLiquidity) AddETH(ctx context.Context, tx *types.Transaction, pending bool) error

AddETH checks when the tx is of addLiquidityETH in an UniswapV2 AMM fork. If all our checks regarding the snipe passes (eg. the devs adding a minimum liquidity that we expect) then we invoke the snipe TODO Super similars, refactor?

type WhaleMonitor

type WhaleMonitor struct {
	MinThreshold *big.Int
}

func NewWhaleMonitor

func NewWhaleMonitor(m *big.Int) *WhaleMonitor

func (*WhaleMonitor) Monitor

func (m *WhaleMonitor) Monitor(ctx context.Context, tx *types.Transaction)

Jump to

Keyboard shortcuts

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