From 6d0dedc62cb1be54dbdd287fd59d7b568a199007 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 22 Aug 2018 17:57:57 -0700 Subject: Split modifiers into check only and check, lock, unlock --- .../src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol b/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol index 5d6f6970d..2b980c7ca 100644 --- a/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol +++ b/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol @@ -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; -- cgit v1.2.3