Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
3c4528b8
Commit
3c4528b8
authored
Oct 03, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix initialization of ReetrancyGuard storage variable
parent
32d0f677
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
ReentrancyMock.sol
contracts/mocks/ReentrancyMock.sol
+3
-1
ReentrancyGuard.sol
contracts/utils/ReentrancyGuard.sol
+7
-2
No files found.
contracts/mocks/ReentrancyMock.sol
View file @
3c4528b8
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
contract ReentrancyMock is ReentrancyGuard {
contract ReentrancyMock is
Initializable,
ReentrancyGuard {
uint256 public counter;
constructor() public {
ReentrancyGuard.initialize();
counter = 0;
}
...
...
contracts/utils/ReentrancyGuard.sol
View file @
3c4528b8
pragma solidity ^0.4.24;
import "../Initializable.sol";
/**
* @title Helps contracts guard against reentrancy attacks.
...
...
@@ -7,10 +8,14 @@ pragma solidity ^0.4.24;
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
contract ReentrancyGuard
is Initializable
{
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter = 1;
uint256 private _guardCounter;
function initialize() public initializer {
_guardCounter = 1;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment