Commit 3c4528b8 by Francisco Giordano

fix initialization of ReetrancyGuard storage variable

parent 32d0f677
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../utils/ReentrancyGuard.sol"; import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol"; import "./ReentrancyAttack.sol";
contract ReentrancyMock is ReentrancyGuard { contract ReentrancyMock is Initializable, ReentrancyGuard {
uint256 public counter; uint256 public counter;
constructor() public { constructor() public {
ReentrancyGuard.initialize();
counter = 0; counter = 0;
} }
......
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
/** /**
* @title Helps contracts guard against reentrancy attacks. * @title Helps contracts guard against reentrancy attacks.
...@@ -7,10 +8,14 @@ pragma solidity ^0.4.24; ...@@ -7,10 +8,14 @@ pragma solidity ^0.4.24;
* @dev If you mark a function `nonReentrant`, you should also * @dev If you mark a function `nonReentrant`, you should also
* mark it `external`. * mark it `external`.
*/ */
contract ReentrancyGuard { contract ReentrancyGuard is Initializable {
/// @dev counter to allow mutex lock with only one SSTORE operation /// @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. * @dev Prevents a contract from calling itself, directly or indirectly.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment