增加用户claim次数限制
This commit is contained in:
parent
8d64de35b6
commit
d16b89c6f1
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user