Skip to content

feat: add get_pending_admin view to settlement#387

Open
Vvictor-commits wants to merge 1 commit into
CalloraOrg:mainfrom
Vvictor-commits:feature/settlement-pending-admin-view
Open

feat: add get_pending_admin view to settlement#387
Vvictor-commits wants to merge 1 commit into
CalloraOrg:mainfrom
Vvictor-commits:feature/settlement-pending-admin-view

Conversation

@Vvictor-commits
Copy link
Copy Markdown
Contributor

@Vvictor-commits Vvictor-commits commented May 28, 2026

Closes #340


Problem

CalloraSettlement stores StorageKey::PendingAdmin during the two-step admin transfer but exposes no way to read it. Integrators have no way to detect an in-flight handover without watching events.

Changes

contracts/settlement/src/lib.rs

  • Add get_pending_admin(env) -> Option<Address>: reads StorageKey::PendingAdmin from instance storage, returns Some when a transfer is pending, None otherwise. No auth required — read-only view.

contracts/settlement/src/test.rs

  • test_get_pending_admin_none_before_nomination — returns None when nothing is pending
  • test_get_pending_admin_some_after_nomination — returns Some(new_admin) after set_admin, then None again after accept_admin completes
  • Existing test_accept_admin_fails_if_not_nominated already covers the accept-without-pending panic path ("no admin transfer pending")

docs/interfaces/settlement.json

  • Add get_pending_admin entry: returns Address | null, no panics, no auth

No logic changes

Only additive — new view function and tests.

Exposes the pending admin slot so integrators can detect an
in-flight two-step admin handover without watching events.

- Add get_pending_admin(env) -> Option<Address>: returns Some when
  set_admin has been called and accept_admin has not yet completed,
  None otherwise
- Add test_get_pending_admin_none_before_nomination: asserts None
  when no transfer is in progress
- Add test_get_pending_admin_some_after_nomination: asserts Some
  after set_admin, then None again after accept_admin
- Existing test_accept_admin_fails_if_not_nominated covers the
  accept-without-pending panic path
- Document get_pending_admin in docs/interfaces/settlement.json
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@Vvictor-commits 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

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.

Settlement: add get_pending_admin view and emit no-op-safe accept path tests

2 participants