Hi, question about burning NFT (openzeppeling):
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
...
function burn(uint256 tokenId) public virtual override {
console.log(ownerOf(tokenId)); //using hardhat console log for debugging in .sol files
super.burn(tokenId);
}
then during tests
const owner = await contr.ownerOf(testTokenId)
console.log("owner ", owner, "account3 ", account3.address)
await contr.connect(account3).burn(testTokenId)
So I can see the owner and account3 are the same however when I call the burn
function as in the test, I get the error
Error: VM Exception while processing transaction: reverted with reason string 'Ownable: caller is not the owner'
at Contr.getApproved (@openzeppelin/contracts/token/ERC721/ERC721.sol:127)
How come the token owner cannot burn their own token?