Skip to content

Commit

Permalink
logs editing
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed May 3, 2023
1 parent 66f3d6f commit c1a007a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main(self, sleep_time: int) -> None:
infura_connection = f"https://mainnet.infura.io/v3/{INFURA_KEY}"
web_3 = Web3(Web3.HTTPProvider(infura_connection))
start_block = web_3.eth.block_number
self.logger.info("starting...")
# self.logger.info("starting...")
unchecked_hashes: List[str] = []
while True:
time.sleep(sleep_time)
Expand All @@ -52,11 +52,11 @@ def main(self, sleep_time: int) -> None:
else:
unchecked_hashes.append(single_hash)

self.logger.info("going to sleep...")
# self.logger.info("going to sleep...")
start_block = end_block + 1


if __name__ == "__main__":
checker = DaemonEBBO()
# sleep time can be set here in seconds
checker.main(600)
checker.main(300)
30 changes: 19 additions & 11 deletions src/off_chain/cow_endpoint_surplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,26 @@ def logging_function(
"""
Logs to terminal (and file iff file_name is passed).
"""

self.logger.error(
"Transaction Hash: %s\nFor order: %s\nWinning Solver: %s\n"
"More surplus Corresponding Solver: %s\nDeviation: %s\n"
"absolute difference: %s\n",
competition_data["transactionHash"],
individual_order_id,
solver,
competition_data["solutions"][first_key]["solver"],
str(format(sorted_values[0][1], ".4f")) + "%",
str(format(sorted_values[0][0], ".5f")) + " ETH",
log_output = (
"Transaction Hash: "
+ competition_data["transactionHash"]
+ "\n"
+ "Order: "
+ individual_order_id
+ "\n"
+ "Winning Solver: "
+ solver
+ "\n"
+ "More surplus Corresponding Solver: "
+ competition_data["solutions"][first_key]["solver"]
+ "\n"
+ "Deviation: "
+ (str(format(sorted_values[0][1], ".4f")) + "%")
+ "\n"
+ "Absolute difference: "
+ (str(format(sorted_values[0][0], ".5f")) + " ETH\n")
)
self.logger.error(log_output)

def statistics_output(self, start_block: int, end_block: int) -> None:
"""
Expand Down

0 comments on commit c1a007a

Please sign in to comment.