aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-23 08:57:57 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-25 08:30:56 +0800
commit6d0dedc62cb1be54dbdd287fd59d7b568a199007 (patch)
tree31bd86a2cf78c3cb65d93fed040dbde4dbb1f281 /packages/contracts/src/2.0.0
parentcf12daea2f3a907f6a111c12d1e67c2e8b0a8797 (diff)
downloaddexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar.gz
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar.bz2
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar.lz
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar.xz
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.tar.zst
dexon-sol-tools-6d0dedc62cb1be54dbdd287fd59d7b568a199007.zip
Split modifiers into check only and check, lock, unlock
Diffstat (limited to 'packages/contracts/src/2.0.0')
-rw-r--r--packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol13
1 files changed, 13 insertions, 0 deletions
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;