Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FieldTag = "monitor"
Functions ¶
This section is empty.
Types ¶
type BlockHeight ¶
type ContractAddress ¶
type ContractAddress = string // 合约地址
type HeightScanner ¶
type HeightScanner interface { // SaveHeight 持久化最新块高 SaveHeight(ctx context.Context, height *BlockHeight) error // LoadLastHeight 加载上一次块高 LoadLastHeight(ctx context.Context) (*BlockHeight, error) }
HeightScanner 高度扫描器
type Options ¶
type Options struct { RpcUrl string // eth节点url AbiStr string // 组合abi,可以监控多个智能合约 Handler TxHandler // 业务处理handler Logger logrus.FieldLogger }
type TxHandler ¶
type TxHandler interface { HeightScanner // Do 处理命中的tx Do(ctx context.Context, info *TxInfo) // ContainContact 是否包含指定合约地址 // NOTE: 如果不满足也放行会在decode中抛出error "illegal tx" // 如果是多智能合约监听,可以使用map维护多个 // 配套的,需要把这些合约的abi合并后在monitor初始化时赋值给AbiStr,注意去重 ContainContact(ctx context.Context, address ContractAddress) bool }
TxHandler 业务tx句柄
Click to show internal directories.
Click to hide internal directories.