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

Make ERC1155 uri() function public instead external #2574

Closed
peak3d opened this issue Mar 8, 2021 · 0 comments · Fixed by #2576
Closed

Make ERC1155 uri() function public instead external #2574

peak3d opened this issue Mar 8, 2021 · 0 comments · Fixed by #2576

Comments

@peak3d
Copy link

peak3d commented Mar 8, 2021

uri() function in ERC1155.sol is declared external and subclasses overriding uri() cannot call super.uri().

💻 Environment

hardhat

📝 Details

When overwriting uri() implemented here:

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol#L58

it is not possible to call super.uri() because of the external "modifier". uri() is the only way to access the _uri private member in ERC1155.sol which is set in ctor.

🔢 Code to reproduce bug

contract test is ERC1155 {
function uri(uint256 tokenId) external view virtual override returns (string memory) {
// return URI for special cases
//fallback:
return super.uri(). <- compilation failed because uri() can only be called from external
}

@Amxx Amxx mentioned this issue Mar 8, 2021
1 task
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

Successfully merging a pull request may close this issue.

1 participant