convert 2 spaces to 4 spaces
This commit is contained in:
@ -6,23 +6,23 @@ pragma solidity ^0.4.24;
|
||||
*/
|
||||
library Address {
|
||||
|
||||
/**
|
||||
* Returns whether the target address is a contract
|
||||
* @dev This function will return false if invoked during the constructor of a contract,
|
||||
* as the code is not actually created until after the constructor finishes.
|
||||
* @param account address of the account to check
|
||||
* @return whether the target address is a contract
|
||||
*/
|
||||
function isContract(address account) internal view returns (bool) {
|
||||
uint256 size;
|
||||
// XXX Currently there is no better way to check if there is a contract in an address
|
||||
// than to check the size of the code at that address.
|
||||
// See https://ethereum.stackexchange.com/a/14016/36603
|
||||
// for more details about how this works.
|
||||
// TODO Check this again before the Serenity release, because all addresses will be
|
||||
// contracts then.
|
||||
// solium-disable-next-line security/no-inline-assembly
|
||||
assembly { size := extcodesize(account) }
|
||||
return size > 0;
|
||||
}
|
||||
/**
|
||||
* Returns whether the target address is a contract
|
||||
* @dev This function will return false if invoked during the constructor of a contract,
|
||||
* as the code is not actually created until after the constructor finishes.
|
||||
* @param account address of the account to check
|
||||
* @return whether the target address is a contract
|
||||
*/
|
||||
function isContract(address account) internal view returns (bool) {
|
||||
uint256 size;
|
||||
// XXX Currently there is no better way to check if there is a contract in an address
|
||||
// than to check the size of the code at that address.
|
||||
// See https://ethereum.stackexchange.com/a/14016/36603
|
||||
// for more details about how this works.
|
||||
// TODO Check this again before the Serenity release, because all addresses will be
|
||||
// contracts then.
|
||||
// solium-disable-next-line security/no-inline-assembly
|
||||
assembly { size := extcodesize(account) }
|
||||
return size > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,27 +10,27 @@ import "zos-lib/contracts/Initializable.sol";
|
||||
*/
|
||||
contract ReentrancyGuard is Initializable {
|
||||
|
||||
/// @dev counter to allow mutex lock with only one SSTORE operation
|
||||
uint256 private _guardCounter;
|
||||
/// @dev counter to allow mutex lock with only one SSTORE operation
|
||||
uint256 private _guardCounter;
|
||||
|
||||
function initialize() public initializer {
|
||||
_guardCounter = 1;
|
||||
}
|
||||
function initialize() public initializer {
|
||||
_guardCounter = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Prevents a contract from calling itself, directly or indirectly.
|
||||
* If you mark a function `nonReentrant`, you should also
|
||||
* mark it `external`. Calling one `nonReentrant` function from
|
||||
* another is not supported. Instead, you can implement a
|
||||
* `private` function doing the actual work, and an `external`
|
||||
* wrapper marked as `nonReentrant`.
|
||||
*/
|
||||
modifier nonReentrant() {
|
||||
_guardCounter += 1;
|
||||
uint256 localCounter = _guardCounter;
|
||||
_;
|
||||
require(localCounter == _guardCounter);
|
||||
}
|
||||
/**
|
||||
* @dev Prevents a contract from calling itself, directly or indirectly.
|
||||
* If you mark a function `nonReentrant`, you should also
|
||||
* mark it `external`. Calling one `nonReentrant` function from
|
||||
* another is not supported. Instead, you can implement a
|
||||
* `private` function doing the actual work, and an `external`
|
||||
* wrapper marked as `nonReentrant`.
|
||||
*/
|
||||
modifier nonReentrant() {
|
||||
_guardCounter += 1;
|
||||
uint256 localCounter = _guardCounter;
|
||||
_;
|
||||
require(localCounter == _guardCounter);
|
||||
}
|
||||
|
||||
uint256[50] private ______gap;
|
||||
uint256[50] private ______gap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user