Skip to content

fix: catch accounts without balance to track balance after cutoff #801

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

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ def upgrade() -> None:
"""
)

op.execute(
"""
INSERT INTO balances(address, chain, balance, eth_height)
SELECT distinct m.sender, 'ETH', 0, 22196000 FROM messages m
INNER JOIN message_status ms ON m.item_hash = ms.item_hash
LEFT JOIN balances b ON m.sender = b.address
WHERE m."type" = 'STORE' AND ms.status = 'processed' AND b.address is null AND m."time" > '2025-04-04T0:0:0.000Z'
"""
)

pass


Expand All @@ -46,4 +56,10 @@ def downgrade() -> None:

op.drop_table("cron_jobs")

op.execute(
"""
DELETE FROM balances b WHERE b.eth_height = 22196000
"""
)

pass
Loading