Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation of openzeppelin's ERC721 fails #136

Closed
asinyagin opened this issue Jan 14, 2022 · 8 comments
Closed

Compilation of openzeppelin's ERC721 fails #136

asinyagin opened this issue Jan 14, 2022 · 8 comments

Comments

@asinyagin
Copy link

I tried to compile NFT-contract based on ERC721 from openzeppelin, but it prints an error:

ubuntu@ubuntu-container:~/projects/nft-test1$ tronbox compile
Compiling ./contracts/NFT.sol...
Compiling @openzeppelin/contracts/token/ERC721/ERC721.sol...
Compiling @openzeppelin/contracts/token/ERC721/IERC721.sol...
Compiling @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol...
Compiling @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol...
Compiling @openzeppelin/contracts/utils/Address.sol...
Compiling @openzeppelin/contracts/utils/Context.sol...
Compiling @openzeppelin/contracts/utils/Strings.sol...
Compiling @openzeppelin/contracts/utils/introspection/ERC165.sol...
Compiling @openzeppelin/contracts/utils/introspection/IERC165.sol...

TypeError: Member "isContract" not unique after argument-dependent lookup in address.
   --> @openzeppelin/contracts/token/ERC721/ERC721.sol:388:13:
    |
388 |         if (to.isContract()) {
    |             ^^^^^^^^^^^^^
Compilation failed. See above.

Here's a repo with minimal code to reproduce the error https://github.com/asinyagin/nft-test1

I tried to compile it with solc 0.8.11, solcjs 0.8.6, truffle 5.3.29 and it works correctly.

Thank you!

@llwslc
Copy link
Contributor

llwslc commented Jan 17, 2022

isContract is a member of address type in tron-solidity. This conflicts with ether-solidity.
See more:
tronprotocol/tips#44

@llwslc llwslc closed this as completed Jan 17, 2022
@asinyagin
Copy link
Author

Oh, thank you! I've missed that info)

@dhruvja
Copy link

dhruvja commented Jul 30, 2023

isContract is a member of address type in tron-solidity. This conflicts with ether-solidity. See more: tronprotocol/tips#44

So how can this be solved. How can i fix this error?

@llwslc
Copy link
Contributor

llwslc commented Jul 31, 2023

@dhruvja

The code of isContract() in the library needs to be changed to isContract.

@dhruvja
Copy link

dhruvja commented Jul 31, 2023

@dhruvja

The code of isContract() in the library needs to be changed to isContract.

i changed it to isContract and still getting same error.

before:
if(to.isContract())

After:
if(to.isContract)

Still getting the same error. What am i doing wrong?

@llwslc
Copy link
Contributor

llwslc commented Aug 1, 2023

@dhruvja Try removing the isContract function from the @openzeppelin/contracts/utils/Address.sol file.

@dhruvja
Copy link

dhruvja commented Aug 2, 2023

@dhruvja Try removing the isContract function from the @openzeppelin/contracts/utils/Address.sol file.

there are many instances where isContract is used. Should it be changed everywhere?

For example, there were some in @openzeppelin/contracts/utils/Address.sol which i changed. But then i am getting error for other occurences too like in @openzeppelin/contracts/proxy/utils/Initializable.sol. What should i do?

@llwslc
Copy link
Contributor

llwslc commented Aug 2, 2023

RensR pushed a commit to smartcontractkit/ccip that referenced this issue Feb 14, 2024
## Motivation
Compiling the `EVM2EVMOffRamp` token implementation for
[TVM](https://developers.tron.network/v3.7/docs/virtual-machine-introduction)
fails with the following error:

```
TypeError: Member "isContract" not unique after argument-dependent lookup in address.
--> github/smartcontractkit/ccip/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol:438:8:
    |
438 | !message.receiver.isContract() || !message.receiver.supportsInterface(type(IAny2EVMMessageReceiver).interfaceId)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

See tronprotocol/tronbox#136 for more details.

## Solution

This change inlines the isContract() call to avoid ambiguity. Open
Zeppelin solves this issue similarly (see
https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3945/files).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants