How Does the Nonreentrant Modifier Implement the CEI Principle?
The nonReentrant modifier implements the CEI principle by using a mutex lock (a state variable). At the start of the function (Checks), it verifies the lock is not set.
It then sets the lock (Effects). The function's logic, including the external call (Interaction), executes.
Crucially, the lock is only released at the end of the function. This ensures that any re-entry attempt will find the lock set and revert, enforcing the order of operations.