diff --git a/report.py b/report.py index 0ef2ac74..7c6e4419 100644 --- a/report.py +++ b/report.py @@ -77,6 +77,17 @@ "contracts", "ServiceRegistryTokenUtility.json", ) +MECH_CONTRACT_ADDRESS = "0x77af31De935740567Cf4fF1986D04B2c964A786a" +MECH_CONTRACT_JSON_PATH = Path( + SCRIPT_PATH, + "trader", + "packages", + "valory", + "contracts", + "mech", + "build", + "mech.json", +) SAFE_BALANCE_THRESHOLD = 500000000000000000 AGENT_XDAI_BALANCE_THRESHOLD = 50000000000000000 @@ -277,6 +288,15 @@ def _parse_args() -> Any: abi=service_registry_token_utility_abi, ) + with open(MECH_CONTRACT_JSON_PATH, "r", encoding="utf-8") as file: + mech_contract_data = json.load(file) + + mech_contract_abi = mech_contract_data.get("abi", []) + + mech_contract = w3.eth.contract( + address=MECH_CONTRACT_ADDRESS, abi=mech_contract_abi + ) + security_deposit = ( service_registry_token_utility_contract.functions.getOperatorBalance( operator_address, service_id @@ -320,9 +340,16 @@ def _parse_args() -> Any: service_staking_token_contract.functions.livenessPeriod().call() ) last_checkpoint_ts = next_checkpoint_ts - liveness_period - mech_requests_current_epoch = _get_mech_requests_count( - mech_requests, last_checkpoint_ts - ) + + mech_request_count = mech_contract.functions.getRequestsCount(safe_address).call() + mech_request_count_on_last_checkpoint = ( + service_staking_token_contract.functions.getServiceInfo(service_id).call() + )[2][1] + mech_requests_since_last_cp = mech_request_count - mech_request_count_on_last_checkpoint + # mech_requests_current_epoch = _get_mech_requests_count( + # mech_requests, last_checkpoint_ts + # ) + mech_requests_current_epoch = mech_requests_since_last_cp _print_status( "Num. Mech txs current epoch", f"{mech_requests_current_epoch} {_warning_message(mech_requests_current_epoch, mech_requests_24h_threshold, f'- Too low. Threshold is {mech_requests_24h_threshold}.')}", diff --git a/run_service.sh b/run_service.sh index 0a6e93af..be8418e7 100755 --- a/run_service.sh +++ b/run_service.sh @@ -581,7 +581,7 @@ directory="trader" service_repo=https://github.com/$org_name/$directory.git # This is a tested version that works well. # Feel free to replace this with a different version of the repo, but be careful as there might be breaking changes -service_version="v0.13.1" +service_version="v0.13.2" # Define constants for on-chain interaction gnosis_chain_id=100 @@ -602,8 +602,12 @@ export CUSTOM_SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESS="0xa45E64d13A30a51b91ae0eb1 export CUSTOM_GNOSIS_SAFE_PROXY_FACTORY_ADDRESS="0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE" export CUSTOM_GNOSIS_SAFE_SAME_ADDRESS_MULTISIG_ADDRESS="0x6e7f594f680f7aBad18b7a63de50F0FeE47dfD06" export CUSTOM_MULTISEND_ADDRESS="0x40A2aCCbd92BCA938b02010E17A5b8929b49130D" -export MECH_CONTRACT_ADDRESS="0x77af31De935740567Cf4fF1986D04B2c964A786a" 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=300 # check if USE_NEVERMINED is set to true if [ "$USE_NEVERMINED" == "true" ]; @@ -611,7 +615,7 @@ then echo "A Nevermined subscription will be used to pay for the mech requests." export MECH_CONTRACT_ADDRESS="0x327E26bDF1CfEa50BFAe35643B23D5268E41F7F9" export AGENT_REGISTRY_ADDRESS="0xAed729d4f4b895d8ca84ba022675bB0C44d2cD52" - export REQUEST_PRICE=0 + export MECH_REQUEST_PRICE=0 fi sleep_duration=12