Skip to content

Feat/get plan query implementation#900

Open
chuks68 wants to merge 2 commits into
Fracverse:masterfrom
chuks68:feat/get-plan-query-implementation
Open

Feat/get plan query implementation#900
chuks68 wants to merge 2 commits into
Fracverse:masterfrom
chuks68:feat/get-plan-query-implementation

Conversation

@chuks68

@chuks68 chuks68 commented Jun 29, 2026

Copy link
Copy Markdown

this pr closes #835 This PR implements the read-only query entrypoint get_plan on InheritanceContract.

Changes

  1. New Response Struct: Introduced PlanInfo to wrap the Plan details along with the dynamically calculated remaining_time (until the grace period expires).
  2. Implement get_plan:
    • Reads the plan data structure from persistent storage.
    • Bumps the temporary TTL of the storage entry if queried using extend_ttl.
    • Returns a PlanInfo struct or Error::PlanNotFound if no plan exists.
    • Runs in read-only mode (#[contractquery]), ensuring no ledger state modifications.
  3. Tests: Updated contract tests to handle the new PlanInfo structure returned by get_plan.

Verification Results

Acceptance Criteria Checklist

  • Does not modify ledger state (uses #[contractquery]).
  • Returns clear errors (Error::PlanNotFound) if the plan is not found.
  • Bumps temporary TTL if queried.
  • Returns plan details (via Plan struct inside PlanInfo) and dynamically computed remaining_time.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

@chuks68
Run cargo fmt --all -- --check
Diff in /home/runner/work/InheritX/InheritX/contracts/inheritance-contract/src/lib.rs:280:
0u64
};

  •    let response = PlanInfo { plan, remaining_time };
    
  •    let response = PlanInfo {
    
  •        plan,
    
  •        remaining_time,
    
  •    };
       Ok(response)
    
    }

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 get_plan Query Interface

2 participants