Skip to content

feat(crowdfund): add affiliate system with comprehensive tests#401

Closed
davidugorji wants to merge 2 commits into
ShadeProtocol:mainfrom
davidugorji:feat/351-affiliate-system-tests
Closed

feat(crowdfund): add affiliate system with comprehensive tests#401
davidugorji wants to merge 2 commits into
ShadeProtocol:mainfrom
davidugorji:feat/351-affiliate-system-tests

Conversation

@davidugorji

Copy link
Copy Markdown

Adds a per-campaign affiliate system to crowdfund: organizer-managed affiliate registration, commission rate config, commission accrual on referred pledges, and commission claiming.

What's added

  • set_affiliate_commission_bps, register_affiliate, is_affiliate (organizer-only management)
  • contribute_with_affiliate (referred pledge, accrues commission), affiliate_balance
  • claim_affiliate_commission
  • 3 new events: affiliate registered, commission accrued, commission claimed
  • Tests in contracts/crowdfund/src/tests/test_feature_214.rs covering commission config validation, registration (incl. unauthorized/duplicate/rollback-on-panic), contribution happy path with exact event-argument assertions, unregistered-affiliate rejection with rollback verification, multi-contributor accrual, rounding-to-zero edge case, and claim lifecycle (incl. double-claim rollback).

Note: pushing a follow-up commit shortly to fix a build issue (two new contractevent struct names exceeded the 32-char Symbol limit) and finish full test verification.

Closes #351

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@davidugorji 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

…ests

Soroban testutils events().all() is scoped to the most recent contract
invocation; an extra read call between the event-emitting call and the
assertion cleared the events buffer, causing events.len()-1 to overflow.

Closes ShadeProtocol#351
@davidugorji

Copy link
Copy Markdown
Author

Superseded by combined PR #403 (merges this with #358, #366, #359, #351). Closing in favor of that.

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.

Create Comprehensive Tests for Affiliate System

1 participant