From 1e7a0d14de874b789c45a952fab03806ffa32257 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Wed, 24 Apr 2024 15:50:42 +0200 Subject: [PATCH 1/3] fix: mech events script --- scripts/mech_events.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mech_events.py b/scripts/mech_events.py index c7339b0f..97f4b95d 100644 --- a/scripts/mech_events.py +++ b/scripts/mech_events.py @@ -302,7 +302,7 @@ def get_mech_requests( all_mech_events = _get_mech_events(sender, MechRequest) filtered_mech_events = {} for event_id, event_data in all_mech_events.items(): - block_timestamp = event_data["block_timestamp"] + block_timestamp = int(event_data["block_timestamp"]) if from_timestamp <= block_timestamp <= to_timestamp: filtered_mech_events[event_id] = event_data From 7d6a7154d57cf02a9fddd7f8efabd47d36d9035d Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Wed, 24 Apr 2024 20:18:52 +0200 Subject: [PATCH 2/3] chore: fix variables --- run_service.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/run_service.sh b/run_service.sh index b2906fe5..7009c59e 100755 --- a/run_service.sh +++ b/run_service.sh @@ -604,11 +604,6 @@ export CUSTOM_GNOSIS_SAFE_SAME_ADDRESS_MULTISIG_ADDRESS="0x6e7f594f680f7aBad18b7 export CUSTOM_MULTISEND_ADDRESS="0x40A2aCCbd92BCA938b02010E17A5b8929b49130D" export WXDAI_ADDRESS="0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" export MECH_CONTRACT_ADDRESS="0x77af31De935740567Cf4fF1986D04B2c964A786a" -export MECH_WRAPPED_NATIVE_TOKEN_ADDRESS=$WXDAI_ADDRESS -export DISABLE_TRADING=false -export STOP_TRADING_IF_STAKING_KPI_MET=true -export RESET_PAUSE_DURATION=120 -export MECH_CHAIN_ID=ethereum # check if USE_NEVERMINED is set to true if [ "$USE_NEVERMINED" == "true" ]; @@ -1065,6 +1060,12 @@ export BET_THRESHOLD=100000000000000000 export TRADING_STRATEGY=kelly_criterion export PROMPT_TEMPLATE="Please take over the role of a Data Scientist to evaluate the given question. With the given question \"@{question}\" and the \`yes\` option represented by \`@{yes}\` and the \`no\` option represented by \`@{no}\`, what are the respective probabilities of \`p_yes\` and \`p_no\` occurring?" export IRRELEVANT_TOOLS='["claude-prediction-online","prediction-request-reasoning","prediction-online","prediction-offline","prediction-offline-sme","deepmind-optimization", "deepmind-optimization-strong", "openai-gpt-3.5-turbo", "openai-gpt-3.5-turbo-instruct", "openai-gpt-4", "openai-text-davinci-002", "openai-text-davinci-003", "prediction-online-sum-url-content", "prediction-online-summarized-info", "stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1", "stabilityai-stable-diffusion-v1-5", "stabilityai-stable-diffusion-xl-beta-v2-2-2"]' +export STAKING_CONTRACT_ADDRESS=$CUSTOM_STAKING_ADDRESS +export DISABLE_TRADING=false +export STOP_TRADING_IF_STAKING_KPI_MET=true +export RESET_PAUSE_DURATION=120 +export MECH_WRAPPED_NATIVE_TOKEN_ADDRESS=$WXDAI_ADDRESS +export MECH_CHAIN_ID=ethereum service_dir="trader_service" build_dir="abci_build" From 9524c78f9f2d081b26e4aa20647793096455ae15 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Wed, 24 Apr 2024 20:36:31 +0200 Subject: [PATCH 3/3] fix: display warning message --- scripts/mech_events.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/mech_events.py b/scripts/mech_events.py index 97f4b95d..cbfac2d1 100644 --- a/scripts/mech_events.py +++ b/scripts/mech_events.py @@ -22,6 +22,7 @@ import json import os +import sys import time from dataclasses import dataclass from pathlib import Path @@ -166,6 +167,12 @@ def _read_mech_events_data_from_file() -> Dict[str, Any]: except FileNotFoundError: mech_events_data = {} mech_events_data["db_version"] = MECH_EVENTS_DB_VERSION + except json.decoder.JSONDecodeError: + print( + f'\nERROR: The local Mech events database "{MECH_EVENTS_JSON_PATH.resolve()}" is corrupted. Please try delete or rename the file, and run the script again.' + ) + sys.exit(1) + return mech_events_data