-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Open
Description
🧐 Motivation
Currently, the TransparentUpgradeableProxy
deploys the ProxyAdmin
every time in the constructor. It would be great if it were possible to pass the existing ProxyAdmin
address for reuse.
📝 Details
The current constructor logic is the following:
contract TransparentUpgradeableProxy is ERC1967Proxy {
...
constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
_admin = address(new ProxyAdmin(initialOwner));
ERC1967Utils.changeAdmin(_proxyAdmin());
}
...
}
Propose a slight modification:
contract TransparentUpgradeableProxy is ERC1967Proxy {
...
constructor(
address _logic,
address initialOwnerOrAdmin,
bool isOwner,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
if (isOwner) {
_admin = address(new ProxyAdmin(initialOwnerOrAdmin));
} else {
_admin = initialOwnerOrAdmin;
}
ERC1967Utils.changeAdmin(_proxyAdmin());
}
...
}
This would allow various transparent proxies to be used in factories when a single contract is responsible for their management.
rya-sge
Metadata
Metadata
Assignees
Labels
No labels