Git Product home page Git Product logo

closedsea's Introduction

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:

closedsea's People

Contributors

vectorized avatar 1kresh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.