Skip to content

Commit

Permalink
Make the condition only allow addMember
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed May 27, 2024
1 parent b8b5ea5 commit 197a128
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract MemberAccessExecuteCondition is PermissionCondition {
targetContract = _targetContract;
}

/// @notice Checks whether the current action attempts to add or remove members
/// @notice Checks whether the current action attempts to add members
function isGranted(
address _where,
address _who,
Expand All @@ -42,12 +42,9 @@ contract MemberAccessExecuteCondition is PermissionCondition {
else if (_actions[0].to != targetContract) return false;

// Decode the call being requested (both have the same parameters)
(bytes4 _requestedSelector, ) = _decodeAddRemoveMemberCalldata(_actions[0].data);
(bytes4 _requestedSelector, ) = _decodeAddMemberCalldata(_actions[0].data);

if (
_requestedSelector != MainVotingPlugin.addMember.selector &&
_requestedSelector != MainVotingPlugin.removeMember.selector
) return false;
if (_requestedSelector != MainVotingPlugin.addMember.selector) return false;

return true;
}
Expand All @@ -60,7 +57,7 @@ contract MemberAccessExecuteCondition is PermissionCondition {
}
}

function _decodeAddRemoveMemberCalldata(
function _decodeAddMemberCalldata(
bytes memory _data
) internal pure returns (bytes4 sig, address account) {
// Slicing is only supported for bytes calldata, not bytes memory
Expand Down
7 changes: 2 additions & 5 deletions packages/contracts/src/governance/MemberAccessPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bytes4 constant MEMBER_ACCESS_INTERFACE_ID = MemberAccessPlugin.initialize.selec
contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgradeable {
using SafeCastUpgradeable for uint256;

/// @notice The ID of the permission required to call the `addAddresses` and `removeAddresses` functions.
/// @notice The ID of the permission required to call the `addAddresses` functions.
bytes32 public constant UPDATE_MULTISIG_SETTINGS_PERMISSION_ID =
keccak256("UPDATE_MULTISIG_SETTINGS_PERMISSION");

Expand Down Expand Up @@ -97,7 +97,7 @@ contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgrade
/// @param proposalId The ID of the proposal.
error ProposalExecutionForbidden(uint256 proposalId);

/// @notice Thrown when attempting to use addAddresses and removeAddresses.
/// @notice Thrown when attempting to use addAddresses.
error AddresslistDisabled();

/// @notice Thrown when attempting to use an invalid contract.
Expand All @@ -106,9 +106,6 @@ contract MemberAccessPlugin is IMultisig, PluginUUPSUpgradeable, ProposalUpgrade
/// @notice Thrown when attempting request membership for a current member.
error AlreadyMember(address _member);

/// @notice Thrown when attempting propose removing membership for a non-member.
error AlreadyNotMember(address _member);

/// @notice Emitted when a proposal is approved by an editor.
/// @param proposalId The ID of the proposal.
/// @param editor The editor casting the approve.
Expand Down

0 comments on commit 197a128

Please sign in to comment.