Skip to content

feat: memo field support for donations#78

Merged
ayshadogo merged 1 commit into
Dfunder:mainfrom
Tinna23:feat/memo-field-donations
Jun 22, 2026
Merged

feat: memo field support for donations#78
ayshadogo merged 1 commit into
Dfunder:mainfrom
Tinna23:feat/memo-field-donations

Conversation

@Tinna23

@Tinna23 Tinna23 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements memo field support for donations as specified in #72.

Changes

Soroban contract (contracts/donation/src/lib.rs):

  • Donation tuple extended from 4 to 5 elements: (Address, u64, i128, u64, Option<Bytes>)
  • donate() accepts optional memo: Option<Bytes> and validates it is ≤ 28 bytes (Stellar protocol limit)
  • get_donations_for_campaign and get_donor_history return the full tuple including memo
  • Fixed pre-existing bugs: symbol_short! overflow for 12-char symbol, duplicate vec![]\ arg in invoke_contract`, broken mock contract brace

SDK (sdk/src/transaction_builder.rs):

  • build_donate_transaction accepts memo: Option<&str>, validates ≤ 28 bytes
  • build_donate_operation passes memo as 4th ScVal arg to the contract invoke

Database (src/db/donations_repo.rs):

  • Schema: nullable memo TEXT column added
  • NewDonation / Donation structs include memo: Option<String>
  • save_donation stores and returns memo

Tests

  • test_donate_with_memo — memo stored and returned in donation history ✅
  • test_donate_memo_max_length — exactly 28 bytes succeeds ✅
  • saves_donation_with_memo — DB stores and returns memo ✅
  • All 70 tests pass (cargo test -p donation-contract -p contract-fox)

Closes #72

- Extend Donation tuple to 5 elements with Option<Bytes> memo
- donate() validates memo ≤ 28 bytes (Stellar protocol limit)
- get_donations_for_campaign / get_donor_history return memo in output
- SDK: build_donate_transaction / build_donate_operation accept optional memo
- DB: add nullable memo column, update NewDonation/Donation structs and save_donation
- Tests: fix pre-existing test bugs, add test_donate_with_memo and test_donate_memo_max_length
@Tinna23 Tinna23 force-pushed the feat/memo-field-donations branch from b4ccdaf to 1fb1b83 Compare June 21, 2026 18:06

@ayshadogo ayshadogo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for your contribution 🤝

@ayshadogo ayshadogo merged commit bc0cdca into Dfunder:main Jun 22, 2026
2 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 22, 2026
4 tasks
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.

Memo Field Support for Donations

2 participants