Skip to content
 
 

Repository files navigation

ClosedSea 🚪

NPM CI MIT License

Gas optimized and flexible version of OpenSea's Mandatory Operator Filterer for royalties.

Features

  • Modifiers can be toggled on / off efficiently.

  • Gas optimized. Saves 1500+ gas on transfers.

  • Keeps your cilents and some marketplaces happy.

Installation

To install with Foundry:

forge install vectorized/closedsea

To install with Hardhat or Truffle:

npm install closedsea

Contracts

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"

Example

See src/example/ExampleERC721.sol.

API

_registerForOperatorFiltering

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.

onlyAllowedOperator

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.

onlyAllowedOperatorApproval

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.

Safety

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.

Acknowledgements

This repository is inspired by and directly modified from:

About

Optimized and flexible version of OpenSea's operator filterer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages