From 415375a13dabf4fea05195926d4a27eb83239ca6 Mon Sep 17 00:00:00 2001 From: kulkarohan Date: Thu, 15 Jun 2023 11:35:17 -0400 Subject: [PATCH] perf: cache the royalty schedule sload --- src/ERC721Drop.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ERC721Drop.sol b/src/ERC721Drop.sol index afe894b..e083bdd 100644 --- a/src/ERC721Drop.sol +++ b/src/ERC721Drop.sol @@ -1282,7 +1282,8 @@ contract ERC721Drop is } function _mintSupplyRoyalty(uint256 mintQuantity) internal { - if (royaltyMintSchedule == 0) { + uint32 royaltySchedule = royaltyMintSchedule; + if (royaltySchedule == 0) { return; } @@ -1291,7 +1292,7 @@ contract ERC721Drop is return; } - uint256 totalRoyaltyMints = (mintQuantity + (_totalMinted() % royaltyMintSchedule)) / (royaltyMintSchedule - 1); + uint256 totalRoyaltyMints = (mintQuantity + (_totalMinted() % royaltySchedule)) / (royaltySchedule - 1); totalRoyaltyMints = MathUpgradeable.min(totalRoyaltyMints, config.editionSize - (mintQuantity + _totalMinted())); if (totalRoyaltyMints > 0) { _mintNFTs(royaltyRecipient, totalRoyaltyMints);