Skip to content

Refactor: deduplicate is_settleable into single implementation#546

Merged
mikewheeleer merged 1 commit into
Liquifact:mainfrom
aizyohiy-hash:refactor/dedup-is-settleable
Jun 28, 2026
Merged

Refactor: deduplicate is_settleable into single implementation#546
mikewheeleer merged 1 commit into
Liquifact:mainfrom
aizyohiy-hash:refactor/dedup-is-settleable

Conversation

@aizyohiy-hash

Copy link
Copy Markdown
Contributor

Closes #458

Summary

This PR refactors the escrow contract to ensure that the settlement predicate logic is consolidated into a single, authoritative implementation backed by a private helper, keeping the codebase MVP-ready, easy to review, and safe for audit.

Changes Made

  • Canonical Helper: Extracted the settlement predicate logic into a single private helper: fn settleable_now(env: &Env) -> bool.
  • Single Public View: The public pub fn is_settleable(env: Env) -> bool now solely delegates to the private helper.
  • Removed Duplicates: Verified that no duplicate implementations or logic remain in the codebase.
  • Test Coverage: Added focused, state-matrix tests to contracts/escrow/src/tests/settlement.rs to verify that is_settleable accurately reflects funded state, maturity, and legal holds.
  • Documentation: Added concise Rust doc comments explaining the settlement requirements.

Security & Behavior Invariants

  • No ABI/Export Changes: The observable behavior, function signature, visibility, and exported WASM symbol remain exactly the same.
  • Gates Unchanged: The maturity, funded, and legal-hold gates are strictly enforced without any relaxation, reordering, or caching.
  • Storage Layout: No changes were made to the storage layout.

Verification

  • Code strictly follows the formatting guidelines.
  • cargo build completes successfully.
  • cargo test passes all tests, including the new settlement coverage.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@aizyohiy-hash 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

@mikewheeleer

Copy link
Copy Markdown
Contributor

nice work — merging this 🙌

@mikewheeleer mikewheeleer merged commit b264b72 into Liquifact:main Jun 28, 2026
1 check failed
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.

Deduplicate the four divergent is_settleable implementations into a single source of truth

2 participants