Skip to content

Commit

Permalink
fix computation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill-K-1 committed Jan 9, 2025
1 parent 6eecebf commit dd8e9df
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions compute-rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ def fetch_rewards(token):
# Process the data entries
for entry in data.get("data", []):
rewards_by_wallet = entry.get("rewardsByWallet", {})
batch_status = entry.get("status")

for wallet_data in rewards_by_wallet.values():
# Check for status at the top-level entry if applicable
if "status" in entry:
continue
reward_status = wallet_data.get("status")
reward_amount = hex_to_int(wallet_data["amount"])

status = wallet_data.get("status")

if status == "claimed" or status is None:
total_rewards += hex_to_int(wallet_data["amount"])
if reward_status == "claimed" or (reward_status is None and batch_status is None):
total_rewards += reward_amount
else:
print(f"ignore reward (id: {entry.get("id")}, wallet: {wallet_data.get("wallet")}, amount: {Web3.from_wei(reward_amount, 'ether')}). entry status: {batch_status} reward status: {reward_status}")

# Update start_index for pagination
start_index += len(data.get("data", []))
Expand Down

0 comments on commit dd8e9df

Please sign in to comment.