-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathModuleUpdate.sol
More file actions
41 lines (32 loc) · 1.31 KB
/
ModuleUpdate.sol
File metadata and controls
41 lines (32 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.27;
import "./interfaces/IModuleUpdate.sol";
import "./Implementation.sol";
import "./ModuleSelfAuth.sol";
import "./ModuleERC165.sol";
import "../../utils/LibAddress.sol";
contract ModuleUpdate is IModuleUpdate, ModuleERC165, ModuleSelfAuth, Implementation {
using LibAddress for address;
event ImplementationUpdated(address newImplementation);
/**
* @notice Updates the implementation of the base wallet
* @param _implementation New main module implementation
* @dev WARNING Updating the implementation can brick the wallet
*/
function updateImplementation(address _implementation) external override onlySelf {
require(_implementation.isContract(), "ModuleUpdate#updateImplementation: INVALID_IMPLEMENTATION");
_setImplementation(_implementation);
emit ImplementationUpdated(_implementation);
}
/**
* @notice Query if a contract implements an interface
* @param _interfaceID The interface identifier, as specified in ERC-165
* @return `true` if the contract implements `_interfaceID`
*/
function supportsInterface(bytes4 _interfaceID) public override virtual pure returns (bool) {
if (_interfaceID == type(IModuleUpdate).interfaceId) {
return true;
}
return super.supportsInterface(_interfaceID);
}
}