Repository navigation
feat(escrow): milestone-based release schedules — storage schema, partial-release accounting, tests - #362
Conversation
…leases Move the Milestone, MilestoneSpec and MilestoneSet contract types plus the milestone storage keys into storage.rs alongside the rest of the escrow schema, and add load/store/has helpers so lib.rs no longer reaches into the persistent storage layout directly. Keep the escrow's released_amount in lock-step with the milestone running total so refund/reclaim/cancel can only ever return the still-held remainder, and make cancel disburse just that remainder instead of the original asset list. Add tests for invalid milestone indices, dust-free exact distribution and partial-release accounting. Closes ASTROIDX556#299 Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@Oluwaferanmi18 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! 🚀 |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
1 similar comment
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
CI Checks Failed — Action NeededThe continuous integration checks on this pull request are failing. I can't merge until all required checks pass. Failing checks:
What to do: review the failing checks in the "Checks" tab above, fix the issues in your code, and push the changes. |
Merge Conflict — Action NeededThis pull request has merge conflicts with the base branch ( What to do: update your branch by merging or rebasing against |
…tial-release accounting, tests Implements milestone-based progressive releases in contracts/escrow for ASTROIDX556#299. Moves milestone schema into storage.rs, keeps released_amount in lock-step, fixes cancel to return only held remainder, adds dust-free distribution tests. Closes ASTROIDX556#299
Summary
Implements/rounds out milestone-based progressive releases in
contracts/escrowfor #299, so the arbiter can approve discrete project milestones and disburse a proportional share of the escrowed funds on each approval.The escrow already shipped the beginnings of this flow (
deposit_with_milestones/release_milestone). This PR completes it against the issue's acceptance criteria, moves the milestone schema intostorage.rswhere the rest of the escrow storage lives, and closes two real accounting gaps around partial releases.What changed
contracts/escrow/src/storage.rsMilestone,MilestoneSpecandMilestoneSet#[contracttype]structs next toEscrow/ReleaseSchedule, plus the existingDataKey::Milestones(u64)key.has_milestones,load_milestones,store_milestones(with TTL bump), matching theload_escrow/store_escrowconventions.contracts/escrow/src/lib.rsrelease_milestonenow keepsescrow.released_amountin lock-step with the milestone running total. Previously only the milestone set tracked payouts, so a timed-out escrow could computeremaining = funded_amount - 0and over-refund funds already paid to the recipient.cancelnow returns only the still-held remainder (proportional per asset) instead of the original full asset list, which previously would have over-transferred after a partial milestone approval.contracts/escrow/src/test.rsmilestone_invalid_index_rejected— out-of-range index fails withInvalidInput, no funds move.milestone_dust_free_exact_distribution— weights3333/3333/3334over an amount of1_000pay333 + 333 + 334 = 1_000, leaving the contract at0.milestone_partial_release_tracks_escrow_and_returns_only_remainder_on_cancel— after one of two milestones,released_amount == 4_000, and cancelling returns exactly the6_000still held.contracts/escrow/README.mdAcceptance criteria
contracts/escrow/src/storage.rs.contracts/escrow/src/lib.rs(deposit_with_milestones,release_milestone, plus themilestonesview).InvalidInput).InvalidState).Edge cases & invariants
10_000bps; the final approved milestone pays the exact remainder rather than its floored gross.releasestays blocked on milestone escrows so settlement remains phased.Testing
cargo test --package astroid-escrowCloses #299
🤖 Generated with Codebuff