Skip to content

feat(contracts): add loktin-common crate for storage TTL and ID counters - #45

Open
Peolite001 wants to merge 1 commit into
Lokt-In:stagingfrom
Peolite001:feat/loktin-common
Open

Peolite001 wants to merge 1 commit into
Lokt-In:stagingfrom
Peolite001:feat/loktin-common

Conversation

@Peolite001

Copy link
Copy Markdown

Description

Closes #38

This PR addresses the issue of duplicated TTL constants and inconsistent ID counter behaviors across the contracts by introducing a new loktin-common crate.

Changes Made

  • New Workspace Crate: Created crates/loktin-common.
  • TTL Helpers: Added extend_ttl_instance and extend_ttl_persistent helpers using the existing ledger constants (DAY_IN_LEDGERS * 30 and DAY_IN_LEDGERS * 365).
  • 1-Indexed ID Counter: Implemented a generic next_id helper that guarantees IDs start at 1 and monotonically increase. Added tests verifying this behavior.
  • Deduplication: Removed localized TTL constants from the five contracts (spend_save, target_savings, plans, mock_pool, and locked_in), substituting them with the shared constants imported from the new crate.

Acceptance Criteria Met

  • crates/loktin-common builds as a workspace member.
  • Instance TTL extension helper added and callable.
  • 1-indexed ID counter helper added.
  • Duplicated TTL constants removed from the five contracts in favour of the crate.
  • Tests added covering counter monotonicity and that the first ID issued is 1.

Notes

Adopting the newly added helpers inside each contract's entry points is kept out of scope for this PR, as outlined in the issue requirements.

@drips-wave

drips-wave Bot commented Sep 23, 2026

Copy link
Copy Markdown

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

This branch has not been deployed

No deployments
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.

feat(contracts): add loktin-common crate for storage TTL and ID counters

1 participant