You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
Solidity
39 lines
1.1 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
import "../ERC1155.sol";
|
|
import "../../../security/Pausable.sol";
|
|
|
|
/**
|
|
* @dev ERC1155 token with pausable token transfers, minting and burning.
|
|
*
|
|
* Useful for scenarios such as preventing trades until the end of an evaluation
|
|
* period, or having an emergency switch for freezing all token transfers in the
|
|
* event of a large bug.
|
|
*
|
|
* _Available since v3.1._
|
|
*/
|
|
abstract contract ERC1155Pausable is ERC1155, Pausable {
|
|
/**
|
|
* @dev See {ERC1155-_beforeTokenTransfer}.
|
|
*
|
|
* Requirements:
|
|
*
|
|
* - the contract must not be paused.
|
|
*/
|
|
function _beforeTokenTransfer(
|
|
address operator,
|
|
address from,
|
|
address to,
|
|
uint256[] memory ids,
|
|
uint256[] memory amounts,
|
|
bytes memory data
|
|
) internal virtual override {
|
|
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
|
|
|
|
require(!paused(), "ERC1155Pausable: token transfer while paused");
|
|
}
|
|
}
|