Skip to content

feat: implement bounty milestone approval#133

Open
zainabb-dev wants to merge 1 commit intoGalactiGuild:mainfrom
zainabb-dev:feature/contract-approve
Open

feat: implement bounty milestone approval#133
zainabb-dev wants to merge 1 commit intoGalactiGuild:mainfrom
zainabb-dev:feature/contract-approve

Conversation

@zainabb-dev
Copy link

Overview

This PR implements the missing approve_bounty escrow interface for the Stellar Guilds contract. Fully funded bounties now enter a Funded state first, and an admin must explicitly approve a specific address before that address can claim the bounty. This replaces the old immediate first-come-first-served claim behavior for funded bounties.

Related Issue

Closes #109

Changes

⚙️ Bounty Approval Flow

  • [MODIFY] contract/src/bounty/mod.rs

    • Added approve_bounty(env, bounty_id, approver, claimer) for admin-controlled bounty approval.
    • Enforced that a bounty must be in Funded state before approval.
    • Updated claim_bounty so only the approved address can claim after admin approval.
    • Changed fully funded bounties to transition into Funded instead of becoming immediately claimable.
  • [MODIFY] contract/src/bounty/types.rs

    • Added the Funded bounty lifecycle state.
    • Extended BountyApprovedEvent to include the approved claimer address.

🧩 Contract Interface

  • [MODIFY] contract/src/lib.rs
    • Exposed the new public approve_bounty contract method.
    • Updated bounty interface documentation to reflect the approval-before-claim flow.

✅ Test Coverage

  • [MODIFY] contract/src/bounty/tests.rs

    • Added tests for successful admin approval.
    • Added tests to verify approval fails outside Funded state.
    • Added tests to verify claiming requires prior approval.
    • Added tests to verify only the approved address can claim.
    • Updated lifecycle, cancellation, escrow, and admin tests to match the new funded → approved → claimed flow.
  • [MODIFY] contract/test_snapshots/...

    • Refreshed Soroban test snapshots impacted by the new bounty lifecycle and events.

Verification Results

Acceptance Criteria Status
Admin can approve a bounty only when it is funded
Approved claimer is the only address allowed to claim
Existing bounty escrow lifecycle still works after approval step
Targeted bounty contract tests pass

How to Test

# 1. Confirm you're on the branch
git branch --show-current

# 2. Run the targeted bounty contract tests
cargo test bounty --manifest-path contract/Cargo.toml

# 3. Optional: inspect the changed files
git diff -- contract/src/lib.rs contract/src/bounty/mod.rs contract/src/bounty/types.rs contract/src/bounty/tests.rs

Screenshots

✅ Bounty contract tests pass

a screenshot of:

cargo test bounty --manifest-path contract/Cargo.toml
image

@drips-wave
Copy link

drips-wave bot commented Mar 23, 2026

@zainabb-dev 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

@gabito1451
Copy link
Contributor

please resolve conflicts , ensure your branch is also up to date and push again. nice implementation. thank you

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.

Draft approve_bounty escrow interface

3 participants