Skip to content

Add protocol-level emergency pause that halts buy and sell while keeping reads live #393

@Chucks1093

Description

@Chucks1093

Summary

If a critical bug or exploit is discovered after deployment, there is currently no way to stop the damage without abandoning the contract entirely. An emergency pause mechanism lets the protocol admin halt all state-changing operations (buy, sell, registration) while keeping all read-only view functions live, so users can still see their balances and prices while the team investigates and prepares a fix.

Scope

  • Add a paused: bool field to protocol config storage (default: false)
  • Add pause() and unpause() admin-only functions that set this flag and emit a ProtocolPaused / ProtocolUnpaused event
  • At the start of buy, sell, and register_creator, check the flag and panic with a new ProtocolPaused error variant if true
  • All get_* / quote_* read-only functions are unaffected — they must continue to work while paused
  • Only the protocol admin address (from config) may call pause or unpause

Acceptance Criteria

  • pause() sets the flag and emits ProtocolPaused event
  • unpause() clears the flag and emits ProtocolUnpaused event
  • Buy reverts with ProtocolPaused when paused
  • Sell reverts with ProtocolPaused when paused
  • Creator registration reverts with ProtocolPaused when paused
  • All read-only view functions succeed while paused
  • Non-admin caller to pause or unpause is rejected with Unauthorized
  • Unit tests cover all of the above cases

Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

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