Giter Site home page Giter Site logo

operator-filter-registry's Introduction

Operator Filter Registry

This repository contains a number of tools to help token contracts manage the operators allowed to transfer tokens on behalf of users - including the smart contracts and delegates of marketplaces that do not respect creator fees.

This is not a foolproof approach - but it makes bypassing creator fees less liquid and easy at scale.

How it works

Token smart contracts may register themselves (or be registered by their "owner") with the OperatorFilterRegistry. Token contracts or their "owner"s may then curate lists of operators (specific account addresses) and codehashes (smart contracts deployed with the same code) that should not be allowed to transfer tokens on behalf of users.

Creator Fee Enforcement

OpenSea will enforce creator fees for smart contracts that make best efforts to filter transfers from operators known to not respect creator fees.

This repository facilitates that process by providing smart contracts that interface with the registry automatically, including automatically subscribing to OpenSea's list of filtered operators.

When filtering operators, use of this registry is not required, nor is it required for a token contract to "subscribe" to OpenSea's list within this registry. Subscriptions can be changed or removed at any time. Filtered operators and codehashes may likewise be added or removed at any time.

Contract owners may implement their own filtering outside of this registry, or they may use this registry to curate their own lists of filtered operators. However, there are certain contracts that are filtered by the default subscription, and must be filtered in order to be eligible for creator fee enforcement on OpenSea.

Filtered addresses

Entries in this list are added according to the following criteria:

  • If the application most commonly used to interface with the contract gives buyers and sellers the ability to bypass creator fees when a similar transaction for the same item would require creator fee payment on OpenSea.io
  • If the contract is facilitating the evasion of on-chain creator fee enforcement measures. For example, the contract uses a wrapper contact to bypass fee enforcement.
Name Address Network
Blur.io ExecutionDelegate 0x00000000000111AbE46ff893f3B2fdF1F759a8A8 Ethereum Mainnet
LooksRare TransferManagerERC721 0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e Ethereum Mainnet
LooksRare TransferManagerERC1155 0xFED24eC7E22f573c2e08AEF55aA6797Ca2b3A051 Ethereum Mainnet
X2Y2 ERC721Delegate 0xf849de01b080adc3a814fabe1e2087475cf2e354 Ethereum Mainnet
X2Y2 ERC1155Delegate 0x024ac22acdb367a3ae52a3d94ac6649fdc1f0779 Ethereum Mainnet
SudoSwap LSSVMPairRouter 0x2b2e8cda09bba9660dca5cb6233787738ad68329 Ethereum Mainnet

Deployments

Network OperatorFilterRegistry OpenSea Curated Subscription Address
Ethereum

0x000000000000AAeB6D7670E522A718067333cd4E

0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6

Goerli

Usage

Token contracts that wish to manage lists of filtered operators and restrict transfers from them may integrate with the registry easily with tokens using the OperatorFilterer and DefaultOperatorFilterer contracts. These contracts provide a modifier (isAllowedOperator) which can be used on the token's transfer methods to restrict transfers from filtered operators.

See the ExampleERC721 and ExampleERC1155 contracts for basic implementations that inherit the DefaultOperatorFilterer.

Smart Contracts

OperatorFilterRegistry

OperatorFilterRegistry lets a smart contract or its EIP-173 Owner register a list of addresses and code hashes to deny when isOperatorBlocked is called.

It also supports "subscriptions," which allow a contract to delegate its operator filtering to another contract. This is useful for contracts that want to allow users to delegate their operator filtering to a trusted third party, who can continuously update the list of filtered operators and code hashes. Subscriptions may be cancelled at any time by the subscriber or its Owner.

updateOperatorAddress(address registrant, address operator, bool filter)

This method will toggle filtering for an operator for a given registrant. If filter is true, isOperatorAllowed will return false. If filter is false, isOperatorAllowed will return true. This can filter known addresses.

updateOperatorCodeHash(address registrant, bytes32 codeHash, bool filter)

This method will toggle filtering on code hashes of operators given registrant. If an operator's EXTCODEHASH matches a filtered code hash, isOperatorAllowed will return true. Otherwise, isOperatorAllowed will return false. This can filter smart contract operators with different addresess but the same code.

OperatorFilterer

This smart contract is meant to be inherited by token contracts so they can use the onlyAllowedOperator modifier on the transferFrom and safeTransferFrom methods.

On construction, it takes three parameters:

  • address registry: the address of the OperatorFilterRegistry contract
  • address subscriptionOrRegistrantToCopy: the address of the registrant the contract will either subscribe to, or do a one-time copy of that registrant's filters. If the zero address is provided, no subscription or copies will be made.
  • bool subscribe: if true, subscribes to the previous address if it was not the zero address. If false, copies existing filtered addresses and codeHashes without subscribing to future updates.

onlyAllowedOperator(address operator)

This modifier will revert if the operator or its code hash is filtered by the OperatorFilterRegistry contract.

DefaultOperatorFilterer

This smart contract extends OperatorFilterer and automatically configures the token contract that inherits it to subscribe to OpenSea's list of filtered operators and code hashes. This subscription can be updated at any time by the owner by calling updateSubscription on the OperatorFilterRegistry contract.

OwnedRegistrant

This Ownable smart contract is meant as a simple utility to enable subscription addresses that can easily be transferred to a new owner for administration. For example: an EOA curates a list of filtered operators and code hashes, and then transfers ownership of the OwnedRegistrant to a multisig wallet.

License

MIT Copyright 2022 Ozone Networks, Inc.

operator-filter-registry's People

Contributors

operatorfilterer avatar iainnash avatar neutiyoo avatar adjisb avatar

Watchers

James Cloos 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.