Skip to content

Add an extend-only entrypoint to lengthen the funding deadline while the escrow is open #551

Description

@mikewheeleer

Add an extend-only entrypoint to lengthen the funding deadline while the escrow is open

Description

The escrow exposes get_funding_deadline and is_funding_expired, and an under-funded escrow becomes cancellable once the deadline lapses. However, there is no admin path to push the deadline out when an SME needs more time to attract investors — the only options today are to let it expire or cancel and re-deploy. This forces a destructive teardown for what should be a routine schedule adjustment.

This issue adds an extend_funding_deadline(new_deadline) admin entrypoint that may only move the deadline forward (never shorten it), is gated to the open funding window, and emits a structured event so integrators can re-sync their off-chain timers.

Requirements and context

  • Repository scope: Liquifact/Liquifact-contracts only.
  • Add extend_funding_deadline(new_deadline: u64) gated by admin require_auth via the existing admin loader, callable only while the escrow status is open (not funded, settled, or cancelled).
  • Reject any new_deadline that is less than or equal to the current stored deadline with a new typed EscrowError variant (e.g. FundingDeadlineNotExtended), keeping error codes append-only.
  • Respect the maturity bound: reject a new_deadline at or beyond the maturity timestamp so the funding window cannot swallow settlement.
  • Emit a structured event carrying invoice_id, the old deadline, and the new deadline.
  • Bump the persistent/instance TTL for any touched entry.

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feature/contracts-extend-funding-deadline
  • Implement changes
    • Write code in: escrow/src/lib.rsextend_funding_deadline, the new typed error, and the deadline-extended event struct.
    • Write comprehensive tests in: escrow/src/tests/funding.rs — assert forward-only moves, rejection of equal/earlier deadlines, the maturity-bound guard, the status gate, admin auth, and the emitted event payload.
    • Add documentation: update README.md and the funding-lifecycle docs to describe deadline extension and its bounds.
    • Include NatSpec-style doc comments (///) on the new entrypoint, matching the existing style in lib.rs.
    • Validate security assumptions: no shortening, no extension past maturity, admin-only, correct status gating.
  • Test and commit

Test and commit

  • Run cargo fmt --all -- --check, cargo build, and cargo test.
  • Cover edge cases and failure paths: equal deadline, earlier deadline, deadline past maturity, non-admin caller, funded/settled/cancelled status.
  • Include the full cargo test output and a short security notes section in the PR description.

Example commit message

feat: add extend-only funding deadline entrypoint with bounds, event, tests and docs

Guidelines

  • Minimum 95 percent test coverage for impacted modules.
  • Clear, reviewer-focused documentation.
  • Timeframe: 96 hours.

Community & contribution rewards

  • 💬 Join the Liquifact community on Discord for questions, reviews, and faster merges: https://discord.gg/JrGPH4V3
  • ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions