Skip to content

Commit

Permalink
feat: delete ownerMint setBaseURI functions #MRN1183
Browse files Browse the repository at this point in the history
  • Loading branch information
David Adamyan authored and hideto13 committed Mar 2, 2023
1 parent c34417f commit 450ee74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 95 deletions.
41 changes: 0 additions & 41 deletions contracts/MetarunLaunch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ contract MetarunLaunch is Ownable, ReentrancyGuard {
using ECDSA for bytes32;

error CannotIncreaseMaxMintableSupply();
error CannotUpdatePermanentBaseURI();
error CosignerNotSet();
error GlobalWalletLimitOverflow();
error InsufficientStageTimeGap();
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand Down
54 changes: 0 additions & 54 deletions test/MetarunLaunch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 450ee74

Please sign in to comment.