Skip to content

Commit 1ce6481

Browse files
committed
Fix R-04
1 parent 2c6e24a commit 1ce6481

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

contracts/proxy/transparent/TransparentUpgradeableProxy.sol

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,21 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
7878
constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
7979
_admin = address(new ProxyAdmin(initialOwner));
8080
// Set the storage value and emit an event for ERC-1967 compatibility
81-
ERC1967Utils.changeAdmin(_admin);
81+
ERC1967Utils.changeAdmin(_proxyAdmin());
82+
}
83+
84+
/**
85+
* @dev Returns the admin of this proxy.
86+
*/
87+
function _proxyAdmin() internal virtual returns (address) {
88+
return _admin;
8289
}
8390

8491
/**
8592
* @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
8693
*/
8794
function _fallback() internal virtual override {
88-
if (msg.sender == _admin) {
95+
if (msg.sender == _proxyAdmin()) {
8996
if (msg.sig == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {
9097
_dispatchUpgradeToAndCall();
9198
} else {

0 commit comments

Comments
 (0)