Skip to content

Commit

Permalink
Issue #4888 Modify contracts for transient storage.
Browse files Browse the repository at this point in the history
Provided instructions to navigate to the contracts directory within the project directory, where the ReentrancyGuard contracts can be modified by deprecating the existing contract and creating a new one with transient storage implementation.
  • Loading branch information
brachiosaurus7 committed Feb 11, 2024
1 parent 8b12f83 commit 74cfb0d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions contracts/ReentrancyGuard.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ReentrancyGuard {
// Deprecated: This contract lacks transient storage support. Consider migrating to ReentrancyGuardTransient.
bool private _notEntered;

constructor () {
_notEntered = true;
}

modifier nonReentrant() {
require(_notEntered, "ReentrancyGuard: reentrant call");
_notEntered = false;
_;
_notEntered = true;
}
}
16 changes: 16 additions & 0 deletions contracts/ReentrancyGuardTransient.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pragma solidity ^0.8.0;

contract ReentrancyGuardTransient {
bool private _notEntered;

constructor () {
_notEntered = true;
}

modifier nonReentrant() {
require(_notEntered, "ReentrancyGuard: reentrant call");
_notEntered = false;
_;
_notEntered = true;
}
}

0 comments on commit 74cfb0d

Please sign in to comment.