Skip to content
Lattice

ERC1155PausableLib

Git Source

Title: ERC1155PausableLib

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/extensions/ERC1155Pausable.sol)

Library implementing ERC-1155 transfers, mints and burns that revert with IPausable.EnforcedPause while the shared PausableLib state is paused. Adds no own storage and no ERC-165 id.

OpenZeppelin v5.6.1 puts whenNotPaused on _update. Lattice's base ERC1155Lib has no hook (decision D25(a) on #234), so this library carries its own transfer, mint and burn paths and checks the pause in _updateWithAcceptanceCheck, right before ERC1155Lib._update. The authorization and zero-address checks therefore still run first while paused, and the pause check runs before the array-length check, as in OpenZeppelin. Differences from OpenZeppelin v5.6.1:

Functions

safeTransferFrom

ERC1155Lib.safeTransferFrom, reverting while paused.

function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal;

Parameters

NameTypeDescription
fromaddress
toaddress
iduint256
valueuint256
databytes

safeBatchTransferFrom

ERC1155Lib.safeBatchTransferFrom, reverting while paused.

function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal;

Parameters

NameTypeDescription
fromaddress
toaddress
idsuint256[]
valuesuint256[]
databytes

burn

ERC1155BurnableLib.burn, reverting while paused.

function burn(address account, uint256 id, uint256 value) internal;

Parameters

NameTypeDescription
accountaddress
iduint256
valueuint256

burnBatch

ERC1155BurnableLib.burnBatch, reverting while paused.

function burnBatch(address account, uint256[] memory ids, uint256[] memory values) internal;

Parameters

NameTypeDescription
accountaddress
idsuint256[]
valuesuint256[]

_mint

ERC1155Lib._mint, reverting while paused. A mint facet on a pausable diamond must call this.

function _mint(address to, uint256 id, uint256 value, bytes memory data) internal;

Parameters

NameTypeDescription
toaddress
iduint256
valueuint256
databytes

_mintBatch

ERC1155Lib._mintBatch, reverting while paused.

function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal;

Parameters

NameTypeDescription
toaddress
idsuint256[]
valuesuint256[]
databytes

_burn

ERC1155Lib._burn, reverting while paused.

function _burn(address from, uint256 id, uint256 value) internal;

Parameters

NameTypeDescription
fromaddress
iduint256
valueuint256

_burnBatch

ERC1155Lib._burnBatch, reverting while paused.

function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal;

Parameters

NameTypeDescription
fromaddress
idsuint256[]
valuesuint256[]

_updateWithAcceptanceCheck

Reverts with IPausable.EnforcedPause while paused, then runs ERC1155Lib._updateWithAcceptanceCheck: the port of OpenZeppelin's whenNotPaused on _update.

function _updateWithAcceptanceCheck(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data,
        bool batch
    ) internal;

Parameters

NameTypeDescription
fromaddress
toaddress
idsuint256[]
valuesuint256[]
databytes
batchbool

_checkTransferAddresses

The zero-address checks of ERC1155Lib._safeTransferFrom, in its order.

function _checkTransferAddresses(address from, address to) private pure;

Parameters

NameTypeDescription
fromaddress
toaddress