-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
47 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.10; | ||
|
||
import { Poll } from "../Poll.sol"; | ||
|
||
/// @title CommonUtilities | ||
/// @notice A contract that holds common utilities | ||
/// which are to be used by multiple contracts | ||
/// namely Subsidy, Tally and MessageProcessor | ||
contract CommonUtilities { | ||
error VotingPeriodNotPassed(); | ||
|
||
/// @notice common function for MessageProcessor, Tally and Subsidy | ||
/// @param _poll the poll to be checked | ||
function _votingPeriodOver(Poll _poll) internal view { | ||
(uint256 deployTime, uint256 duration) = _poll.getDeployTimeAndDuration(); | ||
// Require that the voting period is over | ||
uint256 secondsPassed = block.timestamp - deployTime; | ||
if (secondsPassed <= duration) { | ||
revert VotingPeriodNotPassed(); | ||
} | ||
} | ||
} |
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