Description:
Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/VerifyUniswap.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\r
pragma solidity ^0.8.20;\r
\r
contract VerifyUniswap {\r
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\r
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\r
\r
constructor(address _logic, address _admin) payable {\r
_setImplementation(_logic);\r
_setAdmin(_admin);\r
}\r
\r
fallback() external payable {\r
_delegate(_getImplementation());\r
}\r
\r
receive() external payable {}\r
\r
function upgradeTo(address _newImplementation) external {\r
require(_getAdmin() == msg.sender, "PROXY: NOT_ADMIN");\r
_setImplementation(_newImplementation);\r
}\r
\r
function _delegate(address _implementation) internal {\r
assembly {\r
calldatacopy(0, 0, calldatasize())\r
let result := delegatecall(gas(), _implementation, 0, calldatasize(), 0, 0)\r
returndatacopy(0, 0, returndatasize())\r
switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) }\r
}\r
}\r
\r
function _getImplementation() internal view returns (address impl) {\r
bytes32 slot = _IMPLEMENTATION_SLOT;\r
assembly { impl := sload(slot) }\r
}\r
\r
function _setImplementation(address _newImplementation) internal {\r
bytes32 slot = _IMPLEMENTATION_SLOT;\r
assembly { sstore(slot, _newImplementation) }\r
}\r
\r
function _getAdmin() internal view returns (address admin) {\r
bytes32 slot = _ADMIN_SLOT;\r
assembly { admin := sload(slot) }\r
}\r
\r
function _setAdmin(address _newAdmin) internal {\r
bytes32 slot = _ADMIN_SLOT;\r
assembly { sstore(slot, _newAdmin) }\r
}\r
}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "london",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-09-22 17:12:09
Comments
Log in to comment.
No comments yet.