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