fixed overriden baseURI method

This commit is contained in:
miguelToscano 2022-10-12 16:37:46 -03:00
parent 9ef259d559
commit 5eccdf550d
7 changed files with 29 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{ {
"_format": "hh-sol-dbg-1", "_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/61ddbb77dee8171ab2d4d43d1019f3d7.json" "buildInfo": "../../build-info/deacee61599c1f085ffc184389eb5257.json"
} }

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,8 @@
"_format": "hh-sol-cache-2", "_format": "hh-sol-cache-2",
"files": { "files": {
"/Users/migue/Documents/psychedelic/sites_nfts/contracts/SitesNFTs.sol": { "/Users/migue/Documents/psychedelic/sites_nfts/contracts/SitesNFTs.sol": {
"lastModificationDate": 1665602082122, "lastModificationDate": 1665603388092,
"contentHash": "81aa3743aebd845356c61c22e8bdaca5", "contentHash": "c57c867981733de03ddf2137bf22210d",
"sourceName": "contracts/SitesNFTs.sol", "sourceName": "contracts/SitesNFTs.sol",
"solcConfig": { "solcConfig": {
"version": "0.8.7", "version": "0.8.7",

View File

@ -47,6 +47,10 @@ contract SitesNFTs is ERC721URIStorage, AccessControl {
return _tokenIds.current(); return _tokenIds.current();
} }
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
receive() external payable {} receive() external payable {}
fallback() external {} fallback() external {}

View File

@ -201,7 +201,7 @@ describe("SitesNFTs contract", function () {
const SitesNFTs = await ethers.getContractFactory("SitesNFTs"); const SitesNFTs = await ethers.getContractFactory("SitesNFTs");
const hardhatSitesNFTs = await SitesNFTs.deploy("Sites NFTs", "SNFT"); const hardhatSitesNFTs = await SitesNFTs.deploy("Sites NFTs", "SNFT");
const tokenURI = "tokenURI"; const tokenURI = "tokenURI";
try { try {
@ -212,5 +212,23 @@ describe("SitesNFTs contract", function () {
expect(balance).to.equal(0); expect(balance).to.equal(0);
}); });
it("Minted NFT should have data:application/json;base64, baseURI", async () => {
const [owner, address1] = await ethers.getSigners();
const SitesNFTs = await ethers.getContractFactory("SitesNFTs");
const hardhatSitesNFTs = await SitesNFTs.deploy("Sites NFTs", "SNFT");
const tokenURI = "tokenURI";
await hardhatSitesNFTs.mint(tokenURI, await address1.getAddress());
const mintedNFT = await hardhatSitesNFTs.tokenURI(0);
console.log(mintedNFT);
expect(mintedNFT.includes("data:application/json;base64,")).to.equal(true);
});
}) })
}); });