From 450ee74d59433ac3054a37385e8e53b76961522a Mon Sep 17 00:00:00 2001 From: David Adamyan Date: Tue, 28 Feb 2023 14:49:15 +0400 Subject: [PATCH] feat: delete ownerMint setBaseURI functions #MRN1183 --- contracts/MetarunLaunch.sol | 41 ---------------------------- test/MetarunLaunch.test.ts | 54 ------------------------------------- 2 files changed, 95 deletions(-) diff --git a/contracts/MetarunLaunch.sol b/contracts/MetarunLaunch.sol index 0d8156e5..96218dbf 100644 --- a/contracts/MetarunLaunch.sol +++ b/contracts/MetarunLaunch.sol @@ -18,7 +18,6 @@ contract MetarunLaunch is Ownable, ReentrancyGuard { using ECDSA for bytes32; error CannotIncreaseMaxMintableSupply(); - error CannotUpdatePermanentBaseURI(); error CosignerNotSet(); error GlobalWalletLimitOverflow(); error InsufficientStageTimeGap(); @@ -61,17 +60,12 @@ contract MetarunLaunch is Ownable, ReentrancyGuard { event SetMaxMintableSupply(uint256 maxMintableSupply); event SetGlobalWalletLimit(uint256 globalWalletLimit); event SetActiveStage(uint256 activeStage); - event SetBaseURI(string baseURI); event SetTimestampExpirySeconds(uint64 expiry); - event PermanentBaseURI(string baseURI); event Withdraw(uint256 value); // 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; @@ -84,9 +78,6 @@ contract MetarunLaunch is Ownable, ReentrancyGuard { // Global wallet limit, across all stages. uint256 private _globalWalletLimit; - // Current base URI. - string private _currentBaseURI; - // ERC1155 token of the collection on sale MetarunCollection private _collection; @@ -489,20 +480,6 @@ contract MetarunLaunch is Ownable, ReentrancyGuard { totalMinted += qtyMinted; } - /** - * @dev Mints token(s) by owner. - * - * NOTE: This function bypasses validations thus only available for owner. - * This is typically used for owner to pre-mint or mint the remaining of the supply. - */ - function ownerMint(uint32 qty, address to) - external - onlyOwner - hasSupply(qty) - { - //_safeMint(to, qty); - } - /** * @dev Withdraws funds by owner. */ @@ -513,24 +490,6 @@ contract MetarunLaunch is Ownable, ReentrancyGuard { emit Withdraw(value); } - /** - * @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 Returns data hash for the given minter, qty and timestamp. */ diff --git a/test/MetarunLaunch.test.ts b/test/MetarunLaunch.test.ts index d3df5b70..5baa0fb9 100644 --- a/test/MetarunLaunch.test.ts +++ b/test/MetarunLaunch.test.ts @@ -1288,60 +1288,6 @@ describe('MetarunLaunch', function () { }); await expect(mint).to.be.revertedWith('InvalidProof'); }); - - it('mints by owner', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 1, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 1, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - ]); - await contract.setMintable(true); - - const [owner, address1] = await ethers.getSigners(); - - await contract.ownerMint(5, owner.address); - - const [, walletMintedCount, stagedMintedCount] = - await contract.getStageInfo(0); - expect(walletMintedCount).to.equal(0); - expect(stagedMintedCount.toNumber()).to.equal(0); - // todo: need to check resulting balance of ERC1155 - // const ownerBalance = await contract.balanceOf(owner.address); - // expect(ownerBalance.toNumber()).to.equal(5); - - await contract.ownerMint(5, address1.address); - const [, address1Minted] = await readonlyContract.getStageInfo(0, { - from: address1.address, - }); - expect(address1Minted).to.equal(0); - - // todo: need to check resulting balance of ERC1155 - // const address1Balance = await contract.balanceOf(address1.address); - // expect(address1Balance.toNumber()).to.equal(5); - expect((await contract.totalMinted()).toNumber()).to.equal(10); - }); - - it('mints by owner - invalid cases', async () => { - await contract.setStages([ - { - price: ethers.utils.parseEther('0.5'), - walletLimit: 1, - merkleRoot: ethers.utils.hexZeroPad('0x1', 32), - maxStageSupply: 1, - startTimeUnixSeconds: 0, - endTimeUnixSeconds: 1, - }, - ]); - await contract.setMintable(true); - await expect( - contract.ownerMint(1001, readonly.address), - ).to.be.revertedWith('NoSupplyLeft'); - }); }); describe('Global wallet limit', function () {