npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

closedsea

v1.0.0

Published

Optimized and flexible version of OpenSea's operator filterer

Downloads

8,760

Readme

ClosedSea 🚪

NPM CI MIT License

📢 The OpenSea deadline for newly published contracts to include operator filtering has been extended to 2nd Jan 2023.

However, there is a new requirement that all contracts published from then onwards MUST include the ERC2981 royalty standard.

Please refer to the examples, updated for your convenience.

About the Project

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

Features

  • Modifiers can be toggled on / off efficiently.

  • Gas optimized. Saves 300+ gas on transfers.

  • Keeps your clients 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
   ├─ ExampleERC721A.sol — "ERC721A example"
   ├─ ExampleERC721.sol — "ERC721 example"
   ├─ ExampleERC1155.sol — "ERC1155 example"
   └─ upgradeable
      ├─ ExampleERC721AUpgradeable.sol — "ERC721A upgradeable example"
      ├─ ExampleERC721Upgradeable.sol — "ERC721 upgradeable example"
      └─ ExampleERC1155Upgradeable.sol — "ERC1155 upgradeable example"

Examples

| 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 |

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) virtual

Modifier to guard a function and revert if from is a blocked operator.

onlyAllowedOperatorApproval

modifier onlyAllowedOperatorApproval(address operator) virtual

Modifier to guard a function from approving a blocked operator.

_operatorFilteringEnabled

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.

_isPriorityOperator

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.

Safety

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.

Acknowledgements

This repository is inspired by and directly modified from: