Gas optimized and flexible version of OpenSea's Mandatory Operator Filterer for royalties.
-
Modifiers can be toggled on / off efficiently.
-
Gas optimized. Saves 1500+ 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
โโ ExampleERC1155.sol โ "ERC1155 example"
โโ ExampleERC721.sol โ "ERC721 example with demonstration of togglability"
โโ upgradeable
โโ ExampleERC1155Upgradeable.sol โ "ERC1155 upgradeable example"
โโ ExampleERC721Upgradeable.sol โ "ERC721 upgradeable example"
See src/example/ExampleERC721.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, bool enabled) virtual
Modifier to guard a function and revert if from
is a blocked operator.
Can be turned on / off via enabled
.
For efficiency, you can use tight variable packing to efficiently read / write the boolean value for enabled
.
modifier onlyAllowedOperatorApproval(address operator, bool enabled) virtual
Modifier to guard a function from approving a blocked operator.
Can be turned on / off via enabled
.
For efficiency, you can use tight variable packing to efficiently read / write the boolean value for enabled
.
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.
This repository is inspired by and directly modified from: