修正一个碎片mint错误的bug

This commit is contained in:
cebgcontract 2022-08-15 14:55:15 +08:00
parent 4bfcaa9c6c
commit 6575db4c44
2 changed files with 73 additions and 7 deletions

View File

@ -146,7 +146,7 @@ contract MinterFactory is Ownable, Initializable, HasSignature {
ids.length == amounts.length, ids.length == amounts.length,
"MinterFactory: ids and amounts length mismatch" "MinterFactory: ids and amounts length mismatch"
); );
mint1155NFTBatch(to, ids, amounts, chip); mint1155NFTBatch(to, ids, amounts, shard);
} }
function mint721ByUser( function mint721ByUser(

View File

@ -36,9 +36,31 @@ contract UserMinterFactory is Ownable, Initializable {
uint256 startTime, uint256 startTime,
uint256 saltNonce, uint256 saltNonce,
bytes calldata signature bytes calldata signature
) external { ) external returns (bool success){
address to = _msgSender(); address to = _msgSender();
factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, hero); try factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, hero) {
return true;
} catch Error(string memory reason) {
bytes memory by;
factory.ignoreSignature(signature);
emit TokenMintFail(
to,
signature,
reason,
by
);
return false;
} catch (bytes memory lowLevelData) {
string memory reason;
emit TokenMintFail(
to,
signature,
reason,
lowLevelData
);
return false;
}
} }
/** /**
@ -49,9 +71,31 @@ contract UserMinterFactory is Ownable, Initializable {
uint256 startTime, uint256 startTime,
uint256 saltNonce, uint256 saltNonce,
bytes calldata signature bytes calldata signature
) external { ) external returns (bool success){
address to = _msgSender(); address to = _msgSender();
factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, equip); try factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, equip) {
return true;
} catch Error(string memory reason) {
bytes memory by;
factory.ignoreSignature(signature);
emit TokenMintFail(
to,
signature,
reason,
by
);
return false;
} catch (bytes memory lowLevelData) {
string memory reason;
emit TokenMintFail(
to,
signature,
reason,
lowLevelData
);
return false;
}
} }
/** /**
@ -102,9 +146,31 @@ contract UserMinterFactory is Ownable, Initializable {
uint256 startTime, uint256 startTime,
uint256 saltNonce, uint256 saltNonce,
bytes calldata signature bytes calldata signature
) external { ) external returns (bool success){
address to = _msgSender(); address to = _msgSender();
factory.mint1155BatchByUser(to, ids, amounts, startTime, saltNonce, signature, shard); try factory.mint1155BatchByUser(to, ids, amounts, startTime, saltNonce, signature, shard) {
return true;
} catch Error(string memory reason) {
bytes memory by;
factory.ignoreSignature(signature);
emit TokenMintFail(
to,
signature,
reason,
by
);
return false;
} catch (bytes memory lowLevelData) {
string memory reason;
emit TokenMintFail(
to,
signature,
reason,
lowLevelData
);
return false;
}
} }
} }