Skip to content

Commit

Permalink
Fix R-04
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestognw committed Aug 2, 2023
1 parent f220f12 commit 5338503
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions contracts/proxy/transparent/TransparentUpgradeableProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,21 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
_admin = address(new ProxyAdmin(initialOwner));
// Set the storage value and emit an event for ERC-1967 compatibility
ERC1967Utils.changeAdmin(_admin);
ERC1967Utils.changeAdmin(_admin());
}

/**
* @dev Returns the admin of this proxy.
*/
function _admin() internal virtual {
return _admin;
}

/**
* @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
*/
function _fallback() internal virtual override {
if (msg.sender == _admin) {
if (msg.sender == _admin()) {
if (msg.sig == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {
_dispatchUpgradeToAndCall();
} else {
Expand Down

0 comments on commit 5338503

Please sign in to comment.