Skip to content

Commit

Permalink
(proxy): removed immutable ADMIN_INIT as lost its meaning
Browse files Browse the repository at this point in the history
  • Loading branch information
roleengineer committed Nov 26, 2024
1 parent 202f94b commit f4f57a7
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/groups/UpgradeableRenounceableProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.s

interface IUpgradeableRenounceableProxy {
function implementation() external view returns (address);
function upgradeToAndCall(address _newImplementation, bytes memory _data) external;
function upgradeToAndCall(address newImplementation, bytes memory data) external;
function renounceUpgradeability() external;
}

Expand All @@ -18,18 +18,11 @@ contract UpgradeableRenounceableProxy is ERC1967Proxy {
/// Triggered when the delegatecall modifies values, indicating a violation of proxy-native functionality.
error ProxyNative();

// Constants

/// @dev Initial proxy admin.
address internal immutable ADMIN_INIT;

// Constructor

constructor(address _implementation, bytes memory _data) ERC1967Proxy(_implementation, _data) {
// set the admin to the deployer
ERC1967Utils.changeAdmin(msg.sender);
// set the admin as immutable
ADMIN_INIT = msg.sender;
}

/// @dev Handles proxy function calls: attempts to dispatch to a specific
Expand All @@ -45,10 +38,10 @@ contract UpgradeableRenounceableProxy is ERC1967Proxy {
}
}
// dispatch if caller is admin, otherwise delegate to the implementation
if (msg.sender == ADMIN_INIT && msg.sender == ERC1967Utils.getAdmin()) {
if (msg.sender == ERC1967Utils.getAdmin()) {
_dispatchAdmin();
} else {
super._fallback();
_delegate(_implementation());
}
}

Expand Down

0 comments on commit f4f57a7

Please sign in to comment.