diff --git a/contracts/ERC721MOperatorFilterer.sol b/contracts/ERC721MOperatorFilterer.sol index 32b328c0..79d09725 100644 --- a/contracts/ERC721MOperatorFilterer.sol +++ b/contracts/ERC721MOperatorFilterer.sol @@ -2,10 +2,14 @@ pragma solidity ^0.8.4; +import "@openzeppelin/contracts/access/Ownable.sol"; + import "./ERC721M.sol"; import "./OperatorFilter/DefaultOperatorFilterer.sol"; contract ERC721MOperatorFilterer is ERC721M, DefaultOperatorFilterer { + bool public _tradable = false; + constructor( string memory collectionName, string memory collectionSymbol, @@ -50,4 +54,22 @@ contract ERC721MOperatorFilterer is ERC721M, DefaultOperatorFilterer { ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } + + function setTradable(bool tradable) external onlyOwner + { + _tradable = tradable; + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual override(ERC721) { + if ( + _tradable != true + ) { + revert("Transfers are currently disabled"); + } + super._beforeTokenTransfer(from, to, tokenId); + } }