Skip to content

Commit

Permalink
📝 Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
transmissions11 committed Feb 9, 2024
1 parent 3d4fcb2 commit 8cd38ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/TransientReentrancyGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ abstract contract TransientReentrancyGuard {
assembly {
noReentrancy := iszero(tload(REENTRANCY_GUARD_SLOT))

// Any non-zero value would work, but
// ADDRESS is cheap and certainly not 0.
tstore(REENTRANCY_GUARD_SLOT, address())
}

Expand All @@ -25,6 +27,9 @@ abstract contract TransientReentrancyGuard {

/// @solidity memory-safe-assembly
assembly {
// Need to set back to zero, as transient
// storage is only cleared at the end of the
// tx, not the end of the outermost call frame.
tstore(REENTRANCY_GUARD_SLOT, 0)
}
}
Expand Down

0 comments on commit 8cd38ab

Please sign in to comment.