diff --git a/contracts/ERC721CM.sol b/contracts/ERC721CM.sol index f551a47..e3b797b 100644 --- a/contracts/ERC721CM.sol +++ b/contracts/ERC721CM.sol @@ -29,9 +29,6 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { // Whether this contract is mintable. bool private _mintable; - // Whether base URI is permanent. Once set, base URI is immutable. - bool private _baseURIPermanent; - // Specify how long a signature from cosigner is valid for, recommend 300 seconds. uint64 private _timestampExpirySeconds; @@ -161,12 +158,9 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { * ] */ function setStages(MintStageInfo[] calldata newStages) external onlyOwner { - uint256 originalSize = _mintStages.length; - for (uint256 i = 0; i < originalSize; i++) { - _mintStages.pop(); - } + delete _mintStages; - for (uint256 i = 0; i < newStages.length; i++) { + for (uint256 i = 0; i < newStages.length;) { if (i >= 1) { if ( newStages[i].startTimeUnixSeconds < @@ -199,6 +193,8 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { newStages[i].startTimeUnixSeconds, newStages[i].endTimeUnixSeconds ); + + unchecked { ++i; } } } @@ -288,50 +284,6 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { return (_mintStages[index], walletMinted, stageMinted); } - /** - * @dev Updates info for one stage specified by index (starting from 0). - */ - function updateStage( - uint256 index, - uint80 price, - uint32 walletLimit, - bytes32 merkleRoot, - uint24 maxStageSupply, - uint64 startTimeUnixSeconds, - uint64 endTimeUnixSeconds - ) external onlyOwner { - if (index >= _mintStages.length) revert InvalidStage(); - if (index >= 1) { - if ( - startTimeUnixSeconds < - _mintStages[index - 1].endTimeUnixSeconds + - _timestampExpirySeconds - ) { - revert InsufficientStageTimeGap(); - } - } - _assertValidStartAndEndTimestamp( - startTimeUnixSeconds, - endTimeUnixSeconds - ); - _mintStages[index].price = price; - _mintStages[index].walletLimit = walletLimit; - _mintStages[index].merkleRoot = merkleRoot; - _mintStages[index].maxStageSupply = maxStageSupply; - _mintStages[index].startTimeUnixSeconds = startTimeUnixSeconds; - _mintStages[index].endTimeUnixSeconds = endTimeUnixSeconds; - - emit UpdateStage( - index, - price, - walletLimit, - merkleRoot, - maxStageSupply, - startTimeUnixSeconds, - endTimeUnixSeconds - ); - } - /** * @dev Returns mint currency address. */ @@ -512,19 +464,10 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { * @dev Sets token base URI. */ function setBaseURI(string calldata baseURI) external onlyOwner { - if (_baseURIPermanent) revert CannotUpdatePermanentBaseURI(); _currentBaseURI = baseURI; emit SetBaseURI(baseURI); } - /** - * @dev Sets token base URI permanent. Cannot revert. - */ - function setBaseURIPermanent() external onlyOwner { - _baseURIPermanent = true; - emit PermanentBaseURI(_currentBaseURI); - } - /** * @dev Sets token URI suffix. e.g. ".json". */ @@ -614,13 +557,14 @@ contract ERC721CM is IERC721M, ERC721ACQueryable, Ownable, ReentrancyGuard { function getActiveStageFromTimestamp( uint64 timestamp ) public view returns (uint256) { - for (uint256 i = 0; i < _mintStages.length; i++) { + for (uint256 i = 0; i < _mintStages.length;) { if ( timestamp >= _mintStages[i].startTimeUnixSeconds && timestamp < _mintStages[i].endTimeUnixSeconds ) { return i; } + unchecked { ++i; } } revert InvalidStage(); } diff --git a/contracts/ERC721M.sol b/contracts/ERC721M.sol index 75e45d7..722edf5 100644 --- a/contracts/ERC721M.sol +++ b/contracts/ERC721M.sol @@ -284,50 +284,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { return (_mintStages[index], walletMinted, stageMinted); } - /** - * @dev Updates info for one stage specified by index (starting from 0). - */ - function updateStage( - uint256 index, - uint80 price, - uint32 walletLimit, - bytes32 merkleRoot, - uint24 maxStageSupply, - uint64 startTimeUnixSeconds, - uint64 endTimeUnixSeconds - ) external onlyOwner { - if (index >= _mintStages.length) revert InvalidStage(); - if (index >= 1) { - if ( - startTimeUnixSeconds < - _mintStages[index - 1].endTimeUnixSeconds + - _timestampExpirySeconds - ) { - revert InsufficientStageTimeGap(); - } - } - _assertValidStartAndEndTimestamp( - startTimeUnixSeconds, - endTimeUnixSeconds - ); - _mintStages[index].price = price; - _mintStages[index].walletLimit = walletLimit; - _mintStages[index].merkleRoot = merkleRoot; - _mintStages[index].maxStageSupply = maxStageSupply; - _mintStages[index].startTimeUnixSeconds = startTimeUnixSeconds; - _mintStages[index].endTimeUnixSeconds = endTimeUnixSeconds; - - emit UpdateStage( - index, - price, - walletLimit, - merkleRoot, - maxStageSupply, - startTimeUnixSeconds, - endTimeUnixSeconds - ); - } - /** * @dev Returns mint currency address. */ @@ -508,19 +464,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard { * @dev Sets token base URI. */ function setBaseURI(string calldata baseURI) external onlyOwner { - if (_baseURIPermanent) revert CannotUpdatePermanentBaseURI(); _currentBaseURI = baseURI; emit SetBaseURI(baseURI); } - /** - * @dev Sets token base URI permanent. Cannot revert. - */ - function setBaseURIPermanent() external onlyOwner { - _baseURIPermanent = true; - emit PermanentBaseURI(_currentBaseURI); - } - /** * @dev Sets token URI suffix. e.g. ".json". */ diff --git a/contracts/IERC721M.sol b/contracts/IERC721M.sol index 2ee94e6..78f8990 100644 --- a/contracts/IERC721M.sol +++ b/contracts/IERC721M.sol @@ -5,7 +5,6 @@ import "erc721a/contracts/extensions/IERC721AQueryable.sol"; interface IERC721M is IERC721AQueryable { error CannotIncreaseMaxMintableSupply(); - error CannotUpdatePermanentBaseURI(); error CosignerNotSet(); error CrossmintAddressNotSet(); error CrossmintOnly(); @@ -56,7 +55,6 @@ interface IERC721M is IERC721AQueryable { event SetBaseURI(string baseURI); event SetTimestampExpirySeconds(uint64 expiry); event SetMintCurrency(address mintCurrency); - event PermanentBaseURI(string baseURI); event Withdraw(uint256 value); event WithdrawERC20(address mintCurrency, uint256 value); diff --git a/test/ERC721CM.test.ts b/test/ERC721CM.test.ts index 2b848ed..2f9abc1 100644 --- a/test/ERC721CM.test.ts +++ b/test/ERC721CM.test.ts @@ -281,202 +281,6 @@ describe('ERC721CM', function () { expect(walletMintedCount).to.equal(0); }); - it('can update stage', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - expect(await contract.getNumberStages()).to.equal(2); - - let [stageInfo, walletMintedCount] = await contract.getStageInfo(0); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.5')); - expect(stageInfo.walletLimit).to.equal(3); - expect(stageInfo.maxStageSupply).to.equal(5); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x1', 32)); - expect(walletMintedCount).to.equal(0); - - [stageInfo, walletMintedCount] = await contract.getStageInfo(1); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.6')); - expect(stageInfo.walletLimit).to.equal(4); - expect(stageInfo.maxStageSupply).to.equal(10); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x2', 32)); - expect(walletMintedCount).to.equal(0); - - // Update first stage - await expect( - contract.updateStage( - /* _index= */ 0, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 1, - ), - ) - .to.emit(contract, 'UpdateStage') - .withArgs( - 0, - ethers.utils.parseEther('0.1'), - 13, - ethers.utils.hexZeroPad('0x9', 32), - 15, - 0, - 1, - ); - - expect(await contract.getNumberStages()).to.equal(2); - - [stageInfo, walletMintedCount] = await contract.getStageInfo(0); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.1')); - expect(stageInfo.walletLimit).to.equal(13); - expect(stageInfo.maxStageSupply).to.equal(15); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x9', 32)); - expect(walletMintedCount).to.equal(0); - - // Stage 2 is unchanged. - [stageInfo, walletMintedCount] = await contract.getStageInfo(1); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.6')); - expect(stageInfo.walletLimit).to.equal(4); - expect(stageInfo.maxStageSupply).to.equal(10); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x2', 32)); - expect(walletMintedCount).to.equal(0); - }); - - it('updates stage reverts for non-existent stage', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Update a stage which doesn't exist. - const updateStage = contract.updateStage( - /* _index= */ 2, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 0, - ); - - await expect(updateStage).to.be.revertedWith('InvalidStage'); - }); - - it('cannot update stage to insufficient stage gap', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Set stage 1 to only be 59 seconds from stage 2 - const updateStage = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 2, - ); - - await expect(updateStage).to.be.revertedWith('InsufficientStageTimeGap'); - }); - - it('cannot update stage due to the startTimeUnixSeconds is not smaller than the endTimeUnixSeconds', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Update stage 1 and set startTimeUnixSeconds and endTimeUnixSeconds to identical values - const updateStageWithIdenticalStartAndEndTime = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 61, - /* endTimeUnixSeconds= */ 61, - ); - - await expect(updateStageWithIdenticalStartAndEndTime).to.be.revertedWith( - 'InvalidStartAndEndTimestamp', - ); - - // Update stage 1 and set startTimeUnixSeconds to a value which is not smaller than the endTimeUnixSeconds - const updateStageWithStartTimeAfterEndTime = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 61, - /* endTimeUnixSeconds= */ 60, - ); - - await expect(updateStageWithStartTimeAfterEndTime).to.be.revertedWith( - 'InvalidStartAndEndTimestamp', - ); - }); - it('gets stage info', async () => { await contract.setStages([ { @@ -1759,61 +1563,6 @@ describe('ERC721CM', function () { 'URIQueryForNonexistentToken', ); }); - - it('Returns should not be able to set baseURI once frozen', async () => { - const block = await ethers.provider.getBlock( - await ethers.provider.getBlockNumber(), - ); - // +10 is a number bigger than the count of transactions up to mint - const stageStart = block.timestamp + 10; - // Set stages - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 10, - merkleRoot: ethers.utils.hexZeroPad('0x0', 32), - maxStageSupply: 5, - startTimeUnixSeconds: stageStart, - endTimeUnixSeconds: stageStart + 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 10, - merkleRoot: ethers.utils.hexZeroPad('0x0', 32), - maxStageSupply: 10, - startTimeUnixSeconds: stageStart + 61, - endTimeUnixSeconds: stageStart + 62, - }, - ]); - - await contract.setBaseURI('base_uri_'); - await contract.setMintable(true); - - // Setup the test context: Update block.timestamp to comply to the stage being active - await ethers.provider.send('evm_mine', [stageStart - 1]); - await contract.mint(2, [ethers.utils.hexZeroPad('0x', 32)], 0, '0x00', { - value: ethers.utils.parseEther('2.5'), - }); - - expect(await contract.tokenURI(0)).to.equal('base_uri_0'); - expect(await contract.tokenURI(1)).to.equal('base_uri_1'); - - await contract.setBaseURI('base_uri_again_'); - expect(await contract.tokenURI(0)).to.equal('base_uri_again_0'); - - // readonlyContract should not be able to set baseURI - await expect( - readonlyContract.setBaseURI('something_else_'), - ).to.be.revertedWith('Ownable'); - - await expect(contract.setBaseURIPermanent()).to.emit( - contract, - 'PermanentBaseURI', - ); - await expect( - contract.setBaseURI('base_uri_again_again_'), - ).to.be.revertedWith('CannotUpdatePermanentBaseURI'); - }); }); describe('Global wallet limit', function () { diff --git a/test/erc721m.test.ts b/test/erc721m.test.ts index b46f0e0..418353f 100644 --- a/test/erc721m.test.ts +++ b/test/erc721m.test.ts @@ -285,202 +285,6 @@ describe('ERC721M', function () { expect(walletMintedCount).to.equal(0); }); - it('can update stage', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - expect(await contract.getNumberStages()).to.equal(2); - - let [stageInfo, walletMintedCount] = await contract.getStageInfo(0); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.5')); - expect(stageInfo.walletLimit).to.equal(3); - expect(stageInfo.maxStageSupply).to.equal(5); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x1', 32)); - expect(walletMintedCount).to.equal(0); - - [stageInfo, walletMintedCount] = await contract.getStageInfo(1); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.6')); - expect(stageInfo.walletLimit).to.equal(4); - expect(stageInfo.maxStageSupply).to.equal(10); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x2', 32)); - expect(walletMintedCount).to.equal(0); - - // Update first stage - await expect( - contract.updateStage( - /* _index= */ 0, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 1, - ), - ) - .to.emit(contract, 'UpdateStage') - .withArgs( - 0, - ethers.utils.parseEther('0.1'), - 13, - ethers.utils.hexZeroPad('0x9', 32), - 15, - 0, - 1, - ); - - expect(await contract.getNumberStages()).to.equal(2); - - [stageInfo, walletMintedCount] = await contract.getStageInfo(0); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.1')); - expect(stageInfo.walletLimit).to.equal(13); - expect(stageInfo.maxStageSupply).to.equal(15); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x9', 32)); - expect(walletMintedCount).to.equal(0); - - // Stage 2 is unchanged. - [stageInfo, walletMintedCount] = await contract.getStageInfo(1); - expect(stageInfo.price).to.equal(ethers.utils.parseEther('0.6')); - expect(stageInfo.walletLimit).to.equal(4); - expect(stageInfo.maxStageSupply).to.equal(10); - expect(stageInfo.merkleRoot).to.equal(ethers.utils.hexZeroPad('0x2', 32)); - expect(walletMintedCount).to.equal(0); - }); - - it('updates stage reverts for non-existent stage', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Update a stage which doesn't exist. - const updateStage = contract.updateStage( - /* _index= */ 2, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 0, - ); - - await expect(updateStage).to.be.revertedWith('InvalidStage'); - }); - - it('cannot update stage to insufficient stage gap', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Set stage 1 to only be 59 seconds from stage 2 - const updateStage = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 0, - /* endTimeUnixSeconds= */ 2, - ); - - await expect(updateStage).to.be.revertedWith('InsufficientStageTimeGap'); - }); - - it('cannot update stage due to the startTimeUnixSeconds is not smaller than the endTimeUnixSeconds', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 3, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 5, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 4, - merkleRoot: ethers.utils.hexZeroPad('0x2', 32), - maxStageSupply: 10, - startTimeUnixSeconds: 61, - endTimeUnixSeconds: 62, - }, - ]); - - // Update stage 1 and set startTimeUnixSeconds and endTimeUnixSeconds to identical values - const updateStageWithIdenticalStartAndEndTime = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 61, - /* endTimeUnixSeconds= */ 61, - ); - - await expect(updateStageWithIdenticalStartAndEndTime).to.be.revertedWith( - 'InvalidStartAndEndTimestamp', - ); - - // Update stage 1 and set startTimeUnixSeconds to a value which is not smaller than the endTimeUnixSeconds - const updateStageWithStartTimeAfterEndTime = contract.updateStage( - /* _index= */ 1, - /* price= */ ethers.utils.parseEther('0.1'), - /* walletLimit= */ 13, - /* merkleRoot= */ ethers.utils.hexZeroPad('0x9', 32), - /* maxStageSupply= */ 15, - /* startTimeUnixSeconds= */ 61, - /* endTimeUnixSeconds= */ 60, - ); - - await expect(updateStageWithStartTimeAfterEndTime).to.be.revertedWith( - 'InvalidStartAndEndTimestamp', - ); - }); - it('gets stage info', async () => { await contract.setStages([ { @@ -1757,61 +1561,6 @@ describe('ERC721M', function () { 'URIQueryForNonexistentToken', ); }); - - it('Returns should not be able to set baseURI once frozen', async () => { - const block = await ethers.provider.getBlock( - await ethers.provider.getBlockNumber(), - ); - // +10 is a number bigger than the count of transactions up to mint - const stageStart = block.timestamp + 10; - // Set stages - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 10, - merkleRoot: ethers.utils.hexZeroPad('0x0', 32), - maxStageSupply: 5, - startTimeUnixSeconds: stageStart, - endTimeUnixSeconds: stageStart + 1, - }, - { - price: ethers.utils.parseEther('0.6'), - walletLimit: 10, - merkleRoot: ethers.utils.hexZeroPad('0x0', 32), - maxStageSupply: 10, - startTimeUnixSeconds: stageStart + 61, - endTimeUnixSeconds: stageStart + 62, - }, - ]); - - await contract.setBaseURI('base_uri_'); - await contract.setMintable(true); - - // Setup the test context: Update block.timestamp to comply to the stage being active - await ethers.provider.send('evm_mine', [stageStart - 1]); - await contract.mint(2, [ethers.utils.hexZeroPad('0x', 32)], 0, '0x00', { - value: ethers.utils.parseEther('2.5'), - }); - - expect(await contract.tokenURI(0)).to.equal('base_uri_0'); - expect(await contract.tokenURI(1)).to.equal('base_uri_1'); - - await contract.setBaseURI('base_uri_again_'); - expect(await contract.tokenURI(0)).to.equal('base_uri_again_0'); - - // readonlyContract should not be able to set baseURI - await expect( - readonlyContract.setBaseURI('something_else_'), - ).to.be.revertedWith('Ownable'); - - await expect(contract.setBaseURIPermanent()).to.emit( - contract, - 'PermanentBaseURI', - ); - await expect( - contract.setBaseURI('base_uri_again_again_'), - ).to.be.revertedWith('CannotUpdatePermanentBaseURI'); - }); }); describe('Global wallet limit', function () {