From d16b89c6f14dc3b8234a003e24da14a4673b1f0c Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 14 Jun 2023 13:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7claim?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/activity/ClaimBoxFactory.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contracts/activity/ClaimBoxFactory.sol b/contracts/activity/ClaimBoxFactory.sol index a16b9da..f0be548 100644 --- a/contracts/activity/ClaimBoxFactory.sol +++ b/contracts/activity/ClaimBoxFactory.sol @@ -11,6 +11,7 @@ interface IClaimBox { contract ClaimBoxFactory is HasSignature, TimeChecker { address public executor; mapping(address => bool) public tokenSupported; + mapping(address => uint256) public claimHistory; event BoxClaimed( address indexed nftAddress, @@ -45,6 +46,10 @@ contract ClaimBoxFactory is HasSignature, TimeChecker { ) external signatureValid(signature) timeValid(startTime) { require(tokenSupported[nftAddress], "ClaimBoxFactory: unsupported NFT"); address to = _msgSender(); + require( + claimHistory[to] == 0, + "ClaimBoxFactory: you have claimed this NFT" + ); bytes32 criteriaMessageHash = getMessageHash( to, nftAddress, @@ -54,6 +59,7 @@ contract ClaimBoxFactory is HasSignature, TimeChecker { checkSigner(executor, criteriaMessageHash, signature); uint256 tokenId = IClaimBox(nftAddress).mint(to); _useSignature(signature); + claimHistory[to] = tokenId; emit BoxClaimed(nftAddress, to, saltNonce, tokenId); }