Skip to content

feat: implement milestone vesting and pro-rata refund logic#125

Open
Wilfred007 wants to merge 12 commits into
StellarGrant:mainfrom
Open-Works-Contributions:optimization/storage-packing
Open

feat: implement milestone vesting and pro-rata refund logic#125
Wilfred007 wants to merge 12 commits into
StellarGrant:mainfrom
Open-Works-Contributions:optimization/storage-packing

Conversation

@Wilfred007
Copy link
Copy Markdown
Contributor

Description

This PR implements milestone vesting, fixes pro-rata refund calculations, and adds multi-signature authorization verification in the stellar-grants contract.

Key Changes

  • Milestone Vesting:

    • Added vesting_period: u64 to the Milestone struct.
    • Introduced VestingPending state to safely defer payouts after milestone approval.
    • Added a public vesting_claim(env, grant_id, milestone_idx, recipient) function to allow permissionless fund pulling once the time-lock expires.
    • Refactored finalize_grant_release to distinguish between immediate and deferred payouts.
  • Refined Refund Logic:

    • Updated cancel_grant to distribute refunds pro-rata based on the current remaining escrow balance and the total-ever-contributed amounts of funders.
    • Added a safety mechanism to prevent funds from being "orphaned" in the contract by returning unmatched balances to the grant owner.
  • Multi-Signature Authorization Verification:

    • Added a comprehensive integration test, test_reviewer_multisig_authorization, verifying that the contract's authorization logic correctly handles Stellar multi-sig accounts and contract-based Smart Wallets.

Security and Verification

  • Test Suite Expansion: Added 7+ new integration tests covering vesting security, refund math edge-cases, and complex authorization.
  • Full Test Pass: All 68 contract tests have been verified to pass successfully (cargo test).

Closes #83
Closes #81
Closes #105
Closes #101

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 28, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant