ERC1155PausableLib
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:
- Only movements that go through this library are gated. A facet that moves tokens through ERC1155Lib directly ignores the pause: the base ERC1155 transfers (which ERC1155Pausable replaces), ERC1155Burnable's and ERC1155Supply's burns, and any mint facet that does not call _mint/_mintBatch.
- Burns are exported by the ERC1155Pausable facet (OpenZeppelin's live in
ERC1155Burnable). pause/unpausecome from the separately cut Pausable facet, gated onDEFAULT_ADMIN_ROLE.
Functions
safeTransferFrom
ERC1155Lib.safeTransferFrom, reverting while paused.
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| id | uint256 | |
| value | uint256 | |
| data | bytes |
safeBatchTransferFrom
ERC1155Lib.safeBatchTransferFrom, reverting while paused.
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| ids | uint256[] | |
| values | uint256[] | |
| data | bytes |
burn
ERC1155BurnableLib.burn, reverting while paused.
function burn(address account, uint256 id, uint256 value) internal;Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| id | uint256 | |
| value | uint256 |
burnBatch
ERC1155BurnableLib.burnBatch, reverting while paused.
function burnBatch(address account, uint256[] memory ids, uint256[] memory values) internal;Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| ids | uint256[] | |
| values | uint256[] |
_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
| Name | Type | Description |
|---|---|---|
| to | address | |
| id | uint256 | |
| value | uint256 | |
| data | bytes |
_mintBatch
ERC1155Lib._mintBatch, reverting while paused.
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal;Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| ids | uint256[] | |
| values | uint256[] | |
| data | bytes |
_burn
ERC1155Lib._burn, reverting while paused.
function _burn(address from, uint256 id, uint256 value) internal;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| id | uint256 | |
| value | uint256 |
_burnBatch
ERC1155Lib._burnBatch, reverting while paused.
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| ids | uint256[] | |
| values | uint256[] |
_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
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| ids | uint256[] | |
| values | uint256[] | |
| data | bytes | |
| batch | bool |
_checkTransferAddresses
The zero-address checks of ERC1155Lib._safeTransferFrom, in its order.
function _checkTransferAddresses(address from, address to) private pure;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address |