Can't use royaltyInfo in my ERC721Royalty contract

I have a smart contract that inherits from ERC721Royalty. I wanted to use royaltyInfo function but I am getting an error saying DeclarationError: Undeclared identifier. Did you mean "RoyaltyInfo"?. This is because royaltyInfo is an external function. But I need to get the royalty information within my smart contract so I can record payments' to the royalty receivers. I've tried to change the function type from external to public but since it is imported as import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol"; remix IDE converts back to external.

please use EIP2981 interface

EIP2981.sol should declare royaltyInfo as a public function if you are using the OZ npm contract package as is.

1 Like

I have done that but the royaltyInfo in my imported ERC2981.sol is external. I am using remix. Why is that?

PS: This is how I import in Remix IDE:

pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/common/ERC2981.sol";

UPDATE: I've also specified the openzeppelin version and imported as below but the result is the same:

import "@openzeppelin/contracts@4.5.0/token/common/ERC2981.sol";