Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x2EcAD4280b7720Ba4F3830B47AB8eF2dA4763f04
Balance 0 ETH
Nonce 1
Code Size 576 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

576 bytes
0x6080604052600436106100225760003560e01c8063aaf10f421461010d57610074565b366100745760405162461bcd60e51b815260206004820152601e60248201527f446f6573206e6f7420616363657074204574686572206465706f73697473000060448201526064015b60405180910390fd5b600061007e61013e565b90506001600160a01b0381166100e85760405162461bcd60e51b815260206004820152602960248201527f50726f78793a20696d706c656d656e746174696f6e20697320746865207a65726044820152686f206164647265737360b81b606482015260840161006b565b60405136600082376000803683855af43d806000843e818015610109578184f35b8184fd5b34801561011957600080fd5b506101226101d0565b6040516001600160a01b03909116815260200160405180910390f35b7fe776daafc4820f23714ae13a96bd4aa162bffacfe02911a8027c0de390f831555460408051635c60da1b60e01b815290516000926001600160a01b031691635c60da1b9160048083019260209291908290030181865afa1580156101a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cb91906101da565b905090565b60006101cb61013e565b6000602082840312156101ec57600080fd5b81516001600160a01b038116811461020357600080fd5b939250505056fea264697066735822122022a22dd8b4dc70f9075bdaf1e20ab4318e3f09ed1f0e68a64965bf0600d6e0de64736f6c63430008130033

Verified Source Code Full Match

Compiler: v0.8.19+commit.7dd6d404 EVM: paris Optimization: Yes (200 runs)
Proxy.sol 89 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {IBeacon} from "../common/interfaces/IBeacon.sol";
import {StorageSlot} from "../common/libraries/StorageSlot.sol";

/**
 * @title Proxy
 * @dev Implementation of the Proxy contract to delegate calls to implementation contracts.
 * @custom:security-contact [email protected]
 */
contract Proxy {
    using StorageSlot for StorageSlot.AddressSlot;

    /// @notice The slot for the Beacon address.
    bytes32 internal constant _BEACON_SLOT = keccak256("proxy.beacon");

    /// @notice The slot for the initialization owner address.
    bytes32 internal constant _INIT_OWNER_SLOT = keccak256("proxy.initializationOwnerAddress");

    /// @notice The event for beacon address change.
    event BeaconChanged(address indexed previousBeacon, address indexed newBeacon);

    /**
     * @notice Constructor to initialize the proxy with a beacon address and initialization owner address.
     * Requirements:
     * - The `beacon_` address cannot be the zero address.
     * @param beacon_ The beacon address.
     * @param initData The initialization data.
     */
    constructor(
        address beacon_,
        bytes memory initData
    ) {
        require(beacon_ != address(0), "Proxy: new beacon is the zero address");
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = beacon_;
        emit BeaconChanged(address(0), beacon_);

        StorageSlot.getAddressSlot(_INIT_OWNER_SLOT).value = msg.sender;

        address implementationAddress = _implementation();
        (bool success, ) = implementationAddress.delegatecall(
            initData
            );
        require(success, "Proxy: Initialization failed");
    }

    /**
     * @notice Fallback function to delegate calls to the implementation contract.
     */
    fallback() external payable {
        address impl = _implementation();
        require(impl != address(0), "Proxy: implementation is the zero address");

        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize())
            let result := delegatecall(gas(), impl, ptr, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(ptr, 0, size)
            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }

    /**
     * @notice Receive function to reject Ether deposits.
     */
    receive() external payable {
        revert("Does not accept Ether deposits");
    }

    /**
     * @notice Retrieves the current implementation address.
     * @return The current implementation address.
     */
    function getImplementation() external view returns (address) {
        return _implementation();
    }

    /**
     * @notice Retrieves the current implementation address.
     * @return The current implementation address.
     */
    function _implementation() internal view returns (address) {
        return IBeacon(StorageSlot.getAddressSlot(_BEACON_SLOT).value).implementation();
    }
}
IBeacon.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/**
 * @dev Interface for Beacon contract
 */
interface IBeacon {
    /**
     * @dev Returns the implementation address of the Beacon contract
     * @return The implementation address
     */
    function implementation() external view returns (address);
}
StorageSlot.sol 350 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity 0.8.19;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    /// @notice The slot for address.
    struct AddressSlot {
        address value;
    }

    /// @notice The slot for boolean.
    struct BooleanSlot {
        bool value;
    }

    /// @notice The slot for bytes32.
    struct Bytes32Slot {
        bytes32 value;
    }

    /// @notice The slot for uint256.
    struct Uint256Slot {
        uint256 value;
    }

    /// @notice The slot for string.
    struct StringSlot {
        string value;
    }

    /// @notice The slot for bytes.
    struct BytesSlot {
        bytes value;
    }

    /// @notice The slot for uint8.
    struct Uint8Slot {
        uint8 value;
    }

    /// @notice The slot for bytes array.
    struct BytesArraySlot {
        bytes[] value;
    }

    /// @notice The slot for uint256 array.
    struct Uint256ArraySlot {
        uint256[] value;
    }

    /// @notice The slot for uint256 mapping.
    struct Uint256MappingSlot {
        mapping(uint256 => uint256) value;
    }

    /// @notice The slot for uint256 string mapping.
    struct Uint256StringMappingSlot {
        mapping(uint256 => string) value;
    }

    /// @notice The slot for uint256 address mapping.
    struct Uint256AddressMappingSlot {
        mapping(uint256 => address) value;
    }

    /// @notice The slot for address uint256 mapping.
    struct AddressUint256MappingSlot {
        mapping(address => uint256) value;
    }

    /// @notice The slot for address mapping address boolean mapping.
    struct AddressMappingAddressBooleanMappingSlot {
        mapping(address => mapping(address => bool)) value;
    }

    /// @notice The slot for address mapping uint256 mapping.
    struct AddressMappingUint256MappingSlot {
        mapping(address => mapping(uint256 => uint256)) value;
    }

    /// @notice The slot for bytes address mapping.
    struct BytesAddressMappingSlot {
        mapping(bytes => address) value;
    }

    /// @notice The slot for bytes uint8 mapping.
    struct BytesUint8MappingSlot {
        mapping(bytes => uint8) value;
    }

    /// @notice The slot for bytes uint256 mapping.
    struct BytesUintMappingSlot {
        mapping(bytes => uint256) value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Uint8Slot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint8Slot(bytes32 slot) internal pure returns (Uint8Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     * @param store The storage pointer to read from.
     * @return r The slot value.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     * @param store The storage pointer to read from.
     * @return r The slot value.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesArraySlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytesArraySlot(bytes32 slot) internal pure returns (BytesArraySlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256ArraySlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint256ArraySlot(bytes32 slot) internal pure returns (Uint256ArraySlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256MappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint256MappingSlot(bytes32 slot) internal pure returns (Uint256MappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256StringMappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint256StringMappingSlot(bytes32 slot) internal pure returns (Uint256StringMappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256AddressMappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getUint256AddressMappingSlot(bytes32 slot) internal pure returns (Uint256AddressMappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `AddressUint256MappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getAddressUint256MappingSlot(bytes32 slot) internal pure returns (AddressUint256MappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `AddressMappingAddressBooleanMappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getAddressMappingAddressBooleanMappingSlot(bytes32 slot) internal pure returns (AddressMappingAddressBooleanMappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `AddressMappingUint256MappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getAddressMappingUint256MappingSlot(bytes32 slot) internal pure returns (AddressMappingUint256MappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BytesAddressMappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytesAddressMappingSlot(bytes32 slot) internal pure returns (BytesAddressMappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BytesUint8MappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytesUint8MappingSlot(bytes32 slot) internal pure returns (BytesUint8MappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BytesUintMappingSlot` with member `value` located at `slot`.
     * @param slot The slot to read from.
     * @return r The slot value.
     */
    function getBytesUintMappingSlot(bytes32 slot) internal pure returns (BytesUintMappingSlot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

Read Contract

getImplementation 0xaaf10f42 → address

Recent Transactions

No transactions found for this address