From c8c67ff227498a32809f657fa9d8dcd780619bfd Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Thu, 4 Aug 2022 14:52:25 +0800 Subject: [PATCH] =?UTF-8?q?1155=E8=8A=AF=E7=89=87mint=E6=97=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/chip1155/BEChipFactory.sol | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contracts/chip1155/BEChipFactory.sol b/contracts/chip1155/BEChipFactory.sol index 432d86d..dd59f74 100644 --- a/contracts/chip1155/BEChipFactory.sol +++ b/contracts/chip1155/BEChipFactory.sol @@ -22,9 +22,14 @@ interface IMintableERC1155 is IERC1155 { ) external; } +interface IBurnableERC721 is IERC721 { + function burn(address owner, uint256 tokenId) external; +} + contract BEChipFactory is Ownable, Initializable, HasSignature { IMintableERC1155 public chip; + IBurnableERC721 public chipOld; address public executor; @@ -59,7 +64,8 @@ contract BEChipFactory is Ownable, Initializable, HasSignature { address to, uint256[] memory ids ) external onlyOwner { - require(to != address(0), "to address can not be zero"); + require(to != address(0), "BEChipFactory: to address can not be zero"); + require(ids.length > 0, "BEChipFactory: ids cannot be empty"); uint256[] memory amounts = new uint256[](ids.length); uint256 len = ids.length; for (uint256 i = 0; i < len; ++i) { @@ -74,6 +80,11 @@ contract BEChipFactory is Ownable, Initializable, HasSignature { uint256 saltNonce, bytes calldata signature ) external{ + require(ids.length > 0, "BEChipFactory: ids cannot be empty"); + require( + !usedSignatures[signature], + "BEChipFactory: signature used. please send another transaction with new signature" + ); address to = _msgSender(); bytes32 criteriaMessageHash = getMessageHash( to,