Skip to main content

Overview

The Pausable mixin provides a trading “kill switch” functionality. The primary entry points to the CTF Exchange are decorated with the notPaused modifier, allowing trading to be paused if needed. This provides an emergency stop mechanism for the exchange. Source: src/exchange/mixins/Pausable.sol

State Variables

paused

bool public paused = false
Indicates whether trading is currently paused. When true, functions decorated with notPaused will revert.

Modifiers

notPaused

modifier notPaused()
Reverts if the paused state variable is true. Applied to trading functions to prevent execution when the exchange is paused. Reverts: Paused() if trading is currently paused.

Functions

_pauseTrading

function _pauseTrading() internal override
Internal function that sets the paused state variable to true, which causes all functions decorated with notPaused to revert.

Emits

  • TradingPaused(msg.sender)

_unpauseTrading

function _unpauseTrading() internal override
Internal function that sets the paused state variable to false. This unpauses trading by allowing the notPaused modifier to pass.

Emits

  • TradingUnpaused(msg.sender)

Events

TradingPaused

event TradingPaused(address indexed pauser)
Emitted when trading is paused.

Parameters

  • pauser (address): The address that paused trading

TradingUnpaused

event TradingUnpaused(address indexed pauser)
Emitted when trading is unpaused.

Parameters

  • pauser (address): The address that unpaused trading

Errors

Paused

error Paused()
Thrown when attempting to execute a trading function while the exchange is paused.

Usage

These internal functions are typically exposed through access-controlled public functions in the main exchange contract. Only authorized administrators should be able to pause and unpause trading.