Skip to content

Commit

Permalink
Merge pull request #71 from PaintSwap/promotions_exception_handler_mi…
Browse files Browse the repository at this point in the history
…nt_failure

Ignore mint failures for the promotions
  • Loading branch information
0xSamWitch authored Jul 3, 2024
2 parents 192bbaf + a704ead commit 22887a4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions contracts/Promotions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ contract Promotions is UUPSUpgradeable, OwnableUpgradeable {

userPromotionsClaimed[_to].set(uint8(Promotion.STARTER));

itemNFT.mintBatch(_to, itemTokenIds, amounts);
try itemNFT.mintBatch(_to, itemTokenIds, amounts) {} catch {
assembly ("memory-safe") {
mstore(itemTokenIds, 0)
mstore(amounts, 0)
}
}

for (uint i; i < daysToSet.length; ++i) {
daysToSet[i] = FINAL_PROMOTION_DAY_INDEX;
Expand Down Expand Up @@ -224,7 +229,12 @@ contract Promotions is UUPSUpgradeable, OwnableUpgradeable {
daysToSet[i] = FINAL_PROMOTION_DAY_INDEX;
}

itemNFT.mintBatch(_to, itemTokenIds, amounts);
try itemNFT.mintBatch(_to, itemTokenIds, amounts) {} catch {
assembly ("memory-safe") {
mstore(itemTokenIds, 0)
mstore(amounts, 0)
}
}
emit PromotionRedeemedV2(_to, _playerId, _promotion, _redeemCode, itemTokenIds, amounts, daysToSet, 0, 0, 0);
}

Expand Down

0 comments on commit 22887a4

Please sign in to comment.