Skip to content
Verified contractPartialMIT

OwnedProxy

Address0x278d858f05b94576c1e6f73285886876ff6ef8d2
Balance

0.001232 ETH

 

Transactions

5,591,855

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
24,497,357
Creation transaction
0xc605f344e2…816b51f947

src/OwnedProxy.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

interface IImplementation {
    function checkUpgrade_1T96KW() external view;
}

contract OwnedProxy {
    bytes32 private constant IMPLEMENTATION_SLOT = 0x2b1ffc369630770908ae8b04282e29044dfb19c5b4378f67d00e0a2ef5f153e2;

    address public immutable proxyOwner_13pCyi;

    constructor(address owner_) {
        proxyOwner_13pCyi = owner_;
    }

    function upgradeTo_2v93DM(address newImplementation) external {
        require(msg.sender == proxyOwner_13pCyi, "Not proxy owner");
        _checkImplementation(newImplementation);
        _setImplementation(newImplementation);
    }

    function implementation_67SpLH() external view returns (address impl) {
        assembly {
            impl := sload(IMPLEMENTATION_SLOT)
        }
    }

    fallback() external payable {
        _fallback();
    }

    receive() external payable {}

    function _fallback() internal {
        _delegate();
    }

    function _delegate() internal {
        assembly {
            let impl := sload(IMPLEMENTATION_SLOT)
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    function _checkImplementation(address newImplementation) internal view {
        IImplementation(newImplementation).checkUpgrade_1T96KW();
    }

    function _setImplementation(address newImplementation) internal {
        address current = _implementation();
        require(current != newImplementation);
        _storeImplementation(newImplementation);
    }

    function _storeImplementation(address newImplementation) internal {
        assembly {
            sstore(IMPLEMENTATION_SLOT, newImplementation)
        }
    }

    function _implementation() internal view returns (address impl) {
        assembly {
            impl := sload(IMPLEMENTATION_SLOT)
        }
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.