Skip to content

fix: emit AdminTransferredEvent in transfer_admin for all three contracts (Fixes #55) - #59

Open
baedboibidex-cmyk wants to merge 1 commit into
ecotask-network:mainfrom
baedboibidex-cmyk:fix/admin-transfer-event-emissions
Open

fix: emit AdminTransferredEvent in transfer_admin for all three contracts (Fixes #55)#59
baedboibidex-cmyk wants to merge 1 commit into
ecotask-network:mainfrom
baedboibidex-cmyk:fix/admin-transfer-event-emissions

Conversation

@baedboibidex-cmyk

Copy link
Copy Markdown

Summary

Fixes #55 — Adds AdminTransferredEvent emissions to transfer_admin in all three contracts (eco-token, task-registry, reward-engine).

Changes

  • contracts/eco-token/src/token.rs: Added AdminTransferredEvent struct and emission in transfer_admin
  • contracts/task-registry/src/registry.rs: Added AdminTransferredEvent struct and emission in transfer_admin
  • contracts/reward-engine/src/verification.rs: Added AdminTransferredEvent struct and emission in transfer_admin
  • CHANGELOG.md: Added entry documenting the new event

Event Structure

#[contractevent]
pub struct AdminTransferredEvent {
    #[topic]
    pub previous_admin: Address,
    pub new_admin: Address,
}
  • previous_admin is a #[topic] field for indexer filtering
  • Event is emitted after the storage write, reflecting committed state
  • No event is emitted on failed (panicking) calls

Tests

Added test_transfer_admin_emits_event in each contract that:

  • Calls transfer_admin successfully
  • Asserts the event is emitted with correct topic (previous_admin) and data (new_admin)
  • All 159 existing tests continue to pass

CI Checklist

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --target wasm32v1-none --release --locked
  • cargo doc --workspace --no-deps (with -D warnings) ✅
  • cargo test --workspace — 159 tests passed ✅

Resolves #55

…acts (Fixes ecotask-network#55)

Add AdminTransferredEvent { #[topic] previous_admin, new_admin } to
eco-token, task-registry, and reward-engine. The event is emitted after
the storage write in transfer_admin, giving off-chain indexers a
verifiable on-chain signal for admin handover governance auditing.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>

@cybermax4200 cybermax4200 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.

The CI checks are failing, please kindly fix them

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.

No event emitted when transfer_admin succeeds in any contract; admin handover is silent on-chain

2 participants