开箱子时增加一些简单判断

This commit is contained in:
cebgcontract 2022-04-21 19:05:35 +08:00
parent a068fda5da
commit a1984c873d

View File

@ -73,11 +73,19 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
uint256 saltNonce,
bytes calldata signature
) external {
require(
ids.length == 3,
"MysteryBoxProxy: amount of token id mismatch"
);
require(
!usedSignatures[signature],
"MysteryBoxProxy: signature used. please send another transaction with new signature"
);
address owner = msg.sender;
require(
box.ownerOf(boxId) == owner,
"MysteryBoxProxy: only owner can open this box"
);
bytes32 criteriaMessageHash = getMessageHash(
boxId,
ids[0],
@ -89,7 +97,7 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
// open box
box.burn(owner, boxId);
usedSignatures[signature] = true;
uint256[3] memory results = [ids[0], 0, 0];
uint8[3] memory types = [TYPE_HERO, TYPE_NONE, TYPE_NONE];
mint721WithType(owner, ids[0], types[0]);