Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit: Function Visibility Can Be Restricted #198

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Space.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract Space is ISpace, Initializable, IERC4824, UUPSUpgradeable, OwnableUpgra
Strategy[] memory _votingStrategies,
string[] memory _votingStrategyMetadataURIs,
address[] memory _authenticators
) public override initializer {
) external override initializer {
if (_votingStrategies.length == 0) revert EmptyArray();
if (_authenticators.length == 0) revert EmptyArray();
if (_votingStrategies.length != _votingStrategyMetadataURIs.length) revert ArrayLengthMismatch();
Expand Down
10 changes: 5 additions & 5 deletions src/utils/SpaceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ contract SpaceManager is OwnableUpgradeable {

/// @notice Enable a space.
/// @param space Address of the space.
function enableSpace(address space) public onlyOwner {
if (space == address(0) || isSpaceEnabled(space)) revert InvalidSpace();
function enableSpace(address space) external onlyOwner {
if (space == address(0) || spaces[space]) revert InvalidSpace();
spaces[space] = true;
emit SpaceEnabled(space);
}

/// @notice Disable a space.
/// @param space Address of the space.
function disableSpace(address space) public onlyOwner {
function disableSpace(address space) external onlyOwner {
if (!spaces[space]) revert InvalidSpace();
spaces[space] = false;
emit SpaceDisabled(space);
Expand All @@ -46,12 +46,12 @@ contract SpaceManager is OwnableUpgradeable {
/// @notice Check if a space is enabled.
/// @param space Address of the space.
/// @return bool whether the space is enabled.
function isSpaceEnabled(address space) public view returns (bool) {
function isSpaceEnabled(address space) external view returns (bool) {
return spaces[space];
}

modifier onlySpace() {
if (!isSpaceEnabled(msg.sender)) revert InvalidSpace();
if (!spaces[msg.sender]) revert InvalidSpace();
_;
}
}