closea #92 feat: add tri-state anchor_status read for anchor lifecycle tracking#220
Open
emmyoat wants to merge 3 commits into
Open
closea #92 feat: add tri-state anchor_status read for anchor lifecycle tracking#220emmyoat wants to merge 3 commits into
emmyoat wants to merge 3 commits into
Conversation
emmyoat
force-pushed
the
feat/anchor-status
branch
from
July 22, 2026 23:52
77004cb to
d7ce5f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
anchor_status(env, anchor) -> AnchorStatusread function to distinguish between addresses that have never been registered, addresses that are currently active, and addresses that were previously registered and later deregistered.is_anchorreturns a single boolean and cannot distinguish between "never registered" and "previously registered then deregistered". This tri-state distinction allows off-chain services (frontend detail page and backend sync logic) to query anchor registration lifecycle status directly from the contract.Key Changes
src/types.rs: AddedAnchorStatusenum with variantsNeverRegistered,Active, andDeregistered.src/storage.rs: Implementedanchor_statusreader that checks persistent storage:NoneAnchorStatus::NeverRegisteredSome(true)AnchorStatus::Active(with TTL bump)Some(false)AnchorStatus::Deregistered(with TTL bump)src/lib.rs: Re-exportedAnchorStatusand exposedAnchornetContract::anchor_status.src/test.rs: Addedtest_anchor_status_lifecycleandtest_anchor_status_read_bumps_ttl.README.md: Updated contract interface table withanchor_status(anchor).Backward Compatibility
is_anchorand all existing contract callers remain completely unaffected.Checklist
is_anchorbehavior and callers unaffected.src/test.rs.README.md.