• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    Solidity
  • License
    MIT License
  • Created about 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Optimized and flexible version of OpenSea's operator filterer

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:

More Repositories

1

solady

Optimized Solidity snippets.
Solidity
2,349
star
2

dn404

Implementation of a co-joined ERC20 and ERC721 pair.
Solidity
463
star
3

multicaller

Efficient multicaller contracts
Solidity
260
star
4

Python-KD-Tree

A simple and fast KD-tree for points in Python for kNN or nearest points. (damm short at just ~60 lines) No libraries needed.
Python
168
star
5

soledge

Solidity snippets too edgy to be in Solady
Solidity
107
star
6

Aris

Aris - A fast and powerful tool to write HTML in JS easily. Includes syntax highlighting, templates, SVG, CSS autofixing, debugger support and more...
JavaScript
88
star
7

function-selector-miner

Solidity Function Selector Miner (AVX2 + Multithreaded)
Rust
62
star
8

Static-Sort

A simple C++ header-only library for fastest sorting of small arrays. Generates sorting networks on compile time via templates.
C++
51
star
9

preapprove

On-chain pre-approval registry for NFTs. Library included.
Solidity
42
star
10

Fluidsim

A C++ fluid simulator (SPH, OpenCL, GLSL, SSE, Fast Marching Cubes)
C++
19
star
11

Othello-AI

A strong Othello AI bot for 50.021 Artificial Intelligence course.
Python
12
star
12

VoxNet-Tensorflow

A Tensorflow Implementation of VoxNet.
Python
11
star
13

QDES

Quadratic Decay Exponential Surge
Solidity
11
star
14

Softee

Solidity
7
star
15

vectorized

5
star
16

foundry-starter

Script to initialize a foundry project in the current working directory
Shell
4
star
17

Sort-Me

A Realtime Multiplayer Sorting Game for Android
Java
3
star
18

Solidity-Code-Reviews

2
star
19

ERC721A-Upgradeable-Old

Upgradeable version of ERC721A
Solidity
2
star
20

Python-Attribute-List

Add/set attributes to Python's built-in list.
Python
1
star
21

NFTStaker

Solidity
1
star
22

ERC721A-Docs

ERC721A Documentation
1
star
23

ERC721A-Transpiler

Transpiler for creating upgradable ERC721A
TypeScript
1
star
24

SUTD-Staff-Room-Maps-old-Dover-edition

An Android App for navigating the staff room in SUTD's old Dover Campus.
Java
1
star
25

CECSATSolver

CEC-SAT verification software for ISTD 2D Design Challenge
Java
1
star
26

solady-copy

Solidity
1
star