Skip to content

Commit

Permalink
👷 add stubs for quorum
Browse files Browse the repository at this point in the history
  • Loading branch information
cmontecoding committed Sep 7, 2023
1 parent a813553 commit f04461f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/AutomatedVoting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ contract AutomatedVoting is IAutomatedVoting {
mapping(address => uint256) public removalVotes;
mapping(address => mapping(address => bool)) public hasVotedForMemberRemoval;
address[] public membersUpForRemoval;
// mapping(uint256 => uint256) public stakedAmountsForQuorum;

struct election {
uint256 startTime;
Expand Down Expand Up @@ -102,6 +103,8 @@ contract AutomatedVoting is IAutomatedVoting {
_;
}

//todo: modifier onlyActiveElections (for when an election gets canceled and finalized)

constructor(address _stakingRewards) {
stakingRewards = IStakingRewards(_stakingRewards);
/// @dev start a scheduled election
Expand Down Expand Up @@ -318,6 +321,10 @@ contract AutomatedVoting is IAutomatedVoting {
if (!_candidatesAreNominated(_election, candidates)) {
revert CandidateNotNominated();
}
// if (elections[_election].theElectionType == Enums.electionType.CKIP) {
// uint256 userStaked = stakingRewards.balanceOf(msg.sender);
// stakedAmountsForQuorum[_election] += userStaked;
// }
hasVoted[msg.sender][_election] = true;
voteCounts[_election][candidate]++;
}
Expand Down Expand Up @@ -432,6 +439,13 @@ contract AutomatedVoting is IAutomatedVoting {
elections[_election].winningCandidates = winners;
council = winners;
} else if (elections[_election].theElectionType == Enums.electionType.council || elections[_election].theElectionType == Enums.electionType.stepDown) {
// if (elections[_election].theElectionType == Enums.electionType.stepDown) {
// uint256 quorumPercentage = stakedAmountsForQuorum[_election] * 100 / stakingRewards.totalSupply();
// if (quorumPercentage < 40) {
// //todo: emit event that quorum was not reached
// return;
// }
// }
/// @dev this is for a single election
(address[] memory winners, ) = getWinners(_election, 1);
elections[_election].winningCandidates = winners;
Expand Down

0 comments on commit f04461f

Please sign in to comment.