Verified contractPartialMIT
ProxyAdmin
Address0x3c68b1d45f4faa4f028c3dc8910fa3247c7f0a1f
- Balance
0 ETH
- Transactions
15
- Compiler
solc 0.8.15
- Same code
192 more contracts
Details
- Compiler
- solc 0.8.15+commit.e14f2714
- Language
- solidity
- Optimization
- Yes, 999,999 runs
- EVM version
- london
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 20,062,740
- Creation transaction
- 0x1213ddd183…ba8ad39a26
- Main copy (most transactions)
- 0x07c51ddd…4c3b8637
120 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/universal/ProxyAdmin.solmain9.64 KB
- @openzeppelin/contracts/access/Ownable.sol2.62 KB
- @openzeppelin/contracts/utils/Context.sol844 B
- contracts/L1/L1CrossDomainMessenger.sol2.14 KB
- contracts/L1/L1ERC721Bridge.sol4.24 KB
- contracts/L1/L1StandardBridge.sol10.95 KB
- contracts/L1/L2OutputOracle.sol11.93 KB
- contracts/L1/OptimismPortal.sol18.06 KB
- contracts/L1/ResourceMetering.sol6.85 KB
- contracts/L1/SystemConfig.sol6.61 KB
- contracts/L2/BaseFeeVault.sol615 B
- contracts/L2/CrossDomainOwnable.sol984 B
- contracts/L2/CrossDomainOwnable2.sol1.39 KB
- contracts/L2/GasPriceOracle.sol4.38 KB
- contracts/L2/L1Block.sol2.92 KB
- contracts/L2/L1FeeVault.sol606 B
- contracts/L2/L2CrossDomainMessenger.sol2.39 KB
- contracts/L2/L2ERC721Bridge.sol5.37 KB
- contracts/L2/L2StandardBridge.sol6.85 KB
- contracts/L2/L2ToL1MessagePasser.sol4.7 KB
- contracts/L2/SequencerFeeVault.sol927 B
- contracts/deployment/PortalSender.sol805 B
- contracts/deployment/SystemDictator.sol16.34 KB
- contracts/legacy/AddressManager.sol2.2 KB
- contracts/legacy/DeployerWhitelist.sol3.9 KB
- contracts/legacy/L1BlockNumber.sol1.58 KB
- contracts/legacy/L1ChugSplashProxy.sol10.98 KB
- contracts/legacy/LegacyERC20ETH.sol3.12 KB
- contracts/legacy/LegacyMessagePasser.sol955 B
- contracts/legacy/ResolvedDelegateProxy.sol2.65 KB
- contracts/libraries/Arithmetic.sol1.41 KB
- contracts/libraries/Burn.sol1 KB
- contracts/libraries/Bytes.sol5.37 KB
- contracts/libraries/Constants.sol1.35 KB
- contracts/libraries/Encoding.sol5.72 KB
- contracts/libraries/Hashing.sol5.79 KB
- contracts/libraries/Predeploys.sol3.87 KB
- contracts/libraries/SafeCall.sol983 B
- contracts/libraries/Types.sol3.33 KB
- contracts/libraries/rlp/RLPReader.sol11.22 KB
- contracts/libraries/rlp/RLPWriter.sol6.14 KB
- contracts/libraries/trie/MerkleTrie.sol11.92 KB
- contracts/libraries/trie/SecureMerkleTrie.sol2.25 KB
- contracts/universal/CrossDomainMessenger.sol17.62 KB
- contracts/universal/ERC721Bridge.sol8.73 KB
- contracts/universal/FeeVault.sol2.13 KB
- contracts/universal/IOptimismMintableERC20.sol1.11 KB
- contracts/universal/IOptimismMintableERC721.sol2.42 KB
- contracts/universal/OptimismMintableERC20.sol4.67 KB
- contracts/universal/OptimismMintableERC20Factory.sol3.83 KB
- contracts/universal/OptimismMintableERC721.sol4.65 KB
- contracts/universal/OptimismMintableERC721Factory.sol2.37 KB
- contracts/universal/Proxy.sol7.18 KB
- contracts/universal/Semver.sol1.43 KB
- contracts/universal/StandardBridge.sol18.13 KB
- contracts/vendor/AddressAliasHelper.sol1.73 KB
- interfaces/L1/IResourceMetering.sol680 B
- interfaces/legacy/IAddressManager.sol521 B
- interfaces/legacy/IL1ChugSplashProxy.sol995 B
- interfaces/universal/IOwnable.sol436 B
- interfaces/universal/IProxy.sol651 B
- interfaces/universal/IStaticERC1967Proxy.sol323 B
- lib/openzeppelin-contracts/contracts/access/Ownable.sol2.62 KB
- lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol5.65 KB
- lib/openzeppelin-contracts/contracts/utils/Address.sol8.31 KB
- lib/openzeppelin-contracts/contracts/utils/Context.sol844 B
- lib/openzeppelin-contracts/contracts/utils/math/Math.sol8.83 KB
- lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol1.26 KB
- lib/solmate/src/utils/FixedPointMathLib.sol15.91 KB
- node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol3.15 KB
- node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol5.67 KB
- node_modules/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol3.09 KB
- node_modules/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol3.2 KB
- node_modules/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol7.37 KB
- node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol1.35 KB
- node_modules/@openzeppelin/contracts/access/Ownable.sol2.62 KB
- node_modules/@openzeppelin/contracts/governance/utils/IVotes.sol2.06 KB
- node_modules/@openzeppelin/contracts/proxy/utils/Initializable.sol5.65 KB
- node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol12.62 KB
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.77 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol1.14 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol9.28 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol683 B
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol3.34 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol2.25 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol4.46 KB
- node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol14.35 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol4.75 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol987 B
- node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol7 KB
- node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol1.02 KB
- node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol761 B
- node_modules/@openzeppelin/contracts/utils/Address.sol8.31 KB
- node_modules/@openzeppelin/contracts/utils/Context.sol844 B
- node_modules/@openzeppelin/contracts/utils/Counters.sol1.4 KB
- node_modules/@openzeppelin/contracts/utils/Strings.sol2.4 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol8.75 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol4.51 KB
- node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol987 B
- node_modules/@openzeppelin/contracts/utils/introspection/ERC165Checker.sol4.86 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol853 B
- node_modules/@openzeppelin/contracts/utils/math/Math.sol8.83 KB
- node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol35.53 KB
- node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol1.26 KB
- node_modules/@rari-capital/solmate/src/utils/Bytes32AddressLib.sol547 B
- node_modules/@rari-capital/solmate/src/utils/FixedPointMathLib.sol15.91 KB
- src/L1/ResourceMetering.sol8.6 KB
- src/L1/interfaces/IResourceMetering.sol625 B
- src/legacy/AddressManager.sol2.09 KB
- src/legacy/L1ChugSplashProxy.sol10.56 KB
- src/legacy/interfaces/IAddressManager.sol525 B
- src/legacy/interfaces/IL1ChugSplashProxy.sol939 B
- src/libraries/Arithmetic.sol1.27 KB
- src/libraries/Burn.sol964 B
- src/libraries/Constants.sol2.57 KB
- src/universal/Proxy.sol6.66 KB
- src/universal/ProxyAdmin.sol9.28 KB
- src/universal/interfaces/IOwnable.sol436 B
- src/universal/interfaces/IProxy.sol651 B
- src/universal/interfaces/IStaticERC1967Proxy.sol323 B
contracts/universal/ProxyAdmin.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Proxy } from "./Proxy.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
import { L1ChugSplashProxy } from "../legacy/L1ChugSplashProxy.sol";
/**
* @title IStaticERC1967Proxy
* @notice IStaticERC1967Proxy is a static version of the ERC1967 proxy interface.
*/
interface IStaticERC1967Proxy {
function implementation() external view returns (address);
function admin() external view returns (address);
}
/**
* @title IStaticL1ChugSplashProxy
* @notice IStaticL1ChugSplashProxy is a static version of the ChugSplash proxy interface.
*/
interface IStaticL1ChugSplashProxy {
function getImplementation() external view returns (address);
function getOwner() external view returns (address);
}
/**
* @title ProxyAdmin
* @notice This is an auxiliary contract meant to be assigned as the admin of an ERC1967 Proxy,
* based on the OpenZeppelin implementation. It has backwards compatibility logic to work
* with the various types of proxies that have been deployed by Optimism in the past.
*/
contract ProxyAdmin is Ownable {
/**
* @notice The proxy types that the ProxyAdmin can manage.
*
* @custom:value ERC1967 Represents an ERC1967 compliant transparent proxy interface.
* @custom:value CHUGSPLASH Represents the Chugsplash proxy interface (legacy).
* @custom:value RESOLVED Represents the ResolvedDelegate proxy (legacy).
*/
enum ProxyType {
ERC1967,
CHUGSPLASH,
RESOLVED
}
/**
* @notice A mapping of proxy types, used for backwards compatibility.
*/
mapping(address => ProxyType) public proxyType;
/**
* @notice A reverse mapping of addresses to names held in the AddressManager. This must be
* manually kept up to date with changes in the AddressManager for this contract
* to be able to work as an admin for the ResolvedDelegateProxy type.
*/
mapping(address => string) public implementationName;
/**
* @notice The address of the address manager, this is required to manage the
* ResolvedDelegateProxy type.
*/
AddressManager public addressManager;
/**
* @notice A legacy upgrading indicator used by the old Chugsplash Proxy.
*/
bool internal upgrading;
/**
* @param _owner Address of the initial owner of this contract.
*/
constructor(address _owner) Ownable() {
_transferOwnership(_owner);
}
/**
* @notice Sets the proxy type for a given address. Only required for non-standard (legacy)
* proxy types.
*
* @param _address Address of the proxy.
* @param _type Type of the proxy.
*/
function setProxyType(address _address, ProxyType _type) external onlyOwner {
proxyType[_address] = _type;
}
/**
* @notice Sets the implementation name for a given address. Only required for
* ResolvedDelegateProxy type proxies that have an implementation name.
*
* @param _address Address of the ResolvedDelegateProxy.
* @param _name Name of the implementation for the proxy.
*/
function setImplementationName(address _address, string memory _name) external onlyOwner {
implementationName[_address] = _name;
}
/**
* @notice Set the address of the AddressManager. This is required to manage legacy
* ResolvedDelegateProxy type proxy contracts.
*
* @param _address Address of the AddressManager.
*/
function setAddressManager(AddressManager _address) external onlyOwner {
addressManager = _address;
}
/**
* @custom:legacy
* @notice Set an address in the address manager. Since only the owner of the AddressManager
* can directly modify addresses and the ProxyAdmin will own the AddressManager, this
* gives the owner of the ProxyAdmin the ability to modify addresses directly.
*
* @param _name Name to set within the AddressManager.
* @param _address Address to attach to the given name.
*/
function setAddress(string memory _name, address _address) external onlyOwner {
addressManager.setAddress(_name, _address);
}
/**
* @custom:legacy
* @notice Set the upgrading status for the Chugsplash proxy type.
*
* @param _upgrading Whether or not the system is upgrading.
*/
function setUpgrading(bool _upgrading) external onlyOwner {
upgrading = _upgrading;
}
/**
* @custom:legacy
* @notice Legacy function used to tell ChugSplashProxy contracts if an upgrade is happening.
*
* @return Whether or not there is an upgrade going on. May not actually tell you whether an
* upgrade is going on, since we don't currently plan to use this variable for anything
* other than a legacy indicator to fix a UX bug in the ChugSplash proxy.
*/
function isUpgrading() external view returns (bool) {
return upgrading;
}
/**
* @notice Returns the implementation of the given proxy address.
*
* @param _proxy Address of the proxy to get the implementation of.
*
* @return Address of the implementation of the proxy.
*/
function getProxyImplementation(address _proxy) external view returns (address) {
ProxyType ptype = proxyType[_proxy];
if (ptype == ProxyType.ERC1967) {
return IStaticERC1967Proxy(_proxy).implementation();
} else if (ptype == ProxyType.CHUGSPLASH) {
return IStaticL1ChugSplashProxy(_proxy).getImplementation();
} else if (ptype == ProxyType.RESOLVED) {
return addressManager.getAddress(implementationName[_proxy]);
} else {
revert("ProxyAdmin: unknown proxy type");
}
}
/**
* @notice Returns the admin of the given proxy address.
*
* @param _proxy Address of the proxy to get the admin of.
*
* @return Address of the admin of the proxy.
*/
function getProxyAdmin(address payable _proxy) external view returns (address) {
ProxyType ptype = proxyType[_proxy];
if (ptype == ProxyType.ERC1967) {
return IStaticERC1967Proxy(_proxy).admin();
} else if (ptype == ProxyType.CHUGSPLASH) {
return IStaticL1ChugSplashProxy(_proxy).getOwner();
} else if (ptype == ProxyType.RESOLVED) {
return addressManager.owner();
} else {
revert("ProxyAdmin: unknown proxy type");
}
}
/**
* @notice Updates the admin of the given proxy address.
*
* @param _proxy Address of the proxy to update.
* @param _newAdmin Address of the new proxy admin.
*/
function changeProxyAdmin(address payable _proxy, address _newAdmin) external onlyOwner {
ProxyType ptype = proxyType[_proxy];
if (ptype == ProxyType.ERC1967) {
Proxy(_proxy).changeAdmin(_newAdmin);
} else if (ptype == ProxyType.CHUGSPLASH) {
L1ChugSplashProxy(_proxy).setOwner(_newAdmin);
} else if (ptype == ProxyType.RESOLVED) {
addressManager.transferOwnership(_newAdmin);
} else {
revert("ProxyAdmin: unknown proxy type");
}
}
/**
* @notice Changes a proxy's implementation contract.
*
* @param _proxy Address of the proxy to upgrade.
* @param _implementation Address of the new implementation address.
*/
function upgrade(address payable _proxy, address _implementation) public onlyOwner {
ProxyType ptype = proxyType[_proxy];
if (ptype == ProxyType.ERC1967) {
Proxy(_proxy).upgradeTo(_implementation);
} else if (ptype == ProxyType.CHUGSPLASH) {
L1ChugSplashProxy(_proxy).setStorage(
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,
bytes32(uint256(uint160(_implementation)))
);
} else if (ptype == ProxyType.RESOLVED) {
string memory name = implementationName[_proxy];
addressManager.setAddress(name, _implementation);
} else {
// It should not be possible to retrieve a ProxyType value which is not matched by
// one of the previous conditions.
assert(false);
}
}
/**
* @notice Changes a proxy's implementation contract and delegatecalls the new implementation
* with some given data. Useful for atomic upgrade-and-initialize calls.
*
* @param _proxy Address of the proxy to upgrade.
* @param _implementation Address of the new implementation address.
* @param _data Data to trigger the new implementation with.
*/
function upgradeAndCall(
address payable _proxy,
address _implementation,
bytes memory _data
) external payable onlyOwner {
ProxyType ptype = proxyType[_proxy];
if (ptype == ProxyType.ERC1967) {
Proxy(_proxy).upgradeToAndCall{ value: msg.value }(_implementation, _data);
} else {
// reverts if proxy type is unknown
upgrade(_proxy, _implementation);
(bool success, ) = _proxy.call{ value: msg.value }(_data);
require(success, "ProxyAdmin: call to proxy after upgrade failed");
}
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "none"
},
"libraries": {},
"optimizer": {
"runs": 999999,
"enabled": true
},
"evmVersion": "london",
"remappings": [
":@cwia/=node_modules/clones-with-immutable-args/src/",
":@openzeppelin/=node_modules/@openzeppelin/",
":@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
":@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
":@rari-capital/=node_modules/@rari-capital/",
":@rari-capital/solmate/=node_modules/@rari-capital/solmate/",
":clones-with-immutable-args/=node_modules/clones-with-immutable-args/",
":ds-test/=node_modules/ds-test/src/",
":forge-std/=node_modules/forge-std/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.