Skip to content

Commit

Permalink
Lock Manager tests ready
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Jan 21, 2025
1 parent 3f017ba commit 18430f5
Show file tree
Hide file tree
Showing 5 changed files with 1,107 additions and 261 deletions.
6 changes: 3 additions & 3 deletions src/LockManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,21 @@ contract LockManager is ILockManager, DaoAuthorizable {
) {
revert InvalidPlugin();
}
// Is it the right plugin type?
// Is it the right type of plugin?
else if (
settings.pluginMode == PluginMode.Approval &&
!IERC165(address(_newPluginAddress)).supportsInterface(
type(ILockToApprove).interfaceId
)
) {
revert InvalidPluginMode();
revert InvalidPlugin();
} else if (
settings.pluginMode == PluginMode.Voting &&
!IERC165(address(_newPluginAddress)).supportsInterface(
type(ILockToVote).interfaceId
)
) {
revert InvalidPluginMode();
revert InvalidPlugin();
}

plugin = _newPluginAddress;
Expand Down
19 changes: 7 additions & 12 deletions src/base/LockToVoteBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,25 @@ import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/intro

/// @title LockToVoteBase
/// @author Aragon X 2024-2025
abstract contract LockToVoteBase is
ILockToVoteBase,
IMembership,
ERC165Upgradeable
{
error NoVotingPower();
abstract contract LockToVoteBase is ILockToVoteBase, IMembership, ERC165Upgradeable {
event LockManagerDefined(ILockManager lockManager);

error NoVotingPower();
error LockManagerAlreadyDefined();

/// @inheritdoc ILockToVoteBase
ILockManager public lockManager;

/// @notice Initializes the component to be used by inheriting contracts.
/// @param _lockManager The address of the contract with the ability to manager votes on behalf of users.
function __LockToVoteBase_init(
ILockManager _lockManager
) internal onlyInitializing {
function __LockToVoteBase_init(ILockManager _lockManager) internal onlyInitializing {
_setLockManager(_lockManager);
}

/// @notice Checks if this or the parent contract supports an interface by its ID.
/// @param _interfaceId The ID of the interface.
/// @return Returns `true` if the interface is supported.
function supportsInterface(
bytes4 _interfaceId
) public view virtual override(ERC165Upgradeable) returns (bool) {
function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC165Upgradeable) returns (bool) {
return
_interfaceId == type(ILockToVoteBase).interfaceId ||
_interfaceId == type(IMembership).interfaceId ||
Expand Down Expand Up @@ -67,6 +60,8 @@ abstract contract LockToVoteBase is
}

lockManager = _lockManager;

emit LockManagerDefined(_lockManager);
}

/// @notice This empty reserved space is put in place to allow future versions to add
Expand Down
Loading

0 comments on commit 18430f5

Please sign in to comment.