Skip to content

Commit

Permalink
perf: cache the royalty schedule sload
Browse files Browse the repository at this point in the history
  • Loading branch information
kulkarohan committed Jun 15, 2023
1 parent 13210ae commit 415375a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ERC721Drop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,8 @@ contract ERC721Drop is
}

function _mintSupplyRoyalty(uint256 mintQuantity) internal {
if (royaltyMintSchedule == 0) {
uint32 royaltySchedule = royaltyMintSchedule;
if (royaltySchedule == 0) {
return;
}

Expand All @@ -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);
Expand Down

0 comments on commit 415375a

Please sign in to comment.