Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions contracts/ERC721MOperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than modifying ERC721MOperatorFilterer, recommend creating a new variant like ERC721MOperatorFiltererPausable which extends ERC721MOperatorFilterer

Also thoughts on using Pausable?

bool public _tradable = false;

constructor(
string memory collectionName,
string memory collectionSymbol,
Expand Down Expand Up @@ -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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
super._beforeTokenTransfer(from, to, tokenId);
}
}