Skip to content

Commit

Permalink
fix payouts paid_at not being set
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen committed Jul 22, 2024
1 parent 2b57240 commit b78e822
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion indexer_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,21 @@ async def handle_transfer_payout(
payout = {
"recipient_id": data["project_id"],
"amount": data["amount"],
"paid_at": data.get("paid_at", created_at),
"paid_at": data["paid_at"] or created_at,
"tx_hash": receiptId,
}
await PotPayout.objects.filter(recipient_id=data["project_id"]).aupdate(
**payout
)
# check if all_paid_out is now true
url = f"{settings.FASTNEAR_RPC_URL}/account/{receiver_id}/view/get_config"
response = requests.get(url)
if response.status_code != 200:
logger.error(f"Failed to get config for pot {receiver_id}: {response.text}")
else:
data = response.json()
pot = await Pot.objects.aget(id=receiver_id)
pot.all_paid_out = data["all_paid_out"]
except Exception as e:
logger.error(f"Failed to create payout data, Error: {e}")

Expand Down

0 comments on commit b78e822

Please sign in to comment.