Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update report to show operator wallet balances #31

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ d7c0000fb9f7acbb90ec023d0e18d4a8844c8f81:run_service.py:generic-api-key:494
71254cf813cf1bd92e1a77887b1c999662c6951a:run_service.py:generic-api-key:503
d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:494
d70796577da75bbc564039071e8e61f0d684a6e2:run_service.py:generic-api-key:495
66fb9cef2ecb21d06930234596f56f4a01104c42:run_service.py:generic-api-key:322
66fb9cef2ecb21d06930234596f56f4a01104c42:run_service.py:generic-api-key:340
66fb9cef2ecb21d06930234596f56f4a01104c42:run_service.py:generic-api-key:529
66fb9cef2ecb21d06930234596f56f4a01104c42:run_service.py:generic-api-key:530
2 changes: 1 addition & 1 deletion report.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def generate_report():
# Owner/Operator Section
_print_subsection_header("Owner/Operator")
_print_status("Address", operator_address)
for chain_name, balance_info in wallet_info.get('main_wallet_balances', {}).items():
for chain_name, balance_info in wallet_info.get('operator_balances', {}).items():
_print_status(f"{chain_name} Balance", balance_info.get('balance_formatted', 'N/A'))

except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def load_operator_address(operate_home):
try:
with open(ethereum_json_path, "r") as f:
ethereum_data = json.load(f)
operator_address = ethereum_data.get("safes", {}).get("4")
operator_address = ethereum_data.get("address")
if not operator_address:
print("Error: Operator address not found for chain ID 4 in the wallet file.")
print("Error: Operator address not found in the wallet file.")
return None
return operator_address
except FileNotFoundError:
Expand Down
11 changes: 11 additions & 0 deletions wallet_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ def save_wallet_info():
return

main_wallet_address = config.get('keys', [{}])[0].get('address')
operator_wallet_address = load_operator_address(OPERATE_HOME)

if not main_wallet_address:
print("Error: Main wallet address not found in configuration.")
return

main_balances = {}
safe_balances = {}
operator_balances = {}

for chain_id, chain_config in config.get('chain_configs', {}).items():
chain_name = get_chain_name(chain_id, CHAIN_ID_TO_METADATA)
Expand All @@ -118,11 +121,17 @@ def save_wallet_info():

# Get main wallet balance
main_balance = get_balance(web3, main_wallet_address)
operator_balance = get_balance(web3, operator_wallet_address)
main_balances[chain_name] = {
"token": "ETH",
"balance": main_balance,
"balance_formatted": f"{main_balance:.6f} ETH"
}
operator_balances[chain_name] = {
"token": "ETH",
"balance": operator_balance,
"balance_formatted": f"{operator_balance:.6f} ETH"
}

# Get Safe balance
safe_address = chain_config.get('chain_data', {}).get('multisig')
Expand Down Expand Up @@ -150,7 +159,9 @@ def save_wallet_info():

wallet_info = {
"main_wallet_address": main_wallet_address,
"operator_wallet_address": operator_wallet_address,
"main_wallet_balances": main_balances,
"operator_balances": operator_balances,
"safe_addresses": {
chain_id: chain_config.get('chain_data', {}).get('multisig', 'N/A')
for chain_id, chain_config in config.get('chain_configs', {}).items()
Expand Down
Loading