I'm new to solidity and just confused about the return value of a uint from my deployed contract I have written the contract like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// import ERC721 standard
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
// inherit from the ERC721 library to make it compliant
contract NFT is ERC721URIStorage {
// keep track of tokens created also works as the a tokenID whenever a new token is minted
uint public tokenCount;
constructor() ERC721("EOR NFT", "EOR"){}
function mint(string memory _tokenURI) external returns(uint){
tokenCount += 1;
// msg.sender comes from the ingerited ERC721 contract and is the wallet address of the
// account that is calling this function.
_safeMint(msg.sender, tokenCount);
_setTokenURI(tokenCount, _tokenURI);
return(tokenCount);
}
}
and have deployed successfully to a local blockchain using hardhat, to test it I us hardhad console and grab the contract and public tokenCount with this:
const contract = await ethers.getContractAt("NFT", "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707");
const tokenCount = await contract.tokenCount();
tokenCount
I'm expecting it to give me:
BigNumber {Value:"0"}
but its giving me this:
BigNumber { _hex: '0x01', _isBigNumber: true }
How do I get a normal number from my contract and not that wierd _hex value?
thanks team!