Documentation ¶
Overview ¶
Moved here because transactions package depends on accounts package which depends on appdatabase where this functionality is needed
Index ¶
- Constants
- Variables
- func GetEventSignatureHash(signature string) common.Hash
- func IsTokenTransfer(logs []*types.Log) bool
- func NewAndSet[T any](v T) *T
- func ParseErc20TransferLog(ethlog *types.Log) (from, to common.Address, amount *big.Int)
- func ParseErc721TransferLog(ethlog *types.Log) (from, to common.Address, tokenID *big.Int)
- func ParseHopBridgeTransferFromL1CompletedLog(ethlog *types.Log) (recipient common.Address, relayer common.Address, amount *big.Int, err error)
- func ParseHopBridgeTransferSentLog(ethlog *types.Log) (transferID *big.Int, chainID uint64, recipient common.Address, amount *big.Int, ...)
- func ParseHopBridgeTransferSentToL2Log(ethlog *types.Log) (chainID uint64, recipient common.Address, relayer common.Address, ...)
- func ParseHopWithdrawalBondedLog(ethlog *types.Log) (transferID *big.Int, amount *big.Int, err error)
- func ParseUniswapV2Log(ethlog *types.Log) (pairAddress common.Address, from common.Address, to common.Address, ...)
- func ParseUniswapV3Log(ethlog *types.Log) (poolAddress common.Address, sender common.Address, recipient common.Address, ...)
- func ParseWETHDepositLog(ethlog *types.Log) (src common.Address, amount *big.Int)
- func ParseWETHWithdrawLog(ethlog *types.Log) (dst common.Address, amount *big.Int)
- func TxDataContainsAddress(txType uint8, txData []byte, address common.Address) bool
- type ChainID
- type EventType
- type Type
Constants ¶
View Source
const ( UnknownChainID uint64 = 0 EthereumMainnet uint64 = 1 EthereumGoerli uint64 = 5 EthereumSepolia uint64 = 11155111 OptimismMainnet uint64 = 10 OptimismGoerli uint64 = 420 ArbitrumMainnet uint64 = 42161 ArbitrumGoerli uint64 = 421613 ArbitrumSepolia uint64 = 421614 )
View Source
const ( // Transaction types EthTransfer Type = "eth" Erc20Transfer Type = "erc20" Erc721Transfer Type = "erc721" UniswapV2Swap Type = "uniswapV2Swap" UniswapV3Swap Type = "uniswapV3Swap" HopBridgeFrom Type = "HopBridgeFrom" HopBridgeTo Type = "HopBridgeTo" // Event types WETHDepositEventType EventType = "wethDepositEvent" WETHWithdrawalEventType EventType = "wethWithdrawalEvent" Erc20TransferEventType EventType = "erc20Event" Erc721TransferEventType EventType = "erc721Event" UniswapV2SwapEventType EventType = "uniswapV2SwapEvent" UniswapV3SwapEventType EventType = "uniswapV3SwapEvent" HopBridgeTransferSentToL2EventType EventType = "hopBridgeTransferSentToL2Event" HopBridgeTransferFromL1CompletedEventType EventType = "hopBridgeTransferFromL1CompletedEvent" HopBridgeWithdrawalBondedEventType EventType = "hopBridgeWithdrawalBondedEvent" HopBridgeTransferSentEventType EventType = "hopBridgeTransferSentEvent" UnknownEventType EventType = "unknownEvent" // Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value) // Transfer (index_topic_1 address from, index_topic_2 address to, index_topic_3 uint256 tokenId) Erc20_721TransferEventSignature = "Transfer(address,address,uint256)" // TransferFromL1Completed (index_topic_1 address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline, index_topic_2 address relayer, uint256 relayerFee) HopBridgeTransferFromL1CompletedEventSignature = "TransferFromL1Completed(address,uint256,uint256,uint256,address,uint256)" )
Variables ¶
View Source
var AverageBlockDurationForChain = map[ChainID]time.Duration{ ChainID(UnknownChainID): time.Duration(12000) * time.Millisecond, ChainID(EthereumMainnet): time.Duration(12000) * time.Millisecond, ChainID(EthereumGoerli): time.Duration(12000) * time.Millisecond, ChainID(OptimismMainnet): time.Duration(400) * time.Millisecond, ChainID(OptimismGoerli): time.Duration(2000) * time.Millisecond, ChainID(ArbitrumMainnet): time.Duration(300) * time.Millisecond, ChainID(ArbitrumGoerli): time.Duration(1500) * time.Millisecond, }
Functions ¶
func GetEventSignatureHash ¶ added in v0.157.2
func IsTokenTransfer ¶ added in v0.157.2
func ParseErc20TransferLog ¶ added in v0.157.2
func ParseErc721TransferLog ¶ added in v0.157.2
func ParseHopBridgeTransferFromL1CompletedLog ¶ added in v0.161.4
func ParseHopBridgeTransferSentLog ¶ added in v0.161.4
func ParseHopBridgeTransferSentToL2Log ¶ added in v0.161.4
func ParseHopWithdrawalBondedLog ¶ added in v0.161.4
func ParseUniswapV2Log ¶ added in v0.157.2
func ParseUniswapV3Log ¶ added in v0.157.2
func ParseWETHDepositLog ¶ added in v0.159.5
func ParseWETHWithdrawLog ¶ added in v0.159.5
Types ¶
type ChainID ¶
type ChainID uint64
func AllChainIDs ¶ added in v0.167.5
func AllChainIDs() []ChainID
type EventType ¶ added in v0.157.2
type EventType string
Log Event type
func GetEventType ¶ added in v0.157.2
Detect event type for a cetain item from the Events Log
type Type ¶ added in v0.157.2
type Type string
Type type of transaction
func EventTypeToSubtransactionType ¶ added in v0.157.2
Click to show internal directories.
Click to hide internal directories.