# Path: deploy/utils.py
# def watch_logs(self, callback):
#     def log_callback(log):
#         callback(self.set_log_data(log))
# 
#     self.filter.watch(log_callback)


from deploy.utils import watch_logs
from collections import defaultdict
from operator import itemgetter
from web3.utils.filters import construct_event_filter_params
from web3.utils.events import get_event_data
from web3.formatters import input_filter_params_formatter, log_array_formatter
import logging
import time
import json
import shutil
import gevent
import os
import click
        Auction = self.chain.provider.get_contract_factory('DutchAuction')
        self.auction_contract = Auction(address=auction_contract_addr)
        self.auction_contract_addr = auction_contract_addr
        self.state = EventSamplerState(state_file_path)
        callbacks = {
            'BidSubmission': self.on_bid_submission,
            'AuctionEnded': self.on_auction_end,
            'Deployed': self.on_deployed_event,
            'AuctionStarted': self.on_auction_start,
            'ClaimedTokens': self.on_claimed_tokens
        }
        self.events = defaultdict(list)
        self.auction_start_block = None
        self.total_claimed = 0
        self.final_price = None
        self.auction_start_time = None
        self.auction_end_time = None
        self.price_start = None
        self.price_constant = None
        self.price_exponent = None

        for k, v in callbacks.items():
            self.sync_events(k, v)
            watch_logs(self.auction_contract, k, v)

        # start state save event - after the events are synced
        self.save_event = StateSave(self.state)
        self.save_event.start()

    def sync_events(self, event_name: str, callback):

# Path: deploy/utils.py
# def watch_logs(self, callback):
#     def log_callback(log):
#         callback(self.set_log_data(log))
# 
#     self.filter.watch(log_callback)


# Path: event_sampler/sampler.py
from deploy.utils import watch_logs
from collections import defaultdict
from operator import itemgetter
from web3.utils.filters import construct_event_filter_params
from web3.utils.events import get_event_data
from web3.formatters import input_filter_params_formatter, log_array_formatter
import logging
import time
import json
import shutil
import gevent
import os
import click

        Auction = self.chain.provider.get_contract_factory('DutchAuction')
        self.auction_contract = Auction(address=auction_contract_addr)
        self.auction_contract_addr = auction_contract_addr
        self.state = EventSamplerState(state_file_path)
        callbacks = {
            'BidSubmission': self.on_bid_submission,
            'AuctionEnded': self.on_auction_end,
            'Deployed': self.on_deployed_event,
            'AuctionStarted': self.on_auction_start,
            'ClaimedTokens': self.on_claimed_tokens
        }
        self.events = defaultdict(list)
        self.auction_start_block = None
        self.total_claimed = 0
        self.final_price = None
        self.auction_start_time = None
        self.auction_end_time = None
        self.price_start = None
        self.price_constant = None
        self.price_exponent = None

        for k, v in callbacks.items():
            self.sync_events(k, v)
            watch_logs(self.auction_contract, k, v)

        # start state save event - after the events are synced
        self.save_event = StateSave(self.state)
        self.save_event.start()

    def sync_events(self, event_name: str, callback):

        t_start = time.time()