func (wc *WatchedContract) Listen(ctx context.Context, db *database.Database, alerter *alerts.Alerter, authorizer *utils.Authorizer, breakPercentage float64) error {
	// register channel closures to prevent possible issues

	wc.logger.Info("contract watcher started listening for events")
	// get the pool contract address
	dbInfo, err := db.GetPool(wc.name)
	if err != nil {
		return err
	}
	poolAddress := common.HexToAddress(dbInfo.ContractAddress)

	// monitor the toggle events in a specific goroutine
	go wc.handleSwapToggles(ctx)

	// this is a blocking function call
	return wc.handleLogSwaps(ctx, db, alerter, authorizer, breakPercentage, poolAddress)
}
// Listen stars the watche contract listening process waiting for incoming events
Listen stars the watche contract listening process waiting for incoming events
// Listen stars the watche contract listening process waiting for incoming events
func (wc *WatchedContract) Listen(ctx context.Context, db *database.Database, alerter *alerts.Alerter, authorizer *utils.Authorizer, breakPercentage float64) error {
	wc.logger.Info("contract watcher started listening for events")
	dbInfo, err := db.GetPool(wc.name)
	if err != nil {
		return err
	}
	poolAddress := common.HexToAddress(dbInfo.ContractAddress)
	go wc.handleSwapToggles(ctx)
	return wc.handleLogSwaps(ctx, db, alerter, authorizer, breakPercentage, poolAddress)
}
func ( wc * WatchedContract ) Listen ( ctx context . Context , db * database . Database , alerter * alerts . Alerter , authorizer * utils . Authorizer , breakPercentage float64 ) error { wc . logger . Info ( " " ) dbInfo , err := db . GetPool ( wc . name ) if err != nil { return err } poolAddress := common . HexToAddress ( dbInfo . ContractAddress ) go wc . handleSwapToggles ( ctx ) return wc . handleLogSwaps ( ctx , db , alerter , authorizer , breakPercentage , poolAddress ) }
Listen stars the watche contract listening process waiting for incoming events
Listen stars the watche contract listening process waiting for incoming events
// register channel closures to prevent possible issues // get the pool contract address // monitor the toggle events in a specific goroutine // this is a blocking function call