Skip to content

feat(escrow_contract): implement two-step admin transfer mechanism - #32

Merged
Tybravo merged 1 commit into
SwiftChainn:mainfrom
Ogstevyn:feat/escrow-admin-transfer
Apr 23, 2026
Merged

feat(escrow_contract): implement two-step admin transfer mechanism#32
Tybravo merged 1 commit into
SwiftChainn:mainfrom
Ogstevyn:feat/escrow-admin-transfer

Conversation

@Ogstevyn

Copy link
Copy Markdown
Contributor

Summary

  • Added propose_admin so the current admin can nominate a new admin address (stored as pending_admin in instance storage)
  • Added accept_admin so the nominated address can claim the admin role; atomically updates admin and clears pending_admin on acceptance
  • init now stores the initializer as the first admin
  • Added get_admin view function needed to verify admin state
  • Emits AdminTransferred { old_admin, new_admin } event on successful transfer
  • Added four unit tests covering: happy-path transfer, non-pending address rejection, atomic state update, and event emission

Test plan

  • test_init_and_get_status — existing test still passes
  • test_propose_and_accept_admin — end-to-end two-step transfer succeeds
  • test_accept_admin_rejected_for_non_pending — panics when wrong address calls accept_admin
  • test_admin_cleared_after_transfer — old admin no longer set, new admin confirmed
  • test_admin_transfer_emits_event — event published on transfer

Closes #14

…st.rs

feat(escrow_contract): implement two-step admin transfer mechanism
@drips-wave

drips-wave Bot commented Apr 23, 2026

Copy link
Copy Markdown

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

@Tybravo
Tybravo merged commit 8074c81 into SwiftChainn:main Apr 23, 2026
1 check failed
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.

Smart Contract: Implement Admin Transfer for Escrow Contract

2 participants