Skip to content

feat(contracts): implement claim timelock and disputes holding window#873

Open
Dopezapha wants to merge 1 commit into
Fracverse:masterfrom
Dopezapha:feat/claim-timelock-disputes
Open

feat(contracts): implement claim timelock and disputes holding window#873
Dopezapha wants to merge 1 commit into
Fracverse:masterfrom
Dopezapha:feat/claim-timelock-disputes

Conversation

@Dopezapha

Copy link
Copy Markdown

Closes #841

PR Description

This PR implements a disputes holding window (claim timelock) for the digital inheritance contracts.

When a payout is triggered by calling claim, the funds do not leave the contract immediately. Instead, the contract records the claim's timestamp in persistent storage (ClaimStatus) to start the timelock grace window. During this lock period, if the owner is still active or disputes the claim, they can call cancel_claim to reset the inactivity timer and reactivate the plan, or call reclaim to withdraw all vault assets back to their wallet and delete the plan.

After the configured timelock duration expires, trigger_payout can be called (pulled) to execute the asset distribution to beneficiaries.

Changes Made

  • Modified contracts/inheritance-contract/src/lib.rs:
    • Added timelock_duration to the Plan struct and updated create_plan to configure it.
    • Updated claim to store the start of the timelock in persistent storage under ClaimStatus with the current ledger timestamp.
    • Added cancel_claim allowing the owner to delete the claim lock and reactivate the plan.
    • Added reclaim allowing the owner to cancel the lock, delete the plan, and withdraw all vault assets.
    • Modified trigger_payout to verify the timelock has expired before distributing the funds.
    • Added TimelockNotExpired and PayoutNotTriggered error variants.
  • Modified contracts/inheritance-contract/src/test.rs:
    • Updated existing tests to pass the new timelock_duration argument and test sequences.
    • Added test_cancel_claim_success and test_reclaim_success unit tests.

Testing

Run the contract unit tests using Cargo:

cargo test --manifest-path contracts/inheritance-contract/Cargo.toml

Result: All 15 tests passed successfully.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

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

@ONEONUORA

Copy link
Copy Markdown
Contributor

@Dopezapha
Run cargo fmt --all -- --check
and clippy

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.

[Contracts] Implement Claim Timelock and Disputes Grace Window

2 participants