Repository navigation
feat(pause): emit events on pause and unpause - #843
Merged
Merged
Conversation
|
@1Judah 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds event emission to the contract's emergency pause and unpause entrypoints. This makes pause-state transitions observable off-chain so indexers, dashboards, and monitoring can react when the contract is halted or resumed.
Problem
The contract already exposed
pauseandunpauseto halt and restore sensitive entrypoints, andis_pausedto read the current state. However, transitioning the pause state produced no on-chain event. Clients could only detect a change by pollingis_paused, and there was no canonical log entry recording when or in what order the contract was paused or unpaused.Changes Made
pausenow publishes apausedevent after setting the paused flag.unpausenow publishes anunpausedevent after clearing the paused flag.Both entrypoints remain admin-gated via the existing
require_adminhelper, and both events are emitted only after the storage write succeeds. Onlyonchain/contracts/stellar_hunts/src/lib.rswas modified.Implementation Details
The event follows the same pattern used elsewhere in the contract:
env.events().publishwith aSymboltopic. Because the pause flag carries no payload, the topic tuple is paired with an empty data value. Publishing after the state write keeps the event consistent with the persisted flag.Closes #677
Closes #679
Closes #682
Closes #684