修改claimfactory限额的实现方式
This commit is contained in:
parent
b2424f4bd1
commit
93b9dd1607
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -6,12 +6,13 @@ import "../utils/TimeChecker.sol";
|
||||
|
||||
interface IClaimBox {
|
||||
function mint(address to) external returns (uint256);
|
||||
|
||||
function balanceOf(address owner) external view returns (uint256);
|
||||
}
|
||||
|
||||
contract ClaimBoxFactory is HasSignature, TimeChecker {
|
||||
address public executor;
|
||||
mapping(address => bool) public tokenSupported;
|
||||
mapping(address => uint256) public claimHistory;
|
||||
|
||||
event BoxClaimed(
|
||||
address indexed nftAddress,
|
||||
@ -47,8 +48,8 @@ contract ClaimBoxFactory is HasSignature, TimeChecker {
|
||||
require(tokenSupported[nftAddress], "ClaimBoxFactory: unsupported NFT");
|
||||
address to = _msgSender();
|
||||
require(
|
||||
claimHistory[to] == 0,
|
||||
"ClaimBoxFactory: you have claimed this NFT"
|
||||
IClaimBox(nftAddress).balanceOf(to) == 0,
|
||||
"ClaimBoxFactory: you already have a box"
|
||||
);
|
||||
bytes32 criteriaMessageHash = getMessageHash(
|
||||
to,
|
||||
@ -59,7 +60,6 @@ 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