Closed nidhhoggr closed 1 year ago
According to the code, the subscribe method pushes an address onto the subscription stack (https://github.com/ProjectOpenSea/operator-filter-registry/blob/216e56095bee1018eeab8c528c84c59cf37a99e5/src/OperatorFilterRegistry.sol#L309). If I wanted to subscribe to a different "operator filterer" instead of the default (0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), how would I go about doing this? From what I gathered it should be implemented something like this:
subscribe
import "https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol"; import "https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/RevokableOperatorFilterer.sol"; contract ExampleNFT is ERC721, ERC721Enumerable, RevokableOperatorFilterer { address public currentOperatorFiltererSubscriber = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() ERC721("ExampleNFT", "EXAMPLE") OperatorFilterer(currentOperatorFiltererSubscriber, true){} function setOperatorFiltererSubscriber(address _subscription) public onlyOwner { OPERATOR_FILTER_REGISTRY.unregister(address(this)); OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), _subscription); currentOperatorFiltererSubscriber = _subscription; } /** * Overrides */ function setApprovalForAll(address operator, bool approved) public override(IERC721, ERC721) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public override(IERC721, ERC721) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom(address from, address to, uint256 tokenId) public override(IERC721, ERC721) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId) public override(IERC721, ERC721) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override(IERC721, ERC721) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } function owner() public view virtual override (Ownable, RevokableOperatorFilterer) returns (address) { return Ownable.owner(); } }
According to the code, the
subscribe
method pushes an address onto the subscription stack (https://github.com/ProjectOpenSea/operator-filter-registry/blob/216e56095bee1018eeab8c528c84c59cf37a99e5/src/OperatorFilterRegistry.sol#L309). If I wanted to subscribe to a different "operator filterer" instead of the default (0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), how would I go about doing this? From what I gathered it should be implemented something like this: