Skip to content

feat: implement protocol-wide emergency pause via parameters-contract #49

Description

@EmeditWeb

Problem

There is no emergency pause mechanism anywhere in the contract suite. The product vision specifies a kill-switch that can halt all protocol operations in case of an emergency (e.g., vulnerability discovered, oracle malfunction).

Contract impact: If a critical vulnerability is discovered, there is no way to pause the protocol. All contract operations would continue until a WASM upgrade is deployed and activated — a process that takes time during which funds can be lost.

Before Starting

Read: context/architecture-context.md

Root Cause

The pause mechanism was deferred in the contract design.

What To Build

  1. Add paused: bool to parameters contract storage
  2. Add set_paused(env, admin, paused: bool) — admin/multisig only
  3. All other contracts read pause status from parameters contract
  4. When paused, all mutating functions return a Paused error
  5. Read-only functions (get_score, get_loan, etc.) still work when paused

Files To Touch

  • contracts/parameters-contract/src/lib.rs — add pause/unpause
  • contracts/parameters-contract/src/storage.rs — add paused key
  • contracts/creditline-contract/src/lib.rs — check pause before mutations
  • contracts/liquidity-pool-contract/src/lib.rs — check pause before mutations
  • contracts/reputation-contract/src/lib.rs — check pause before mutations

Acceptance Criteria

  • Pause flag stored in parameters contract
  • Admin can pause/unpause
  • All mutating functions blocked when paused
  • Read functions work when paused
  • All existing tests pass

Mandatory Checks

  • context/ files read
  • cargo build passes
  • cargo test passes
  • PR references this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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