Skip to content

[CT-22] Implement contract admin transfer mechanism in assetsup in opsce crate #819

@yusuftomilola

Description

@yusuftomilola

Problem

The assetsup contract sets an admin address at initialization but provides no way to transfer admin rights to a new address. If the admin key is compromised, the contract is permanently stuck with the compromised admin.

Proposed Solution

Create contracts/opsce/src/admin_transfer.rs. Implement a two-step admin transfer: the current admin proposes a new admin, and the new admin must accept.

Acceptance Criteria

  • propose_admin_transfer(env, new_admin) stores the pending admin (current admin only)
  • accept_admin_transfer(env) — caller must match the pending admin stored in step 1
  • cancel_admin_transfer(env) removes the pending admin (current admin only)
  • get_pending_admin(env) returns the address awaiting acceptance, or None
  • Emits admin_transfer_proposed and admin_transfer_completed events
  • Unit tests cover: full happy path, non-admin propose fails, wrong address accept fails, cancel and re-propose

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions