Skip to content

feat: two-step admin/role transfer across all six contracts (#20) - #68

Open
malaysiaonelove wants to merge 1 commit into
Kqirox:mainfrom
malaysiaonelove:feature/two-step-admin-transfer-issue-20
Open

feat: two-step admin/role transfer across all six contracts (#20)#68
malaysiaonelove wants to merge 1 commit into
Kqirox:mainfrom
malaysiaonelove:feature/two-step-admin-transfer-issue-20

Conversation

@malaysiaonelove

Copy link
Copy Markdown

closes #20

See commit b258c3d for the full description. Adds propose/accept/cancel methods for every admin key and wiring address across reward-pool, badge-nft, stake-vault, course-registry, quest-engine, and governance. New shared contracts/common::two_step module exposes PendingTransfer struct and TransferProposed/TransferAccepted/TransferCancelled events.

…qirox#20)

Implements the propose/accept/cancel flow for every admin key and
wiring address exposed by the Orivex-Contracts platform.

## Shared module
- contracts/common/src/two_step.rs: new PendingTransfer struct and
  three shared events (TransferProposed, TransferAccepted,
  TransferCancelled). Soft timelock semantics per Kqirox#20 acceptance
  criteria.

## Per-contract additions
| Contract       | Roles covered                              |
| -------------- | ------------------------------------------ |
| reward-pool    | Admin                                      |
| badge-nft      | Admin                                      |
| stake-vault    | Admin                                      |
| course-registry| Admin, RewardPoolAddress, BadgeNftAddress  |
| quest-engine   | Admin, RewardPool, StakeVault              |
| governance     | Admin, BadgeContractAddress                |

For each role we add:
- propose_new_<role>(current_admin, proposed): admin-only stage 1
- accept_<role>(acceptor): only the proposed address may call
- cancel_<role>(caller): caller == proposed address OR caller ==
  current admin (typo recovery)

Single-step setters (set_reward_pool_address, set_badge_nft_address,
quest-engine set_*_address, etc.) are kept for the initial bootstrap.
Subsequent rotations go through the two-step flow.

## Dependencies
Added contracts-common to reward-pool, badge-nft, stake-vault,
quest-engine, governance (course-registry already had it).

## Tests
Per role, ~10 tests covering happy-path propose→accept, event
emission, unauthorized-propose, wrong-acceptor panic, no-pending
panics, typo recovery (admin cancel AND self cancel), random-cancel
panic.

## Docs
Top-level contracts/README.md plus per-contract READMEs document the
new auth flow.

Closes Kqirox#20
@merlik787-droi

Copy link
Copy Markdown
Contributor

@malaysiaonelove resolve conflicts

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.

[20] Implement two-step admin/role transfer across all contracts

2 participants