ETH Price: $2,129.21 (+3.07%)

Contract Diff Checker

Contract Name:
SafeProxy

Contract Source Code:

File 1 of 1 : SafeProxy

// SPDX-License-Identifier: LGPL-3.0-only
/* solhint-disable one-contract-per-file */
pragma solidity >=0.7.0 <0.9.0;

interface IProxy {
    function masterCopy() external view returns (address);
}

contract SafeProxy {
    address internal singleton;

    constructor(address _singleton) {
        require(_singleton != address(0), "Invalid singleton address provided");
        singleton = _singleton;
    }

    fallback() external payable {
        assembly {
            let _singleton := sload(0)
            if eq(shr(224, calldataload(0)), 0xa619486e) {
                mstore(0x6c, shl(96, _singleton))
                return(0x60, 0x20)
            }
            calldatacopy(0, 0, calldatasize())
            let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            if iszero(success) {
                revert(0, returndatasize())
            }
            return(0, returndatasize())
        }
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):