Gas optimized and flexible version of OpenSea's Mandatory Operator Filterer for royalties.
-
modifier onlyAllowedOperator(address from, bool filterEnabled)
modifier that allows conditional toggling of the filter.You can passed in a bool extracted from a packed variable for
filterEnabled. -
_registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)Registration function that can be called in an initializer, anywhere.
Can be called repeatedly without issues.
-
_registerForOperatorFiltering()Registration function similar to above. Uses OpenSea's default block list.
-
Gas optimized. Saves 300+ gas on transfers.
-
Keeps your cilents and some marketplaces happy.
See src/example/ExampleERC721.sol.
src
├─ OperatorFilterer.sol — "Operator Filterer for regular and upgradeable contracts"
└─ example
├─ ExampleERC1155.sol — "ERC1155 example"
├─ ExampleERC721.sol — "ERC721 example with demonstration of togglability"
└─ upgradeable
├─ ExampleERC1155Upgradeable.sol — "ERC1155 upgradeable example"
└─ ExampleERC721Upgradeable.sol — "ERC721 upgradeable example"This is experimental software and is provided on an "as is" and "as available" basis.
We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
To install with Foundry:
forge install vectorized/closedseaTo install with Hardhat or Truffle:
npm install closedseaThis repository is inspired by and directly modified from: