From a704ead20ac23ef2f7aa61acd175fc4d8f64bd99 Mon Sep 17 00:00:00 2001 From: 0xSamWitch Date: Sat, 29 Jun 2024 12:06:14 +0100 Subject: [PATCH] Ignore mint failures for the promotions --- contracts/Promotions.sol | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/contracts/Promotions.sol b/contracts/Promotions.sol index 7ff8865e..c3be9af6 100644 --- a/contracts/Promotions.sol +++ b/contracts/Promotions.sol @@ -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; @@ -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); }