Skip to content

feat: implement milestone-based release schedules in escrow contract #33

Description

@Cjay-Cyber-2

Description — what to implement and the why/impact.

Implement milestone-based release schedules in the escrow contract (contracts/escrow). Currently, escrows typically release funds based strictly on time-locks. Adding milestone-based tracking allows funds to be released incrementally as specific project phases or deliverables are verified and approved on-chain by authorized reviewers.

Context & Requirements — background, constraints, design references, edge cases;

  • Grounded in contracts/escrow using soroban-sdk.
  • Must allow defining an array or ordered list of milestones, each with a specific fraction or amount of the escrowed funds and a status (Pending, Completed, Disputed).
  • Must allow authorized reviewers to mark milestones as completed and trigger partial payouts.
  • Must handle edge cases such as partial withdrawals and cancellation of remaining unreleased funds.

Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".

  • Define milestone data structures and storage keys in contracts/escrow.
  • Implement functions to initialize milestone schedules, approve individual milestones, and release corresponding funds.
  • Emit deterministic error codes for unauthorized milestone approvals or invalid milestone states (INVALID_MILESTONE, MILESTONE_ALREADY_COMPLETED).
  • Add comprehensive unit tests covering multi-milestone creation, sequential completion, and partial fund release.

Implementation Guidance — likely files/modules to touch and a suggested approach

  • Likely files: contracts/escrow/src/lib.rs, contracts/escrow/src/storage.rs, and associated tests.
  • Approach: Store milestones in a vector or indexed map in persistent storage. Ensure checked arithmetic is used when calculating payout amounts per milestone to prevent rounding errors or fund leakage.

Testing & Validation — how the contributor should prove it works

  • Run cargo test --package astroid-escrow to verify all escrow and milestone test cases.
  • Build the optimized WASM via stellar contract build to ensure compilation succeeds.

Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.


Wave complexity: Medium

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions