feat: memo field support for donations#78
Merged
Conversation
- 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
b4ccdaf to
1fb1b83
Compare
ayshadogo
approved these changes
Jun 22, 2026
ayshadogo
left a comment
Contributor
There was a problem hiding this comment.
Thank you for your contribution 🤝
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements memo field support for donations as specified in #72.
Changes
Soroban contract (
contracts/donation/src/lib.rs):Donationtuple extended from 4 to 5 elements:(Address, u64, i128, u64, Option<Bytes>)donate()accepts optionalmemo: Option<Bytes>and validates it is ≤ 28 bytes (Stellar protocol limit)get_donations_for_campaignandget_donor_historyreturn the full tuple including memosymbol_short!overflow for 12-char symbol, duplicatevec![]\ arg ininvoke_contract`, broken mock contract braceSDK (
sdk/src/transaction_builder.rs):build_donate_transactionacceptsmemo: Option<&str>, validates ≤ 28 bytesbuild_donate_operationpasses memo as 4thScValarg to the contract invokeDatabase (
src/db/donations_repo.rs):memo TEXTcolumn addedNewDonation/Donationstructs includememo: Option<String>save_donationstores and returns memoTests
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 ✅cargo test -p donation-contract -p contract-fox)Closes #72