ProjectOpenSea / operator-filter-registry

MIT License
312 stars 93 forks source link

Get errors when adding ERC721EnumerableUpgradeable in the Example Contract #72

Open Olive-l opened 1 year ago

Olive-l commented 1 year ago

I am using the example upgradeable contact, and modify some code to add the ERC721EnumerableUpgradeable, like as blow: abstract contract ExampleERC721Upgradeable is ERC721Upgradeable, DefaultOperatorFiltererUpgradeable, OwnableUpgradeable, ERC721EnumerableUpgradeable and I override the functions of ERC721EnumerableUpgradeable accordingly. Then I will get the error message: Screen Shot 2022-12-07 at 15 03 06

The detail error message is :

`TypeError: Function needs to specify overridden contracts "ERC721Upgradeable" and "IERC721Upgradeable". --> contracts/TEST.sol:50:72: 50 function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval { ^^^^^^^^ Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:20:1:
20 contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
^ (Relevant source part starts here and spans across multiple lines).

Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol:11:1: | 11 | interface IERC721Upgradeable is IERC165Upgradeable { | ^ (Relevant source part starts here and spans across multiple lines).

TypeError: Function needs to specify overridden contracts "ERC721Upgradeable" and "IERC721Upgradeable". --> contracts/TEST.sol:54:64: 54 function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) { ^^^^^^^^ Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:20:1:
20 contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
^ (Relevant source part starts here and spans across multiple lines).

Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol:11:1: | 11 | interface IERC721Upgradeable is IERC165Upgradeable { | ^ (Relevant source part starts here and spans across multiple lines).

TypeError: Function needs to specify overridden contracts "ERC721Upgradeable" and "IERC721Upgradeable". --> contracts/TEST.sol:58:77: 58 function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { ^^^^^^^^ Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:20:1:
20 contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
^ (Relevant source part starts here and spans across multiple lines).

Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol:11:1: | 11 | interface IERC721Upgradeable is IERC165Upgradeable { | ^ (Relevant source part starts here and spans across multiple lines).

TypeError: Function needs to specify overridden contracts "ERC721Upgradeable" and "IERC721Upgradeable". --> contracts/TEST.sol:62:81: 62 function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { ^^^^^^^^ Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:20:1:
20 contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
^ (Relevant source part starts here and spans across multiple lines).

Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol:11:1: | 11 | interface IERC721Upgradeable is IERC165Upgradeable { | ^ (Relevant source part starts here and spans across multiple lines).

TypeError: Function needs to specify overridden contracts "ERC721Upgradeable" and "IERC721Upgradeable". --> contracts/TEST.sol:68:9: 68 override ^^^^^^^^ Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:20:1:
20 contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
^ (Relevant source part starts here and spans across multiple lines).

Note: This contract: --> @openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol:11:1: | 11 | interface IERC721Upgradeable is IERC165Upgradeable { | ^ (Relevant source part starts here and spans across multiple lines).

TypeError: Wrong argument count for modifier invocation: 0 arguments given but expected 1. --> contracts/TEST.sol:50:81: | 50 | function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `

Could somebody help me fix this? thx in advance!

Olive-l commented 1 year ago

btw, if I removed the ERC721EnumerableUpgradeable, everything works fine

Alfa11917676 commented 1 year ago

You can remove the import of IERC721Upgradeable from the IERC721EnumerableUpgradeable file, which is imported in ERC721Enumerable; instead of that import IERC165Upgradeable from @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol in IERC721EnumerableUpgradeable. This will help you solve your issue.