actions

package
v0.0.0-...-fbdb3c5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset     = "\033[0m"
	Bold      = "\033[1m"
	Underline = "\033[4m"
	Italic    = "\033[3m"
)

Variables

View Source
var ActionMapMutex sync.RWMutex

prevent concurrent map writes for maps: EventSigToAction ContractToEventSigToAction TxAddressToAction

View Source
var BlockActions []func(ActionBlockData)

array of action functions, all of which are called when block is mined

View Source
var ContractToEventAction map[common.Address][]func(ActionEventData)

map contract address to event handling action function

View Source
var ContractToEventSigToAction map[common.Address]map[common.Hash][]func(ActionEventData)

map contract address and event sig to functions

View Source
var ETH common.Address //  we will treat native ETH as an ERC20 token with address 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
View Source
var EventSigToAction map[common.Hash][]func(ActionEventData)

map event sig hash to action functions

View Source
var TxAddressToAction map[common.Address][]func(ActionTxData)

map transaction `to` or `from` address to action functions

tokens and addresses

Functions

func DisplayActionInfo

func DisplayActionInfo(actionNameSubstr string)

display full action info (including options) of actions that contain the given action name substring case insensitive

func DisplayActions

func DisplayActions()

func FinishActions

func FinishActions(actions map[string]shared.ActionOptions)

call all action finish functions only called by historical tracking after historical finishes

func InitActions

func InitActions(actions map[string]shared.ActionOptions)

initializes all actions by calling all method functions of action struct that are enabled in config file

func InitTornadoContracts

func InitTornadoContracts() tornadoContractsMutex

func ProcessERC20Transfer

func ProcessERC20Transfer(p ActionEventData)

func ProcessTornadoDeposit

func ProcessTornadoDeposit(p ActionEventData)

func ProcessTornadoWithdraw

func ProcessTornadoWithdraw(p ActionEventData)

func SendWebhookMsgERC20Transfer

func SendWebhookMsgERC20Transfer(eventLog types.Log, erc20 ERC20TransferInfo)

func SendWebhookMsgERC20Volume

func SendWebhookMsgERC20Volume(erc20Token common.Address, minutes int)

func TryBackrunTx

func TryBackrunTx(p ActionTxData)

Types

type ActionBlockData

type ActionBlockData struct {
	Block *types.Block
}

type ActionEventData

type ActionEventData struct {
	EventLog      types.Log
	EventFields   shared.EventFields
	DecodedTopics map[string]interface{}
	DecodedData   map[string]interface{}
}

type ActionTxData

type ActionTxData struct {
	Transaction *types.Transaction
	From        *common.Address
	To          *common.Address
	Block       *types.Block // block which the tx was in
}

type ERC20TransferInfo

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

type NativePrice

type NativePrice struct {
	Value    string `json:"value"`
	Decimals int    `json:"decimals"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Address  string `json:"address"`
}

type TokenInfo

type TokenInfo struct {
	TokenName               string      `json:"tokenName"`
	TokenSymbol             string      `json:"tokenSymbol"`
	TokenDecimals           string      `json:"tokenDecimals"`
	NativePrice             NativePrice `json:"nativePrice"`
	UsdPrice                float64     `json:"usdPrice"`
	UsdPriceFormatted       string      `json:"usdPriceFormatted"`
	ExchangeName            string      `json:"exchangeName"`
	ExchangeAddress         string      `json:"exchangeAddress"`
	TokenAddress            string      `json:"tokenAddress"`
	PriceLastChangedAtBlock string      `json:"priceLastChangedAtBlock"`
	PossibleSpam            bool        `json:"possibleSpam"`
	VerifiedContract        bool        `json:"verifiedContract"`
	PairAddress             string      `json:"pairAddress"`
	PairTotalLiquidityUsd   string      `json:"pairTotalLiquidityUsd"`
	PercentChange24hr       string      `json:"24hrPercentChange"`
}

type WaitGroupCount

type WaitGroupCount struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}
var RpcWaitGroup WaitGroupCount

wait group used to track and wait for rpc requests if RpcWaitGroup.GetCount() is too many, historical events listener calls RpcWaitGroup.Wait()

func (*WaitGroupCount) Add

func (wg *WaitGroupCount) Add(delta int)

func (*WaitGroupCount) Done

func (wg *WaitGroupCount) Done()

func (*WaitGroupCount) GetCount

func (wg *WaitGroupCount) GetCount() int

Jump to

Keyboard shortcuts

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