Skip to content

Commit

Permalink
Merge pull request #28 from valory-xyz/fix/configure-allowed-chains
Browse files Browse the repository at this point in the history
configure allowed chains
  • Loading branch information
Divya-Solulab authored Nov 4, 2024
2 parents 134cc4d + 30f6c3b commit a7e65d2
Show file tree
Hide file tree
Showing 6 changed files with 923 additions and 826 deletions.
8 changes: 6 additions & 2 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-
64128d4c3415f669a9c656ad9421be2f839f5159:run_service.py:generic-api-key:391
64128d4c3415f669a9c656ad9421be2f839f5159:run_service.py:generic-api-key:392
fcdfd32ce4e7a716fe6ee3d5f15fa152abec28d3:staking_report.py:generic-api-key:153
4637db8956d3ffa836ab0ca8fe1ce87d0141ab64:staking_report.py:generic-api-key:154d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:494
d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:495
4637db8956d3ffa836ab0ca8fe1ce87d0141ab64:staking_report.py:generic-api-key:154d7c0000fb9f7acbb90ec023d0e18d4a8844c8f81:run_service.py:generic-api-key:494
d7c0000fb9f7acbb90ec023d0e18d4a8844c8f81:run_service.py:generic-api-key:495
d7c0000fb9f7acbb90ec023d0e18d4a8844c8f81:run_service.py:generic-api-key:494
71254cf813cf1bd92e1a77887b1c999662c6951a:run_service.py:generic-api-key:502
71254cf813cf1bd92e1a77887b1c999662c6951a:run_service.py:generic-api-key:503
d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:494
d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:495
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,6 @@ git pull origin

Then continue above with "Run the script".

## What's New

### Release v0.2.8
New report script added `suggest_funding_report.py`.
For every chain it reports to the user
- Balance in ETH
- the gas cost, gas price per transaction (avg over last 10 transactions)
- Forecast of gas consumption cost for next 10 transactions in ETH
- Potentially a call to action to fund the agent

### Release v0.2.7

Introduces a minimum swap amount threshold (traded assets limit) configurable via script. It dynamically adjusts the initial ETH and USDC funding requirements based on this limit.

### Release v0.2.6
Token swap and bridging process is improved so that if an issue arises, the agent automatically switches to an alternative route without re-starting the bridging process. It ensures costs, such as gas fees, remain within set limits.

### Release v0.2.5
Optimus agent only proceeds with a bridge or swap transaction when both the relayer fee and gas costs are kept within reasonable limits, helping to control transaction costs.

## Advice for Windows users on installing Windows Subsystem for Linux version 2 (WSL2)

Expand Down
6 changes: 6 additions & 0 deletions report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
get_service_template,
CHAIN_ID_TO_METADATA,
OPERATE_HOME,
DEFAULT_START_CHAIN
)

from utils import (
Expand Down Expand Up @@ -66,6 +67,7 @@ def generate_report():
if not validate_config(config):
return

optimus_config = get_local_config()
# Service Report Header
print("")
print("==============")
Expand All @@ -92,6 +94,8 @@ def generate_report():

for chain_id, chain_config in config.get("chain_configs", {}).items():
chain_name = get_chain_name(chain_id, CHAIN_ID_TO_METADATA)
if optimus_config.allowed_chains and chain_name.lower() not in optimus_config.allowed_chains and chain_name != DEFAULT_START_CHAIN:
continue
balance_info = wallet_info.get('main_wallet_balances', {}).get(chain_name, {})
balance_formatted = balance_info.get('balance_formatted', 'N/A')
_print_status(f"{chain_name} Balance", balance_formatted)
Expand All @@ -114,6 +118,8 @@ def generate_report():
safe_balances = wallet_info.get('safe_balances', {})
for chain_id, chain_config in config.get("chain_configs", {}).items():
chain_name = get_chain_name(chain_id, CHAIN_ID_TO_METADATA)
if optimus_config.allowed_chains and chain_name.lower() not in optimus_config.allowed_chains and chain_name != DEFAULT_START_CHAIN:
continue
safe_info = safe_balances.get(chain_name, {})
_print_status(f"Address ({chain_name})", safe_info.get('address', 'N/A'))
_print_status(f"{safe_info.get('token', 'ETH')} Balance", safe_info.get('balance_formatted', 'N/A'))
Expand Down
Loading

0 comments on commit a7e65d2

Please sign in to comment.