1.0.0 ā€¢ Published 1 year ago

closedsea v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

TypeContract
ERC721Asrc/example/ExampleERC721A.sol
ERC721src/example/ExampleERC721.sol
ERC1155src/example/ExampleERC1155.sol
ERC721AUpgradeablesrc/example/upgradeable/ExampleERC721AUpgradeable.sol
ERC721Upgradeablesrc/example/upgradeable/ExampleERC721Upgradeable.sol
ERC1155Upgradeablesrc/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:

1.0.0

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.15

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago