This repository has been archived by the owner on Mar 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Consolidated functions for setting epoch * Centralized chain status, reduced build * Removed commented code
- Loading branch information
Showing
21 changed files
with
526 additions
and
656 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
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
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,54 @@ | ||
// SPDX-License-Identifier: MIT-open-group | ||
pragma solidity >=0.7.4; | ||
pragma abicoder v2; | ||
|
||
library ChainStatusLibrary { | ||
bytes32 constant STORAGE_LOCATION = keccak256("chainstatus.storage"); | ||
|
||
struct ChainStatusStorage { | ||
uint32 chainId; | ||
uint256 epoch; | ||
uint32 epochSize; | ||
} | ||
|
||
function chainStatusStorage() internal pure returns (ChainStatusStorage storage ss) { | ||
bytes32 position = STORAGE_LOCATION; | ||
assembly { // solium-disable-line | ||
ss.slot := position | ||
} | ||
} | ||
|
||
// | ||
// | ||
// | ||
function setChainId(uint32 _chainId) internal { | ||
chainStatusStorage().chainId = _chainId; | ||
} | ||
|
||
function chainId() internal view returns (uint32) { | ||
return chainStatusStorage().chainId; | ||
} | ||
|
||
// | ||
// | ||
// | ||
function setEpoch(uint256 _epoch) internal { | ||
chainStatusStorage().epoch = _epoch; | ||
} | ||
|
||
function epoch() internal view returns (uint256) { | ||
return chainStatusStorage().epoch; | ||
} | ||
|
||
// | ||
// | ||
// | ||
function setEpochSize(uint32 _epochSize) internal { | ||
chainStatusStorage().epochSize = _epochSize; | ||
} | ||
|
||
function epochSize() internal view returns (uint32) { | ||
return chainStatusStorage().epochSize; | ||
} | ||
|
||
} |
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
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
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
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.