Skip to content
Lattice

ReentrancyGuard

Git Source

Title: ReentrancyGuard

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuardTransient.sol)

Companion mixin to ReentrancyGuardLib: exposes the guard as nonReentrant and nonReadReentrant modifiers so facets inherit reentrancy protection instead of hand-rolling the entry()/exit() pair.

Transient-storage variant on Ethereum mainnet, plain-SSTORE guard everywhere else (the lib bakes in Solady's default; the per-contract virtual _useTransientReentrancyGuardOnlyOnMainnet() hook is dropped — library functions cannot see contract-level overrides). Stateless — adds no storage and no selectors, safe to mix into any facet. All facets sharing one diamond share one lock, which is exactly the cross-facet protection wanted.

Functions

nonReentrant

Guards a function from reentrancy.

modifier nonReentrant() virtual;

nonReadReentrant

Guards a view function from read-only reentrancy.

modifier nonReadReentrant() virtual;