Skip to content

feat: end_campaign and permissionless update_status with auto-transition on expiry - #57

Merged
ayshadogo merged 2 commits into
Dfunder:mainfrom
A6dulmalik:feat/35-end-campaign-auto-ending
Aug 22, 2026
Merged

feat: end_campaign and permissionless update_status with auto-transition on expiry#57
ayshadogo merged 2 commits into
Dfunder:mainfrom
A6dulmalik:feat/35-end-campaign-auto-ending

Conversation

@A6dulmalik

Copy link
Copy Markdown
Contributor

Summary

Implements #35 (stacked on #55 - contains that commit since upstream main's tests currently do not compile):

  • end_campaign(): creator-only early termination. Requires creator auth, rejects when frozen or when status is not Active/GoalReached, sets status to Ended, emits campaign_ended. Does NOT touch the stored campaign end time (ending is not a failure mode, so no refund window starts) and does not block the final milestone release (release_milestone validates milestone state, not campaign status).
  • update_status(): permissionless transition of an expired-but-still-Active campaign to Ended, emitting campaign_ended. Anyone may call it: deadline enforcement must not depend on creator cooperation, otherwise a passive creator could keep a dead campaign nominally Active and block downstream flows keyed off status. Idempotent no-op when not expired or already ended.
  • donate() now triggers the same Active -> Ended transition (with event) when a donation arrives after the deadline, so the status can never remain Active past expiry.
  • Test fixes carried in this diff: added missing soroban_sdk::testutils::Ledger / IntoVal trait imports to test.rs - without these the test target fails to compile with 9 pre-existing E0599 errors (present on main and on the feat: campaign lifecycle controls (cancel, extend deadline, status) #55 branch).
  • New tests: creator ends campaign + double-end rejected; expired campaign stays Active until a random account calls update_status; idempotent re-call; update_status before deadline is a no-op; post-deadline donation rejects with CampaignEnded and flips status to Ended.

Tests

Windows cannot execute Soroban host tests (environmental fail-fast), validated with:

  • cargo +1.85.0 clippy -p campaign --features testutils --all-targets: compiles clean (0 errors; baseline branch had 9)
  • cargo +1.85.0 fmt --check: clean

Closes #35

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

LGTM

@ayshadogo
ayshadogo merged commit 4f5a5d6 into Dfunder:main Aug 22, 2026
0 of 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.

end_campaign and automatic deadline-based ending

2 participants