Skip to content

Commit

Permalink
Using the new logic to determine the minium participation
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed May 22, 2024
1 parent d220da8 commit 08a64cc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 23 additions & 1 deletion packages/contracts/src/governance/MainVotingPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,24 @@ contract MainVotingPlugin is Addresslist, MajorityVotingBase, IEditors, IMembers
});
}

/// @notice Determines whether at least one editor besides the creator has approved
/// @param _proposalId The ID of the proposal to check.
function isMinParticipationReached(uint256 _proposalId) public view override returns (bool) {
Proposal storage proposal_ = proposals[_proposalId];

if (proposal_.tally.yes == 0 && proposal_.tally.no == 0 && proposal_.tally.abstain == 0) {
return false;
}

// Just one voter
if (addresslistLengthAtBlock(proposal_.parameters.snapshotBlock) == 1) {
return true;
}

// More voters expected
return proposal_.nonCreatorsVoted;
}

/// @inheritdoc MajorityVotingBase
function _vote(
uint256 _proposalId,
Expand Down Expand Up @@ -455,6 +473,10 @@ contract MainVotingPlugin is Addresslist, MajorityVotingBase, IEditors, IMembers
votingPower: 1
});

if (proposalCreators[_proposalId] != msg.sender && !proposal_.nonCreatorsVoted) {
proposal_.nonCreatorsVoted = true;
}

if (_tryEarlyExecution && _canExecute(_proposalId)) {
_execute(_proposalId);
}
Expand Down Expand Up @@ -512,5 +534,5 @@ contract MainVotingPlugin is Addresslist, MajorityVotingBase, IEditors, IMembers
/// @dev This empty reserved space is put in place to allow future versions to add new
/// variables without shifting down storage in the inheritance chain.
/// https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
uint256[49] private __gap;
uint256[48] private __gap;
}
4 changes: 2 additions & 2 deletions packages/contracts/src/governance/MemberAccessPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgrade
_updateMultisigSettings(_multisigSettings);
}

/// @notice Creates a new multisig proposal wrapped by proposeNewMember and proposeRemoveMember.
/// @notice Creates a new multisig proposal wrapped by proposeNewMember.
/// @param _metadata The metadata of the proposal.
/// @param _actions A list of actions wrapped by proposeNewMember and proposeRemoveMember.
/// @param _actions A list of actions wrapped by proposeNewMember.
/// @return proposalId The ID of the proposal.
function createProposal(
bytes calldata _metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ abstract contract MajorityVotingBase is
/// @param parameters The proposal parameters at the time of the proposal creation.
/// @param tally The vote tally of the proposal.
/// @param voters The votes casted by the voters.
/// @param nonCreatorsVoted Whether a wallet other than the creator voted on the proposal.
/// @param actions The actions to be executed when the proposal passes.
/// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.
struct Proposal {
bool executed;
ProposalParameters parameters;
Tally tally;
mapping(address => IMajorityVoting.VoteOption) voters;
bool nonCreatorsVoted;
IDAO.Action[] actions;
uint256 allowFailureMap;
}
Expand Down Expand Up @@ -573,5 +575,5 @@ abstract contract MajorityVotingBase is
}

/// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
uint256[47] private __gap;
uint256[48] private __gap;
}

0 comments on commit 08a64cc

Please sign in to comment.