From efb2ee42470a60c0b793fb72f68686f910454aa5 Mon Sep 17 00:00:00 2001 From: Yannick Spreen Date: Mon, 20 Dec 2021 01:01:04 +0100 Subject: [PATCH] Make base uri final after minting. --- contracts/NFT/NFT_REVEAL.sol | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/contracts/NFT/NFT_REVEAL.sol b/contracts/NFT/NFT_REVEAL.sol index 39a5f50..b449c2d 100644 --- a/contracts/NFT/NFT_REVEAL.sol +++ b/contracts/NFT/NFT_REVEAL.sol @@ -21,7 +21,7 @@ import "@openzeppelin/contracts/access/Ownable.sol"; contract NFT is ERC721Enumerable, Ownable { using Strings for uint256; - string public baseURI; + string public baseURI = ""; string public baseExtension = ".json"; uint256 public cost = 0.05 ether; uint256 public maxSupply = 10000; @@ -34,10 +34,8 @@ contract NFT is ERC721Enumerable, Ownable { constructor( string memory _name, string memory _symbol, - string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { - setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); mint(msg.sender, 20); } @@ -102,10 +100,12 @@ contract NFT is ERC721Enumerable, Ownable { } //only owner - function reveal() public onlyOwner { - revealed = true; + function reveal(string memory _finalBaseURI) public onlyOwner { + require(revealed == false); + baseURI = _finalBaseURI; + revealed = true; } - + function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } @@ -118,10 +118,6 @@ contract NFT is ERC721Enumerable, Ownable { notRevealedUri = _notRevealedURI; } - function setBaseURI(string memory _newBaseURI) public onlyOwner { - baseURI = _newBaseURI; - } - function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; }