{"sources":{"src/tokens/interfaces/IBeacon.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IBeacon {\n    function implementation() external view returns (address);\n}\n"},"src/common/libraries/StorageSlot.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n    \n    // New struct for Uint8Slot\n    struct Uint8Slot {\n        uint8 value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Uint8Slot` with member `value` located at `slot`.\n     */\n    function getUint8Slot(bytes32 slot) internal pure returns (Uint8Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}"},"src/proxies/Proxy.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"../tokens/interfaces/IBeacon.sol\";\nimport \"../common/libraries/StorageSlot.sol\";\n\n/**\n * @title Proxy\n * @dev Implementation of the Proxy contract to delegate calls to implementation contracts.\n */\ncontract Proxy {\n    using StorageSlot for StorageSlot.AddressSlot;\n\n    bytes32 internal constant _BEACON_SLOT = keccak256(\"proxy.beacon\");\n    bytes32 internal constant _INIT_OWNER_SLOT = keccak256(\"proxy.initializationOwnerAddress\");\n    \n    event BeaconChanged(address indexed previousBeacon, address indexed newBeacon);\n\n    constructor(\n        address beacon_,\n        bytes memory initData\n    ) {\n        require(beacon_ != address(0), \"Proxy: new beacon is the zero address\");\n        StorageSlot.getAddressSlot(_BEACON_SLOT).value = beacon_;\n        emit BeaconChanged(address(0), beacon_);\n\n        StorageSlot.getAddressSlot(_INIT_OWNER_SLOT).value = msg.sender;\n\n        address implementationAddress = _implementation();\n        (bool success, ) = implementationAddress.delegatecall(\n            initData\n            );\n        require(success, \"Proxy: Initialization failed\");\n    }\n\n    function _implementation() internal view returns (address) {\n        return IBeacon(StorageSlot.getAddressSlot(_BEACON_SLOT).value).implementation();\n    }\n\n    function getImplementation() external view returns (address) {\n        return _implementation();\n    }\n\n    fallback() external payable {\n        address impl = _implementation();\n        require(impl != address(0), \"Proxy: implementation is the zero address\");\n\n        assembly {\n            let ptr := mload(0x40)\n            calldatacopy(ptr, 0, calldatasize())\n            let result := delegatecall(gas(), impl, ptr, calldatasize(), 0, 0)\n            let size := returndatasize()\n            returndatacopy(ptr, 0, size)\n            switch result\n            case 0 { revert(ptr, size) }\n            default { return(ptr, size) }\n        }\n    }\n\n    receive() external payable {\n        revert(\"Does not accept Ether deposits\");\n    }\n}\n"}},"compilation":{"language":"Solidity","compiler":"solc","compilerVersion":"0.8.19+commit.7dd6d404","compilerSettings":{"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"optimizer":{"runs":200,"enabled":true},"evmVersion":"paris","remappings":[":forge-std/=lib/forge-std/src/"]},"name":"Proxy","fullyQualifiedName":"src/proxies/Proxy.sol:Proxy"},"matchId":"5362052","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2024-09-14T18:45:26Z","match":"exact_match","chainId":"1","address":"0x1feCF3d9d4Fee7f2c02917A66028a48C6706c179"}