Split modifiers into check only and check, lock, unlock

This commit is contained in:
Amir Bandeali
2018-08-22 17:57:57 -07:00
parent cf12daea2f
commit 6d0dedc62c

View File

@@ -31,6 +31,19 @@ contract ReentrancyGuard {
"REENTRANCY_ILLEGAL"
);
// Perform function call
_;
}
/// @dev Functions with this modifer cannot be reentered. The mutex will be locked
/// before function execution and unlocked after.
modifier lockMutex() {
// Ensure mutex is unlocked
require(
!locked,
"REENTRANCY_ILLEGAL"
);
// Lock mutex before function call
locked = true;