Skip to content

feat: implement two-step admin transfer in loyalty_token#290

Merged
Leothosine merged 1 commit into
tosirano:mainfrom
mftee:feat/two-step-admin-transfer
Jun 24, 2026
Merged

feat: implement two-step admin transfer in loyalty_token#290
Leothosine merged 1 commit into
tosirano:mainfrom
mftee:feat/two-step-admin-transfer

Conversation

@mftee

@mftee mftee commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements a two-step admin transfer in loyalty_token to prevent irreversible lockout from a typo in the new admin address.

Changes

  • DataKey: Added PendingAdmin variant
  • transfer_admin: Now only sets DataKey::PendingAdmin and emits (admin, proposed) — does NOT change the active admin
  • accept_admin: New function — caller must equal PendingAdmin, promotes to Admin, clears PendingAdmin, emits (admin, accepted)
  • cancel_transfer: New function — current admin can cancel a pending transfer, clears PendingAdmin

Tests

  • transfer_admin alone does not change the active admin
  • Happy path: propose -> accept -> old admin can no longer mint
  • accept_admin from wrong address panics with "not pending admin"
  • Cancel path: propose -> cancel -> PendingAdmin cleared, old admin still active
  • accept_admin after cancel panics

Closes #280

@Leothosine Leothosine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution

@Leothosine Leothosine merged commit 4b8cdb2 into tosirano:main Jun 24, 2026
2 of 3 checks passed
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.

[CO-02] Implement two-step admin transfer in loyalty_token to prevent irreversible lockout

2 participants