Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Get errors when adding ERC721EnumerableUpgradeable in the Example Contract #72

Open
Olive-l opened this issue Dec 7, 2022 · 2 comments

Comments

@Olive-l
Copy link

Olive-l commented Dec 7, 2022

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
Copy link
Author

Olive-l commented Dec 7, 2022

btw, if I removed the ERC721EnumerableUpgradeable, everything works fine

@Alfa11917676
Copy link

Alfa11917676 commented Mar 9, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants