c9639c3860
* tests: add solidity test suite * tests: remove require strings * Update tests-solidity/init-test-node.sh * Update tests-solidity/init-test-node.sh Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
25 lines
792 B
Solidity
25 lines
792 B
Solidity
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/Petrifiable.sol
|
|
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
|
|
|
|
pragma solidity ^0.5.17;
|
|
|
|
import "./Initializable.sol";
|
|
|
|
|
|
contract Petrifiable is Initializable {
|
|
// Use block UINT256_MAX (which should be never) as the initializable date
|
|
uint256 internal constant PETRIFIED_BLOCK = uint256(-1);
|
|
|
|
function isPetrified() public view returns (bool) {
|
|
return getInitializationBlock() == PETRIFIED_BLOCK;
|
|
}
|
|
|
|
/**
|
|
* @dev Function to be called by top level contract to prevent being initialized.
|
|
* Useful for freezing base contracts when they're used behind proxies.
|
|
*/
|
|
function petrify() internal onlyInit {
|
|
initializedAt(PETRIFIED_BLOCK);
|
|
}
|
|
}
|