Skip to content

chore(contracts): emit event on donation received#266

Merged
Kaylahray merged 5 commits intogeevapp:mainfrom
augusthottie:chore/event-donation
Mar 30, 2026
Merged

chore(contracts): emit event on donation received#266
Kaylahray merged 5 commits intogeevapp:mainfrom
augusthottie:chore/event-donation

Conversation

@augusthottie
Copy link
Copy Markdown
Contributor

Summary

Standardizes the DonationReceived contract event so clients can subscribe to a stable topic layout and read this donation amount plus updated total raised for real-time UI (e.g. progress bar) without polling.

Closes #214

What changed

File: contracts/geev-core/src/mutual_aid.rs

  • DonationReceived now uses:
    • Topics: aid, donate, request_id (#[contractevent(topics = ["aid", "donate"])] + #[topic] request_id).
    • Data (data_format = "vec"): [donor, amount_donated, new_total_raised].
      • amount_donated: amount for this donate call.
      • new_total_raised: HelpRequest.raised_amount after applying this donation (matches on-chain state).
  • Event is still published at the end of donate(), after transfers and storage updates.

Tests & snapshots

  • test_donation_emits_contributor_tracking_event updated to assert the new topic triple.
  • test_donation_emits_contributor_tracking_event.1.json snapshot updated for the new event encoding.

Breaking change

Subscribers that matched the legacy event (single donation_received topic + map-shaped data) must update to aid / donate / <request_id> and parse the vec body.

Branch: chore/event-donation

Topics: aid, donate, request_id. Data vec: donor, amount_donated,
new_total_raised. Update test and ledger snapshot.

Made-with: Cursor
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@augusthottie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

vec! inferred Symbol for all elements, breaking request_id.into_val under
newer SDK (E0277). Convert aid/donate symbols with .into_val(&env).

Made-with: Cursor
Copy link
Copy Markdown
Contributor

@3m1n3nc3 3m1n3nc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve conflicts and fix failing CI

@augusthottie
Copy link
Copy Markdown
Contributor Author

Please resolve conflicts and fix failing CI

fixed

@Kaylahray Kaylahray self-requested a review March 29, 2026 03:06
@Kaylahray Kaylahray removed their request for review March 30, 2026 01:58
@Kaylahray Kaylahray merged commit 29a8e6a into geevapp:main Mar 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit Event - DonationReceived

3 participants