Skip to content

Fix: add missing ContractInitialized and PauseToggled events across all contracts - #44

Open
Songu3020 wants to merge 3 commits into
Kqirox:mainfrom
Songu3020:main
Open

Fix: add missing ContractInitialized and PauseToggled events across all contracts#44
Songu3020 wants to merge 3 commits into
Kqirox:mainfrom
Songu3020:main

Conversation

@Songu3020

@Songu3020 Songu3020 commented Jul 20, 2026

Copy link
Copy Markdown

#closes
#29

Problem

Several state-changing operations across the six contracts didn't emit events, creating an asymmetry that broke off-chain indexers relying on events as the source of truth:

  • reward-pool::set_pause — toggled global pause with no event.
  • reward-pool::initialize — bootstrap with no event.
  • course-registry::initialize — same.
  • badge-nft::initialize — same.
  • stake-vault::initialize, quest-engine::initialize, governance::initialize — these already emitted init events correctly.

With half the contracts silent on init and pause, indexers had no way to reconstruct admin wiring from events alone and were forced to poll instead of reacting to the moment a contract was initialized or paused.

Fix

Added two new, consistently-named event types emitted across all six contracts:

  • ContractInitialized { admin, role_addresses... } — now emitted by every initialize(), including the three that previously emitted nothing (reward-pool, course-registry, badge-nft), and left unchanged in behavior for the three that already emitted an init event.
  • PauseToggled { admin, status } — now emitted symmetrically by every set_pause(), including reward-pool::set_pause (previously silent) and quest-engine::set_pause (brought in line with the others).

Naming follows the ContractInitialized, PauseToggled, AdminTransferred convention noted in the issue, keeping this consistent with the related two-step admin transfer work (#20).

Files changed

  • All six contracts: reward-pool, course-registry, badge-nft, stake-vault, quest-engine, governance
  • Cross-contract indexer documentation — updated to document the new/standardized events

Testing

  • Added/updated tests asserting ContractInitialized is emitted on every contract's initialize().
  • Added/updated tests asserting PauseToggled is emitted on every contract's set_pause(), including reward-pool and quest-engine.
  • Existing tests for stake-vault, quest-engine, and governance init events remain green — no behavior change for contracts that already emitted correctly.

- Created test snapshot for pool balance reflecting funding, ensuring that the balance updates correctly after funding.
- Added test snapshot for verifying that the pool balance returns zero initially.
- Implemented test snapshot to confirm that token decimals return the expected value of seven.
@Songu3020 Songu3020 closed this Jul 20, 2026
@Songu3020 Songu3020 reopened this Jul 20, 2026
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.

1 participant