Gas optimized and flexible version of OpenSea's Mandatory Operator Filterer for royalties.
-
Modifiers can be toggled on / off efficiently.
-
Gas optimized. Saves 300+ gas on transfers.
-
Keeps your cilents and some marketplaces happy.
To install with Foundry:
forge install vectorized/closedsea
To install with Hardhat or Truffle:
npm install closedsea
src
├─ OperatorFilterer.sol — "Operator Filterer for regular and upgradeable contracts"
└─ example
├─ ExampleERC721A.sol — "ERC721A example with demonstration of togglability"
├─ ExampleERC721.sol — "ERC721 example with demonstration of togglability"
├─ ExampleERC1155.sol — "ERC1155 example"
└─ upgradeable
├─ ExampleERC721AUpgradeable.sol — "ERC721A upgradeable example"
├─ ExampleERC721Upgradeable.sol — "ERC721 upgradeable example"
└─ ExampleERC1155Upgradeable.sol — "ERC1155 upgradeable example"
Type | Contract |
---|---|
ERC721A | src/example/ExampleERC721A.sol |
ERC721 | src/example/ExampleERC721.sol |
ERC1155 | src/example/ExampleERC1155.sol |
ERC721AUpgradeable | src/example/upgradeable/ExampleERC721AUpgradeable.sol |
ERC721Upgradeable | src/example/upgradeable/ExampleERC721Upgradeable.sol |
ERC1155Upgradeable | src/example/upgradeable/ExampleERC1155Upgradeable.sol |
function _registerForOperatorFiltering(
address subscriptionOrRegistrantToCopy,
bool subscribe
) internal virtual
Registration function that can be called in an initializer, anywhere.
Can be called repeatedly without issues.
To subscribe to the default OpenSea curated block list, simply use _registerForOperatorFiltering()
, without arguments.
modifier onlyAllowedOperator(address from) virtual
Modifier to guard a function and revert if from
is a blocked operator.
modifier onlyAllowedOperatorApproval(address operator) virtual
Modifier to guard a function from approving a blocked operator.
function _operatorFilteringEnabled() internal view virtual returns (bool)
For deriving contracts to override, so that operator filtering can be turned on / off.
Returns true by default.
function _isPriorityOperator(address operator) internal view virtual returns (bool)
For deriving contracts to override, so that preferred marketplaces can skip operator filtering, helping users save gas.
Returns false for all inputs by default.
We have verified with OpenSea engineers that ClosedSea is fully compatible with their royalties enforcement system, as of Nov 18th 2022.
Nevertheless, this codebase 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.
This repository is inspired by and directly modified from: