Skip to content

Commit

Permalink
cheaper revert in sendReservedTokensToSplitsOf, test was previously w…
Browse files Browse the repository at this point in the history
…ritten for this pattern
  • Loading branch information
simplemachine92 committed Apr 1, 2024
1 parent afa98c7 commit ab1581c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/JBController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,15 @@ contract JBController is JBPermissioned, ERC2771Context, ERC165, IJBController,
/// @param projectId The ID of the project the reserved tokens belong to.
/// @return tokenCount The number of reserved tokens minted/sent.
function _sendReservedTokensToSplitsOf(uint256 projectId) internal returns (uint256 tokenCount) {
// Get the current ruleset to read the reserved rate from.
JBRuleset memory ruleset = RULESETS.currentOf(projectId);

// Get a reference to the number of tokens that need to be minted.
tokenCount = pendingReservedTokenBalanceOf[projectId];

// Revert if there are no reserved tokens
if (tokenCount == 0) revert NO_RESERVED_TOKENS();

// Get the current ruleset to read the reserved rate from.
JBRuleset memory ruleset = RULESETS.currentOf(projectId);

// Reset the reserved token balance
pendingReservedTokenBalanceOf[projectId] = 0;

Expand Down

0 comments on commit ab1581c

Please sign in to comment.