ProjectOpenSea / opensea-creatures

Example non-fungible collectible, to demonstrate OpenSea integration
https://docs.opensea.io
MIT License
1.17k stars 793 forks source link

Discrepancy Between OpenSea Creature's Code and OpenSea Polygon Documentation: Which is Correct? #184

Open devstein opened 2 years ago

devstein commented 2 years ago

Hi 👋 I'm working on an ERC-721 NFT and want to auto-approve OS's proxy contract, but there are discrepancies between the documentation and this repo. Which code is correct? See below. Thank you!

From Polygon integration docs

/**
   * Override isApprovedForAll to auto-approve OS's proxy contract
   */
    function isApprovedForAll(
        address _owner,
        address _operator
    ) public override view returns (bool isOperator) {
      // if OpenSea's ERC721 Proxy Address is detected, auto-return true
        if (_operator == address(0x58807baD0B376efc12F5AD86aAc70E78ed67deaE)) {
            return true;
        }

        // otherwise, use the default ERC721.isApprovedForAll()
        return ERC721.isApprovedForAll(_owner, _operator);
    }

From this repo's code

    /**
     * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
     */
    function isApprovedForAll(address owner, address operator)
        override
        public
        view
        returns (bool)
    {
        // Whitelist OpenSea proxy contract for easy trading.
        ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
        if (address(proxyRegistry.proxies(owner)) == operator) {
            return true;
        }

        return super.isApprovedForAll(owner, operator);
    }

Which approach is correct?

        if (_operator == address(0x58807baD0B376efc12F5AD86aAc70E78ed67deaE)) {
        ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
        if (address(proxyRegistry.proxies(owner)) == operator) {
FantasyGameFoundation commented 2 years ago

I also have the same question, and whenever I add proxy judgment logic, the factory contract cannot take effect, nor can mint

stpoa commented 2 years ago

@FantasyGameFoundation Hi have you solved the problem?