Documentation
¶
Index ¶
- Constants
- type Attrs
- type Contract
- func (c *Contract) Close() error
- func (c *Contract) DoneSignal() <-chan struct{}
- func (c *Contract) GetContractDesc(addr string) (ContractDesc, error)
- func (c *Contract) GetProcessedBlockNumber() uint64
- func (c *Contract) HandleEvent(client *rpcclient.EvmClient, event Event, log types.Log) error
- func (c *Contract) Init(attrs Attrs)
- func (c *Contract) RegisterEventHook(event Event, f func(client *rpcclient.EvmClient, log types.Log) error) error
- func (c *Contract) RegisterWatchEvent(events ...Event) error
- func (c *Contract) RegisterWatchTopics(topicsIndex int, topics ...common.Hash) error
- func (c *Contract) Scan(client *rpcclient.EvmClient) error
- func (c *Contract) UpdateProcessedBlockNumber(num uint64) error
- type ContractDesc
- type Event
- type IContract
Constants ¶
View Source
const DefaultWatchLimit = 20
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attrs ¶
type Attrs struct {
ChainId uint64
Chain string
DeployedBlockNumber uint64 // contract deployment height
ProcessedBlockNumber uint64 // has been processed on block number, default is DeployedBlockNumber
WatchBlockLimit int64 // Limit the number of blocks scanned each time, default is 20
ContractToDesc map[string]ContractDesc
}
type Contract ¶
type Contract struct {
Attrs
Addrs []common.Address
Topics [][]common.Hash
IsRunning atomic.Bool
IsClose atomic.Bool
// contains filtered or unexported fields
}
func (*Contract) DoneSignal ¶
func (c *Contract) DoneSignal() <-chan struct{}
func (*Contract) GetContractDesc ¶
func (c *Contract) GetContractDesc(addr string) (ContractDesc, error)
func (*Contract) GetProcessedBlockNumber ¶
GetProcessedBlockNumber ...
func (*Contract) HandleEvent ¶
HandleEvent method call Hook
func (*Contract) RegisterEventHook ¶
func (c *Contract) RegisterEventHook(event Event, f func(client *rpcclient.EvmClient, log types.Log) error) error
RegisterEventHook Hook is a function that handles event, HandleEvent method call this Hook
func (*Contract) RegisterWatchEvent ¶
RegisterWatchEvent topics[0] is smart contract event
func (*Contract) RegisterWatchTopics ¶
RegisterWatchTopics topic is smart contract event parameter
topicsIndex: [0-3] event topics
func (*Contract) UpdateProcessedBlockNumber ¶
UpdateProcessedBlockNumber ...
type ContractDesc ¶
type IContract ¶
type IContract interface {
Init(attrs Attrs)
Close() error
DoneSignal() <-chan struct{}
RegisterWatchEvent(events ...Event) error
RegisterWatchTopics(topicsIndex int, topics ...common.Hash) error
RegisterEventHook(event Event, f func(client *rpcclient.EvmClient, log types.Log) error) error
HandleEvent(client *rpcclient.EvmClient, event Event, log types.Log) error
UpdateProcessedBlockNumber(num uint64) error
GetProcessedBlockNumber() uint64
Scan(client *rpcclient.EvmClient) error
GetContractDesc(addr string) (ContractDesc, error)
}
Click to show internal directories.
Click to hide internal directories.