API Reference

Security

This package provides the API for all Security modules.

For an overview of the module, read the Security guide.

The page covers the following modules:

import "./node_modules/@openzeppelin/compact-contracts/security/Initializable";

Use this module only at the top contract layer, and import it into at most one module per contract. When two modules in the same directory both import Initializable, the compiler collapses their _isInitialized flags into a single shared ledger slot (compact#270): initializing one marks the other as initialized. The OpenZeppelin modules do not import this module; each tracks its own _isInitialized flag inline.


Ledger

_isInitialized: Boolean

ledger

#

Whether initialize has run. Guards against re-initialization and against use before initialization.

Witnesses

None.

Circuits

initialize() → []

circuit

#

Initializes the state thus ensuring the calling circuit can only be called once.

Requirements:

  • Contract must not be initialized.

assertInitialized() → []

circuit

#

Asserts that the contract has been initialized, throwing an error if not.

Requirements:

  • Contract must be initialized.
k=6, rows=25

assertNotInitialized() → []

circuit

#

Asserts that the contract has not been initialized, throwing an error if it has.

Requirements:

  • Contract must not be initialized.
k=6, rows=28

import "./node_modules/@openzeppelin/compact-contracts/security/Pausable";

Ledger

_isPaused: Boolean

ledger

#

Whether the contract is paused. Consuming contracts gate state-changing circuits on it via assertPaused / assertNotPaused.

Witnesses

None.

Circuits

isPaused() → Boolean

circuit

#

Returns true if the contract is paused, and false otherwise.

k=6, rows=24

assertPaused() → []

circuit

#

Makes a circuit only callable when the contract is paused.

Requirements:

  • Contract must be paused.
k=6, rows=25

assertNotPaused() → []

circuit

#

Makes a circuit only callable when the contract is not paused.

Requirements:

  • Contract must not be paused.
k=6, rows=28

_pause() → []

circuit

#

Triggers a stopped state.

Requirements:

  • Contract must not be paused.
k=6, rows=28

_unpause() → []

circuit

#

Lifts the pause on the contract.

Requirements:

  • Contract must be paused.
k=6, rows=25

import "./node_modules/@openzeppelin/compact-contracts/security/Allowlist";

A minimal permit-list keyed by a Bytes<32> account identifier. The mutators _allow and _disallow are ungated: the implementing contract must protect them with its own access control and decides where assertAllowed applies. Membership is public and the approved set is publicly enumerable.


Ledger

_allowed: Set<Bytes<32>>

ledger

#

Approved accounts. Absent means not allowed.

Witnesses

None.

Circuits

isAllowed(account: Bytes<32>) → Boolean

circuit

#

Returns whether account is currently allowed.

k=9, rows=303

assertAllowed(account: Bytes<32>) → []

circuit

#

Asserts that account is allowed. The composing contract decides when this gate applies.

Requirements:

  • account is a member of the allowlist.
k=9, rows=303

_allow(account: Bytes<32>) → []

circuit

#

Adds account to the allowlist.

k=9, rows=301

_disallow(account: Bytes<32>) → []

circuit

#

Removes account from the allowlist.

k=9, rows=301

import "./node_modules/@openzeppelin/compact-contracts/security/Blocklist";

A minimal deny-list keyed by a Bytes<32> account identifier. The mutators _block and _unblock are ungated: the implementing contract must protect them with its own access control and decides where assertNotBlocked applies. Membership is public and the blocked set is publicly enumerable.


Ledger

_blocked: Set<Bytes<32>>

ledger

#

Blocked accounts. Absent means not blocked.

Witnesses

None.

Circuits

isBlocked(account: Bytes<32>) → Boolean

circuit

#

Returns whether account is currently blocked.

k=9, rows=303

assertNotBlocked(account: Bytes<32>) → []

circuit

#

Asserts that account is not blocked. The composing contract decides when this gate applies.

Requirements:

  • account is not a member of the blocklist.
k=9, rows=306

_block(account: Bytes<32>) → []

circuit

#

Adds account to the blocklist.

k=9, rows=301

_unblock(account: Bytes<32>) → []

circuit

#

Removes account from the blocklist.

k=9, rows=301