This commit is contained in:
zhl 2022-01-27 17:26:35 +08:00
parent d9f7889e06
commit 69b84e8277

View File

@ -13,7 +13,7 @@ contract MinterFactory is Ownable, Initializable {
IMintableERC721 public hero;
IMintableERC721 public equip;
IMintableERC721 public chip;
bool public publicMintAllowed;
event TokenMinted(
address contractAddress,
@ -30,8 +30,8 @@ contract MinterFactory is Ownable, Initializable {
/**
* @dev mint function to distribute Blissful Elites Hero NFT to user
*/
function mintHeroTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
function mintHeroTo(address to, uint256 tokenId) external onlyOwner{
require(to != address(0), 'to address can not be zero');
hero.mint(to, tokenId);
emit TokenMinted(address(hero), to, tokenId);
}
@ -39,8 +39,8 @@ contract MinterFactory is Ownable, Initializable {
/**
* @dev mint function to distribute Blissful Elites Equipment NFT to user
*/
function mintEquipTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
function mintEquipTo(address to, uint256 tokenId) external onlyOwner{
require(to != address(0), 'to address can not be zero');
equip.mint(to, tokenId);
emit TokenMinted(address(equip), to, tokenId);
}
@ -48,16 +48,10 @@ contract MinterFactory is Ownable, Initializable {
/**
* @dev mint function to distribute Blissful Elites Chip NFT to user
*/
function mintChipTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
function mintChipTo(address to, uint256 tokenId) external onlyOwner{
require(to != address(0), 'to address can not be zero');
chip.mint(to, tokenId);
emit TokenMinted(address(chip), to, tokenId);
}
/**
* @dev function to allow user mint items
*/
function allowPublicMint() public onlyOwner {
publicMintAllowed = true;
}
}