-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from DemocracyEarth/openzeppelin
Implementation of Upgradeable Contracts
- Loading branch information
Showing
11 changed files
with
315 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ allFiredEvents | |
coverageEnv/ | ||
scTopics | ||
.DS_Store | ||
.openzeppelin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity >=0.4.24 <=0.7.3; | ||
|
||
|
||
/** | ||
* @title Initializable | ||
* | ||
* @dev Helper contract to support initializer functions. To use it, replace | ||
* the constructor with a function that has the `initializer` modifier. | ||
* WARNING: Unlike constructors, initializer functions must be manually | ||
* invoked. This applies both to deploying an Initializable contract, as well | ||
* as extending an Initializable contract via inheritance. | ||
* WARNING: When used with inheritance, manual care must be taken to not invoke | ||
* a parent initializer twice, or ensure that all initializers are idempotent, | ||
* because this is not dealt with automatically as with constructors. | ||
*/ | ||
contract Initializable { | ||
|
||
/** | ||
* @dev Indicates that the contract has been initialized. | ||
*/ | ||
bool private initialized; | ||
|
||
/** | ||
* @dev Indicates that the contract is in the process of being initialized. | ||
*/ | ||
bool private initializing; | ||
|
||
/** | ||
* @dev Modifier to use in the initializer function of a contract. | ||
*/ | ||
modifier initializer() { | ||
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); | ||
|
||
bool isTopLevelCall = !initializing; | ||
if (isTopLevelCall) { | ||
initializing = true; | ||
initialized = true; | ||
} | ||
|
||
_; | ||
|
||
if (isTopLevelCall) { | ||
initializing = false; | ||
} | ||
} | ||
|
||
/// @dev Returns true if and only if the function is running in the constructor | ||
function isConstructor() private view returns (bool) { | ||
// extcodesize checks the size of the code stored in an address, and | ||
// address returns the current address. Since the code is still not | ||
// deployed when running a constructor, any checks on its code size will | ||
// yield zero, making it an effective way to detect if a contract is | ||
// under construction or not. | ||
address self = address(this); | ||
uint256 cs; | ||
assembly { cs := extcodesize(self) } | ||
return cs == 0; | ||
} | ||
|
||
// Reserved storage space to allow for layout changes in the future. | ||
uint256[50] private ______gap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Deployment params | ||
module.exports.INITIAL_SUPPLY = '10000000000000000000000000'; | ||
module.exports.TOKEN_NAME = "Universal Basic Income"; | ||
module.exports.TOKEN_SYMBOL = "EARTH"; | ||
module.exports.TOKEN_NAME = "Democracy Earth"; | ||
module.exports.TOKEN_SYMBOL = "UBI"; | ||
module.exports.ACCRUED_PER_SECOND = '100000000000000'; | ||
module.exports.PROOF_OF_HUMANITY_KOVAN = '0x413752ADd5ff51CC1928FA73BEFA65b37dEB8730'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.