Skip to content

Commit

Permalink
(circles): correct order of check and effect in _claimIssuance to pre…
Browse files Browse the repository at this point in the history
…vent reentrancy attack (patch 01)
  • Loading branch information
benjaminbollen committed Sep 25, 2024
1 parent 9f3a0df commit 1db4d65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/circles/Circles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ contract Circles is ERC1155, ICirclesErrors {
// No issuance to claim, simply return without reverting
return;
}
// mint personal Circles to the human
_mintAndUpdateTotalSupply(_human, toTokenId(_human), issuance, "");
// update the last mint time
// update the last mint time, before minting as mint time determines the check (guard for reeentrancy attack)
mintTimes[_human].lastMintTime = uint96(block.timestamp);

// mint personal Circles to the human; ERC1155 mint will perform acceptance call
_mintAndUpdateTotalSupply(_human, toTokenId(_human), issuance, "");

emit PersonalMint(_human, issuance, startPeriod, endPeriod);
}

Expand Down

0 comments on commit 1db4d65

Please sign in to comment.