|
@@ -48,14 +48,20 @@ abstract contract ReentrancyGuard {
|
|
|
* `private` function that does the actual work.
|
|
|
*/
|
|
|
modifier nonReentrant() {
|
|
|
+ _nonReentrantBefore();
|
|
|
+ _;
|
|
|
+ _nonReentrantAfter();
|
|
|
+ }
|
|
|
+
|
|
|
+ function _nonReentrantBefore() private {
|
|
|
// On the first call to nonReentrant, _notEntered will be true
|
|
|
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
|
|
|
|
|
|
// Any calls to nonReentrant after this point will fail
|
|
|
_status = _ENTERED;
|
|
|
+ }
|
|
|
|
|
|
- _;
|
|
|
-
|
|
|
+ function _nonReentrantAfter() private {
|
|
|
// By storing the original value once again, a refund is triggered (see
|
|
|
// https://eips.ethereum.org/EIPS/eip-2200)
|
|
|
_status = _NOT_ENTERED;
|