creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/Bridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./sn/Cairo.sol\";\nimport \"./token/ERC721Bridgeable.sol\";\nimport \"./token/TokenUtil.sol\";\nimport \"./token/CollectionManager.sol\";\nimport \"./Protocol.sol\";\nimport \"./State.sol\";\nimport \"./Escrow.sol\";\nimport \"./Messaging.sol\";\nimport \"./UUPSProxied.sol\";\n\nimport \"starknet/IStarknetMessaging.sol\";\n\nimport \"./IStarklaneEvent.sol\";\n\nerror NotSupportedYetError();\nerror CollectionMappingError();\nerror NotWhiteListedError();\nerror BridgeNotEnabledError();\n\n/**\n   @title Starklane bridge contract.\n*/\ncontract Starklane is IStarklaneEvent, UUPSOwnableProxied, StarklaneState, StarklaneEscrow, StarklaneMessaging, CollectionManager {\n\n    // Mapping (collectionAddress => bool)\n    mapping(address => bool) _whiteList;\n    address[] _collections;\n    bool _enabled;\n    bool _whiteListEnabled;\n\n\n    /**\n       @notice Initializes the implementation, only callable once.\n\n       @param data Data to init the implementation.\n    */\n    function initialize(\n        bytes calldata data\n    )\n        public\n        onlyInit\n    {\n        (\n            address owner,\n            IStarknetMessaging starknetCoreAddress,\n            uint256 starklaneL2Address,\n            uint256 starklaneL2Selector\n        ) = abi.decode(\n            data,\n            (address, IStarknetMessaging, uint256, uint256)\n        );\n        _enabled = false;\n        _starknetCoreAddress = starknetCoreAddress;\n\n        _transferOwnership(owner);\n\n        setStarklaneL2Address(starklaneL2Address);\n        setStarklaneL2Selector(starklaneL2Selector);\n    }\n\n    /**\n       @notice Deposits token in escrow and initiates the\n       transfer to Starknet. Will revert if any of the token is missing approval\n       for the bridge as operator.\n\n       @param salt A salt used to generate the request hash.\n       @param collectionL1 Address of the collection contract.\n       @param ownerL2 New owner address on Starknet.\n       @param ids Ids of the token to transfer. At least 1 token is required.\n    */\n    function depositTokens(\n        uint256 salt,\n        address collectionL1,\n        snaddress ownerL2,\n        uint256[] calldata ids,\n        bool useAutoBurn\n    )\n        external\n        payable\n    {\n        if (!Cairo.isFelt252(snaddress.unwrap(ownerL2))) {\n            revert CairoWrapError();\n        }\n        if (!_enabled) {\n            revert BridgeNotEnabledError();\n        }\n\n        CollectionType ctype = TokenUtil.detectInterface(collectionL1);\n        if (ctype == CollectionType.ERC1155) {\n            revert NotSupportedYetError();\n        }\n\n        if (!_isWhiteListed(collectionL1)) {\n            revert NotWhiteListedError();\n        }\n\n        Request memory req;\n\n        // The withdraw auto is only available for request originated from\n        // Starknet side as the withdraw on starknet is automatically done\n        // by the sequencer.\n        req.header = Protocol.requestHeaderV1(ctype, useAutoBurn, false);\n        req.hash = Protocol.requestHash(salt, collectionL1, ownerL2, ids);\n        // TODO: store request hash in storage to avoid replay attack.\n        //       or can it be safe to use block timestamp? Not sure as\n        //       several tx may have the exact same block.\n        req.collectionL1 = collectionL1;\n        req.collectionL2 = _l1ToL2Addresses[collectionL1];\n\n        req.ownerL1 = msg.sender;\n        req.ownerL2 = ownerL2;\n\n        if (ctype == CollectionType.ERC721) {\n            (req.name, req.symbol, req.uri, req.tokenURIs) = TokenUtil.erc721Metadata(\n                collectionL1,\n                ids\n            );\n        } else {\n            (req.uri) = TokenUtil.erc1155Metadata(collectionL1);\n        }\n\n        _depositIntoEscrow(ctype, collectionL1, ids);\n\n        req.tokenIds = ids;\n\n        uint256[] memory payload = Protocol.requestSerialize(req);\n\n        IStarknetMessaging(_starknetCoreAddress).sendMessageToL2{value: msg.value}(\n            snaddress.unwrap(_starklaneL2Address),\n            felt252.unwrap(_starklaneL2Selector),\n            payload\n        );\n\n        emit DepositRequestInitiated(req.hash, block.timestamp, payload);\n    }\n\n    /**\n       @notice Withdraw tokens received from L2.\n\n       @param request Serialized request containing the tokens to be withdrawed. \n\n       @return Address of the collection targetted by the request (or newly deployed).\n    */\n    function withdrawTokens(\n        uint256[] calldata request\n    )\n        external\n        payable\n        returns (address)\n    {\n        if (!_enabled) {\n            revert BridgeNotEnabledError();\n        }\n\n        // Header is always the first uint256 of the serialized request.\n        uint256 header = request[0];\n\n        // Any error or permission fail in the message consumption will cause a revert.\n        // After message being consumed, it is considered legit and tokens can be withdrawn.\n        if (Protocol.canUseWithdrawAuto(header)) {\n            // 2024-03-19: disabled autoWithdraw after audit report\n            // _consumeMessageAutoWithdraw(_starklaneL2Address, request);\n            revert NotSupportedYetError();\n        } else {\n            _consumeMessageStarknet(_starknetCoreAddress, _starklaneL2Address, request);\n        }\n\n        Request memory req = Protocol.requestDeserialize(request, 0);\n\n        address collectionL1 = _verifyRequestAddresses(req.collectionL1, req.collectionL2);\n\n        CollectionType ctype = Protocol.collectionTypeFromHeader(header);\n\n        if (collectionL1 == address(0x0)) {\n            if (ctype == CollectionType.ERC721) {\n                collectionL1 = _deployERC721Bridgeable(\n                    req.name,\n                    req.symbol,\n                    req.collectionL2,\n                    req.hash\n                );\n            } else {\n                revert NotSupportedYetError();\n            }\n        }\n\n        for (uint256 i = 0; i < req.tokenIds.length; i++) {\n            uint256 id = req.tokenIds[i];\n\n            bool wasEscrowed = _withdrawFromEscrow(ctype, collectionL1, req.ownerL1, id);\n\n            if (!wasEscrowed) {\n                // TODO: perhaps, implement the same interface for ERC721 and ERC1155\n                // As we only want to deal with ERC1155 token with value = 1.\n                // Also, check what to do with URIs. If the URI storage is supported\n                // or not for ERC721. If supported, we may need to mint with an URI.\n                IERC721Bridgeable(collectionL1).mintFromBridge(req.ownerL1, id);\n            }\n        }\n\n        emit WithdrawRequestCompleted(req.hash, block.timestamp, request);\n\n        return collectionL1;\n    }\n\n    /**\n        @notice Start the cancellation of a given request.\n     \n        @param payload Request to cancel\n        @param nonce Nonce used for request sending.\n     */\n    function startRequestCancellation(\n        uint256[] memory payload,\n        uint256 nonce\n    ) external onlyOwner {\n        IStarknetMessaging(_starknetCoreAddress).startL1ToL2MessageCancellation(\n            snaddress.unwrap(_starklaneL2Address), \n            felt252.unwrap(_starklaneL2Selector), \n            payload,\n            nonce\n        );\n        Request memory req = Protocol.requestDeserialize(payload, 0);\n        emit CancelRequestStarted(req.hash, block.timestamp);\n    }\n\n    /**\n        @notice Cancel a given request.\n\n        @param payload Request to cancel\n        @param nonce Nonce used for request sending.\n     */\n    function cancelRequest(\n        uint256[] memory payload,\n        uint256 nonce\n    ) external {\n        IStarknetMessaging(_starknetCoreAddress).cancelL1ToL2Message(\n            snaddress.unwrap(_starklaneL2Address), \n            felt252.unwrap(_starklaneL2Selector), \n            payload,\n            nonce\n        );\n        Request memory req = Protocol.requestDeserialize(payload, 0);\n        _cancelRequest(req);\n        emit CancelRequestCompleted(req.hash, block.timestamp);\n    }\n\n    function _cancelRequest(Request memory req) internal {\n        uint256 header = felt252.unwrap(req.header);\n        CollectionType ctype = Protocol.collectionTypeFromHeader(header);\n        address collectionL1 = req.collectionL1;\n        for (uint256 i = 0; i < req.tokenIds.length; i++) {\n            uint256 id = req.tokenIds[i];\n            _withdrawFromEscrow(ctype, collectionL1, req.ownerL1, id);\n        }\n    }\n\n    /**\n        @notice Enable collection whitelist for deposit\n\n        @param enable white list is enabled if true\n     */\n    function enableWhiteList(bool enable) external onlyOwner {\n        _whiteListEnabled = enable;\n        emit WhiteListUpdated(_whiteListEnabled);\n    }\n\n    /**\n        @notice Update whitelist status for given collection\n\n        @param collection Collection address\n        @param enable white list is enabled if true\n     */\n    function whiteList(address collection, bool enable) external onlyOwner {\n        if (enable && !_whiteList[collection]) {\n            bool toAdd = true;\n            uint256 i = 0;\n            while(i < _collections.length) {\n                if (collection == _collections[i]) {\n                    toAdd = false;\n                    break;\n                }\n                i++;\n            }\n            if (toAdd) {\n                _collections.push(collection);\n            }\n        }\n        _whiteList[collection] = enable;\n        emit CollectionWhiteListUpdated(collection, enable);\n    }\n    \n    \n    /**\n        @notice Check if white list is globally enabled\n\n        @return true if enabled\n    */\n    function isWhiteListEnabled() external view returns (bool) {\n        return _whiteListEnabled;\n    }\n\n    /**\n        @notice Check if a collection is white listed\n    \n        @param collection Address of collection\n        @return true if white listed\n     */\n    function isWhiteListed(address collection) external view returns (bool) {\n        return _isWhiteListed(collection);\n    }\n    \n    /**\n        @notice Get list of white listed collections\n\n        @return array of white listed collections\n     */\n    function getWhiteListedCollections() external view returns (address[] memory) {\n        uint256 offset = 0;\n        uint256 nbElem = _collections.length;\n        // solidity doesn't support dynamic length array in memory\n        address[] memory ret = new address[](nbElem);\n        for (uint256 i = 0; i < nbElem ;++i) {\n            address cur = _collections[i];\n            if (_whiteList[cur]) {\n                ret[offset] = cur;\n                offset += 1;\n            }\n        }\n        // resize output array\n        assembly {\n            mstore(ret, offset)\n        }\n        \n        return ret;\n    }\n\n    function _isWhiteListed(\n        address collection\n    ) internal view returns (bool) {\n        return !_whiteListEnabled || _whiteList[collection];\n    }\n\n    function enableBridge(\n        bool enable\n    ) external onlyOwner {\n        _enabled = enable;\n    }\n\n    function isEnabled() external view returns(bool) {\n        return _enabled;\n    }\n\n    function setL1L2CollectionMapping(\n        address collectionL1,\n        snaddress collectionL2,\n        bool force\n    ) external onlyOwner {\n        _setL1L2AddressMapping(collectionL1, collectionL2, force);\n        emit L1L2CollectionMappingUpdated(collectionL1, snaddress.unwrap(collectionL2));\n    }\n\n}\n"
      },
      "src/sn/Cairo.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.8;\n\nimport \"openzeppelin-contracts/contracts/utils/Strings.sol\";\n\ntype felt252 is uint256;\ntype snaddress is uint256;\n\n// TODO: add offset / array size checks for serialization.\n// TODO: USE ASSERT instead of REQUIRE if it's only code logic checking.\n//       USE ASSERT for all bound / offset checks.\n\n/*\n   Modulus used for computation in Starknet. This is the maximum value.\n \n   https://github.com/starkware-libs/cairo/blob/08efd7158bf1ef012fa6b42b3429a398e1a75e26/crates/cairo-lang-runner/src/casm_run/mod.rs#L52\n   2  251 + 17  2  192 + 1;\n*/\nuint256 constant SN_MODULUS =\n    3618502788666131213697322783095070105623107215331596699973092056135872020481;\n\n/*\n   Cairo Short String are 31 characters long.\n \n   TODO: check how UTF-8 may be supported.\n   but at the moment, everything is\n   packed at byte level.\n*/\nuint256 constant CAIRO_STR_LEN = 31;\n\nerror CairoWrapError();\n\n/**\n   @title Adapter library to ensure compatibility with Cairo.\n \n   Cairo works with felts (252 bits), so a felt always fits into a single uint256,\n   but a uint256 may overflow.\n   To convert a uint256 into a felt, the first 6 bits must be cleared.\n*/\nlibrary Cairo {\n\n    /**\n       @notice Verifies if the given uint256 can be considered\n       as a felt252.\n\n       @param val Value to be checked as a felt252.\n\n       @return True if the value can fit into a felt252, false otherwise.\n    */\n    function isFelt252(\n        uint256 val\n    )\n        internal\n        pure\n        returns (bool)\n    {\n        return val < SN_MODULUS;\n    }\n\n    /**\n       @notice Wraps an uint256 into a felt252.\n       Ensures that the val can fit into a felt252.\n       \n       @param val Value to be wrapped.\n\n       @return felt252 with wrapped value.\n\n       @dev Reverts if val is too large for felt252.\n     */\n    function felt252Wrap(\n        uint256 val\n    )\n        internal\n        pure\n        returns (felt252)\n    {\n        if (!isFelt252(val)) {\n            revert CairoWrapError();\n        }\n\n        return felt252.wrap(val);\n    }\n\n    /**\n       @notice Wraps an uint256 into a snaddress.\n       Ensures that the val can fit into a felt252.\n\n       @param val Value to be wrapped.\n\n       @return snaddress with wrapped value.\n\n       @dev Reverts if val is too large for felt252.\n    */\n    function snaddressWrap(\n        uint256 val\n    )\n        internal\n        pure\n        returns (snaddress)\n    {\n        if (!isFelt252(val)) {\n            revert CairoWrapError();\n        }\n\n        return snaddress.wrap(val);\n    }\n\n    /**\n       @notice Serializes the given uint256 as a felt252 (low and high parts).\n\n       @param val Value to be serialized.\n       @param buf Buffer where serialized form is saved.\n       @param offset Offset in `buf` where serialization must start.\n\n       @return Offset increment applied to serialize the value.\n    */\n    function uint256Serialize(\n        uint256 val,\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256)\n    {    \n        buf[offset] = uint128(val);\n        buf[offset + 1] = uint128(val >> 128);\n        return 2;\n    }\n\n    /**\n       @notice Deserializes an uint256 from the given buffer.\n\n       @param buf Buffer where data is serialized.\n       @param offset Offset in `buf` where deserialization must start.\n\n       @return The deserialized value.\n    */\n    function uint256Deserialize(\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        // u256 in cairo is 2 felts long with low and high parts.\n        return (buf[offset + 1] << 128) | uint128(buf[offset]);\n    }\n\n    /**\n       @notice Serializes an array of uint256.\n\n       @param arr Array to be serialized.\n       @param buf Buffer where serialized form is saved.\n       @param offset Offset in `buf` where serialization must start.\n\n       @return Offset increment applied to serialize the value.\n    */\n    function uint256ArraySerialize(\n        uint256[] memory arr,\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        uint256 _offset = offset;\n\n        // Arrays always have their length first in Cairo.\n        buf[_offset] = arr.length;\n        _offset++;\n\n        for (uint256 i = 0; i < arr.length; i++) {\n            _offset += uint256Serialize(arr[i], buf, _offset);\n        }\n\n        return _offset - offset;\n    }\n\n    /**\n       @notice Deserializes an array of uint256 from the given buffer.\n\n       @param buf Buffer where data is serialized.\n       @param offset Offset in `buf` where deserialization must start.\n\n       @return The offset increment applied to deserialize and the deserialized value.\n    */\n    function uint256ArrayDeserialize(\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256, uint256[] memory)\n    {\n        uint256 len = buf[offset++];\n        uint256[] memory uints = new uint256[](len);\n\n        for (uint256 i = 0; i < len; i++) {\n            uints[i] = uint256Deserialize(buf, offset);\n            offset += 2;\n        }\n\n        // + 1 to include array size itself.\n        // *2 because uint256 in cairo is 2 felt252 long.\n        return ((len * 2) + 1, uints);\n    }\n\n\n\n    /**\n        @notice Unpacks a cairo string (byte array) into a string.\n     \n        @param buf Buffer where the string is packed as a cairo string.\n        @param offset Offset where the unpack must start.\n        \n        @return Unpacked string.\n     */\n    function cairoStringUnpack(\n        uint256[] memory buf, \n        uint256 offset\n    ) \n        internal \n        pure \n        returns (string memory) \n    {\n        string memory s;\n        uint256 dataLen = buf[offset];\n        offset += 1;\n        for (uint256 i = offset; i < (offset + dataLen); ++i) {\n            s = string.concat(s, uint256AsciiNbcharsToString(buf[i], uint8(CAIRO_STR_LEN)));\n        }\n        offset += dataLen;\n        \n        // handle pending word\n        uint8 nbChars = uint8(buf[offset + 1] & 0xFF);\n        s = string.concat(s, uint256AsciiNbcharsToString(buf[offset], nbChars));\n        return s;\n    }\n\n    /**\n        @notice Packs a string into an array of uint256 (Cairo byte array string)\n\n        @dev Cairo (byte array) string are chunk by 31 bytes.\n     */\n    function cairoStringPack(\n        string memory str\n    )\n        internal\n        pure\n        returns (uint256[] memory)\n    {\n        bytes memory strBytes = bytes(str);\n        uint256 dataLen = strBytes.length / CAIRO_STR_LEN;\n        uint256 pendingLen = strBytes.length % CAIRO_STR_LEN;\n\n        uint256 packedLen = 1 + dataLen + 1 + 1;\n        uint256[] memory packedData = new uint256[](packedLen);\n        \n        uint256 index = 0;\n        uint256 v;\n        uint256 offset = 0x20; // length is first u256\n\n        packedData[index] = dataLen;\n        index++;\n\n        for (uint256 i = 0; i < dataLen; i ++) {\n            assembly { \n                v := mload(add(strBytes, offset)) \n                v := shr(8, v)\n                }\n\n            packedData[index] = v;\n            index++;\n            offset += CAIRO_STR_LEN;\n        }\n\n        // pending word\n        assembly { \n            v := mload(add(strBytes, offset))\n            v := shr(mul(sub(32, pendingLen), 8),v)\n        }\n                \n        packedData[index] = v;\n        index++;\n\n        packedData[index] = pendingLen;\n\n        return packedData;\n    }\n\n    /**\n        @notice Deserializes a cairo (byte array) string from the given buffer\n\n        @param buf Buffer where data is serialized.\n        @param offset Offset in `buf` where deserialization must start.\n\n        @return The offset increment applied to deserialize and the deserialized value.\n    */\n    function cairoStringDeserialize(\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256, string memory)\n    {\n        string memory s = cairoStringUnpack(buf, offset);\n        uint256 packedLen = 1 + buf[offset] + 1 + 1;\n        return (packedLen, s);\n    }\n\n    /** \n        @notice Commputes the length of the packed cairo string.\n\n        @dev Same schema as Cairo byteArray serialize.\n    */\n    function cairoStringSerializedLength(\n        string memory str\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        bytes memory strBytes = bytes(str);\n        uint256 dataLen = strBytes.length / CAIRO_STR_LEN;\n        uint256 packedLen = 1 + dataLen + 1 + 1;\n        return packedLen;\n    }\n\n    /**\n        @notice Serializes a string into a cairo (byte array) string.\n\n        @param str String to be serialized.\n        @param buf Buffer where serialized form is saved.\n        @param offset Offset in `buf` where serialization must start.\n\n        @return Offset increment applied to serialize the value.\n     */\n    function cairoStringSerialize(\n        string memory str,\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        uint256[] memory packed = cairoStringPack(str);\n        for (uint256 i = 0; i < packed.length; i++) {\n            buf[offset + i] = packed[i];\n        }\n        return packed.length;\n    }\n\n    /**\n        @notice Serializes an array for strings as cairo array of strings.\n\n        @param arr Array to be serialized.\n        @param buf Buffer where serialized form is saved.\n        @param offset Offset in `buf` where serialization must start.\n\n        @return Offset increment applied to serialize the value.\n     */\n    function cairoStringArraySerialize(\n        string[] memory arr,\n        uint256[] memory buf,\n        uint256 offset\n    ) \n        internal\n        pure\n        returns (uint256)\n    {\n        uint256 _offset = offset;\n\n        buf[_offset++] = arr.length;\n\n        for (uint256 i = 0; i < arr.length; i++) {\n            _offset += cairoStringSerialize(arr[i], buf, _offset);\n        }\n\n        return _offset - offset;\n    }\n\n    /**\n        @notice Deserializes an array of cairo strin from the given buffer.\n\n        @param buf Buffer where data is serialized.\n        @param offset Offset in `buf` where deserialization must start.\n\n        @return The offset increment applied to deserialize and the deserialized value.\n     */\n    function cairoStringArrayDeserialize(\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (uint256, string[] memory)\n    {\n        uint256 _offset = offset;\n\n        uint256 len = buf[_offset++];\n        string[] memory strs = new string[](len);\n\n        for (uint256 i = 0; i < len; i++) {\n            (\n                uint256 inc,\n                string memory s \n            ) = cairoStringDeserialize(buf, _offset);\n\n            _offset += inc;\n            strs[i] = s;\n        }\n\n        return (_offset - offset, strs);\n    }\n\n    /**\n       @notice Converts an uint256 containing ascii characters\n       as a string.\n\n       @param value String from ascii characters.\n    */\n    function uint256AsciiToString(\n        uint256 value\n    )\n        internal\n        pure\n        returns (string memory)\n    {\n        return uint256AsciiNbcharsToString(value, uint8(CAIRO_STR_LEN));\n    }\n\n    function uint256AsciiNbcharsToString(\n        uint256 value,\n        uint8 length\n    )\n        internal\n        pure\n        returns (string memory)\n    {\n        string memory s = new string(length);\n        bytes memory byteString = bytes(s);\n\n        // cairo string is 31 bytes with first character as higher bit\n        for (uint256 i = 0; i < length; ++i) {\n            uint256 asciiValue = (value >> (8 * (length - 1 - i))) & 0xFF;\n            byteString[i] = bytes1(uint8(asciiValue));\n        }\n\n        return s;\n    }\n\n\n}\n"
      },
      "src/token/ERC721Bridgeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/token/ERC721/ERC721.sol\";\n\nimport \"./IERC721Bridgeable.sol\";\nimport \"../UUPSProxied.sol\";\n\n/**\n   @title ERC721 that can be minted by the bridge.\n \n   @dev As this ERC721 must be upgradable, the name and symbol must\n   be overriden to work correctly, as the constructor can't be called,\n   but initialization function instead.\n*/\ncontract ERC721Bridgeable is ERC721, UUPSOwnableProxied, IERC721Bridgeable {\n\n    // Descriptive name for the token collection.\n    string private _name;\n\n    // Abbreviated name for the token collection.\n    string private _symbol;\n\n    /**\n       @notice Default constructor, but intialize is used instead.\n    */\n    constructor()\n        ERC721(\"\", \"\")\n    { }\n\n    /**\n       @notice Initializes the implementation, only callable once.\n\n       @param data Data to init the implementation.\n    */\n    function initialize(\n        bytes calldata data\n    )\n        public\n        onlyInit\n    {\n        (string memory n, string memory s) = abi.decode(data, (string, string));\n\n        _name = n;\n        _symbol = s;\n\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n       @notice A free minting for testing.\n    */\n    function mintRangeFree(\n        address to,\n        uint256 idStart,\n        uint256 idEnd\n    )\n        external\n    {\n        require(idStart < idEnd, \"Bad range\");\n\n        uint256 id = idStart;\n\n        for (id; id <= idEnd; id++) {\n            _mint(to, id);\n        }\n    }\n\n    /**\n       @inheritdoc IERC721Bridgeable\n\n       @dev In this implementation, the owner is the bridge by default. So `onlyOwner`\n       is enough.\n    */\n    function mintFromBridge(address to, uint256 id)\n        public\n        onlyOwner {\n\n        _mint(to, id);\n    }\n\n    /**\n       @inheritdoc IERC721Bridgeable\n\n       @dev In this implementation, the owner is the bridge by default. So `onlyOwner`\n       is enough.\n    */\n    function burnFromBridge(uint256 id)\n        public\n        onlyOwner {\n\n        _burn(id);\n    }\n\n    /**\n       @notice base URI for the tokens.\n\n       @dev By default empty, or perhaps we can target a default URI?\n    */\n    function _baseURI()\n        internal\n        pure\n        override\n        returns (string memory) {\n        return \"\";\n    }\n\n    /**\n       @notice A descriptive name for the token collection.\n\n       @dev `name()` must be overriden as the underlying value\n       is private, then not accessible for this contract (which extends\n       the base ERC721 contract).\n    */\n    function name()\n        public\n        view\n        override\n        returns (string memory)\n    {\n        return _name;\n    }\n\n    /**\n       @notice An abbreviated name for the token collection.\n\n       @dev `symbol()` must be overriden as the underlying value\n       is private, then not accessible for this contract (which extends\n       the base ERC721 contract).\n    */\n    function symbol()\n        public\n        view\n        override\n        returns (string memory)\n    {\n        return _symbol;\n    }\n}\n\n"
      },
      "src/token/TokenUtil.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/token/ERC721/IERC721.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Supply.sol\";\nimport \"openzeppelin-contracts/contracts/utils/introspection/ERC165Checker.sol\";\n\n/**\n   @notice Collection type that are supported by the bridge.\n */\nenum CollectionType {\n    ERC721,\n    ERC1155\n}\n\nerror UnsupportedTokenStandard();\n\n\n/**\n   @title Utils functions for token related stuff.\n*/\nlibrary TokenUtil {\n\n    /**\n       @notice Detects the token contract interface.\n\n       @param collection Address of the contract to be verified.\n\n       @return CollectionType.\n     */\n    function detectInterface(\n        address collection\n    )\n        internal\n        view\n        returns (CollectionType)\n    {\n        bool supportsERC721 = ERC165Checker.supportsInterface(\n            collection,\n            type(IERC721).interfaceId\n        );\n\n        if (supportsERC721) {\n            return CollectionType.ERC721;\n        }\n\n        bool supportsERC1155 = ERC165Checker.supportsInterface(\n            collection,\n            type(IERC1155).interfaceId\n        );\n\n        if (supportsERC1155) {\n            return CollectionType.ERC1155;\n        }\n\n        revert UnsupportedTokenStandard();\n    }\n\n    /**\n       @notice Retrieves metadata from ERC721 token, if it supports it.\n\n       @param collection Address of the ERC721 contract.\n       @param tokenIds Ids of the tokens to get tokenURI from.\n\n       @return (name, symbol, baseuri, tokenURIs).\n     */\n    function erc721Metadata(\n        address collection,\n        uint256[] memory tokenIds\n    )\n        internal\n        view\n        returns (string memory, string memory, string memory, string[] memory)\n    {        \n        bool supportsMetadata = ERC165Checker.supportsInterface(\n            collection,\n            type(IERC721Metadata).interfaceId\n        );\n        \n        if (!supportsMetadata) {\n            return (\"\", \"\", \"\", new string[](0));\n        }\n\n        IERC721Metadata c = IERC721Metadata(collection);\n        // How the URI must be handled.\n        // if a base URI is already present, we ignore individual URI\n        // else, each token URI must be bridged and then the owner of the collection\n        // can decide what to do\n        (bool success, string memory _baseUri) = _callBaseUri(collection);\n        if (success) {\n            return (c.name(), c.symbol(), _baseUri, new string[](0));\n        }\n        else {\n            string[] memory URIs = new string[](tokenIds.length);\n            for (uint256 i = 0; i < tokenIds.length; i++) {\n                URIs[i] = c.tokenURI(tokenIds[i]);\n            }\n            return (c.name(), c.symbol(), \"\", URIs);\n        }\n    }\n\n    /**\n       @notice Retrieves metadata from ERC1155, if it supports it.\n\n       @param collection Address of the ERC1155 contract.\n\n       @return baseURI.\n     */\n    function erc1155Metadata(\n        address collection\n    )\n        internal\n        view\n        returns (string memory)\n    {\n        return \"\";\n        /* bool supportsMetadata = ERC165Checker.supportsInterface( */\n        /*     collection, */\n        /*     type(IERC1155MetadataURI).interfaceId */\n        /* ); */\n        \n        /* if (!supportsMetadata) { */\n        /*     return \"\"; */\n        /* } else { */\n        /*     // TODO: ideally, we should get one URI of a token, */\n        /*     // and extract the constant part? All tokens are supposed to have */\n        /*     // the same base address, only replacing the `{id}`. If it's the case, */\n        /*     // we can take the uri of the first token, and return it... */\n        /*     //return IERC1155MetadataURI(collection).uri(WhichTokenId?); */\n        /*     return \"TODO\"; */\n        /* } */\n\n    }\n\n    function _callBaseUri(\n        address collection\n    )\n        internal\n        view\n        returns (bool, string memory)\n    {\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        bytes memory ret;\n        bytes[2] memory encodedSignatures = [abi.encodeWithSignature(\"_baseUri()\"), abi.encodeWithSignature(\"baseUri()\")];\n\n        for (uint256 i = 0; i < 2; i++) {\n            bytes memory encodedParams = encodedSignatures[i];\n            assembly {\n                success := staticcall(gas(), collection, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n                if success {\n                    returnSize := returndatasize()\n                    returnValue := mload(0x00)\n                    ret := mload(0x40)\n                    mstore(ret, returnSize)\n                    returndatacopy(add(ret, 0x20), 0, returnSize)\n                    // update free memory pointer\n                    mstore(0x40, add(add(ret, 0x20), add(returnSize, 0x20)))\n                }\n            }\n            if (success && returnSize >= 0x20 && returnValue > 0) {\n                return (true, abi.decode(ret, (string)));\n            }\n        }\n        return (false, \"\");\n    }\n\n}\n"
      },
      "src/token/CollectionManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\nimport \"./Deployer.sol\";\nimport \"../sn/Cairo.sol\";\n\nerror InvalidCollectionL1Address();\nerror InvalidCollectionL2Address();\nerror ErrorVerifyingAddressMapping();\nerror CollectionMappingAlreadySet();\n\n/**\n   @title Collection manager to verify collection address matching and deploy them.\n*/\ncontract CollectionManager {\n\n    // Mapping between L2<->L1 contracts addresses.\n    mapping(snaddress => address) _l2ToL1Addresses;\n\n    // Mapping between L1<->L2 contracts addresses.\n    mapping(address => snaddress) _l1ToL2Addresses;\n\n    /**\n       @notice A collection has been deployed due to the\n       first token being bridged from L2.\n\n       TODO: add the name and symbol here?\n     */\n    event CollectionDeployedFromL2(\n        uint256 indexed reqHash,\n        uint256 block_timestamp,\n        address l1Address,\n        uint256 l2Address\n    );\n\n    /**\n       @notice Deploys ERC721Bridgeable contracts.\n\n       @param name Descriptive name of the collection.\n       @param symbol Abbreviated name of the collection.\n       @param collectionL2 The collection's address on L2.\n       @param reqHash Hash of the request.\n\n       @return Address of the ERC721Bridgeable deployed (proxy address).\n    */\n    function _deployERC721Bridgeable(\n        string memory name,\n        string memory symbol,\n        snaddress collectionL2,\n        uint256 reqHash\n    )\n        internal\n        returns (address)\n    {\n        address proxy = Deployer.deployERC721Bridgeable(name, symbol);\n        _l1ToL2Addresses[proxy] = collectionL2;\n        _l2ToL1Addresses[collectionL2] = proxy;\n\n        emit CollectionDeployedFromL2(\n            reqHash,\n            block.timestamp,\n            proxy,\n            snaddress.unwrap(collectionL2)\n        );\n\n        return proxy;\n    }\n\n    /**\n       @notice Deploys ERC1155Bridgeable contracts.\n\n       @param uri URI with token placeholder.\n       @param collectionL2 The collection's address on L2.\n       @param reqHash Hash of the request.\n\n       @return Address of the ERC1155Bridgeable deployed (proxy address).\n    */\n    function _deployERC1155Bridgeable(\n        string memory uri,\n        snaddress collectionL2,\n        uint256 reqHash\n    )\n        internal\n        returns (address)\n    {\n        address proxy = Deployer.deployERC1155Bridgeable(uri);\n        _l1ToL2Addresses[proxy] = collectionL2;\n        _l2ToL1Addresses[collectionL2] = proxy;\n\n        emit CollectionDeployedFromL2(\n            reqHash,\n            block.timestamp,\n            proxy,\n            snaddress.unwrap(collectionL2)\n        );\n\n        return proxy;\n    }\n\n    /**\n       @notice Verifies the mapping between the request addresses and the storage.\n\n       @param collectionL1Req The collection on L1 from the request.\n       @param collectionL2Req The collection on L2 from the request.\n\n       @return Address of the already deployed collection on L1, address(0) otherwise.\n    */\n    function _verifyRequestAddresses(\n        address collectionL1Req,\n        snaddress collectionL2Req\n    )\n        internal\n        view\n        returns (address)\n    {\n        address l1Req = collectionL1Req;\n        uint256 l2Req = snaddress.unwrap(collectionL2Req);\n        address l1Mapping = _l2ToL1Addresses[collectionL2Req];\n        uint256 l2Mapping = snaddress.unwrap(_l1ToL2Addresses[l1Req]);\n\n        // L2 address is present in the request and L1 address is not.\n        if (l2Req > 0 && l1Req == address(0)) {\n            if (l1Mapping == address(0)) {\n                // It's the first token of the collection to be bridged.\n                return address(0);\n            } else {\n                // It's not the first token of the collection to be bridged,\n                // and the collection tokens were only bridged L2->L1.\n                return l1Mapping;\n            }\n        }\n\n        // L2 address is present, and L1 address too.\n        if (l2Req > 0 && l1Req > address(0)) {\n            if (l1Mapping != l1Req) {\n                revert InvalidCollectionL1Address();\n            } else if (l2Mapping != l2Req) {\n                revert InvalidCollectionL2Address();\n            } else {\n                // All addresses match, we don't need to deploy anything.\n                return l1Mapping;\n            }\n        }\n\n        revert ErrorVerifyingAddressMapping();\n    }\n\n    function _setL1L2AddressMapping(\n        address collectionL1,\n        snaddress collectionL2,\n        bool force\n    )\n        internal\n    {\n        if (((snaddress.unwrap(_l1ToL2Addresses[collectionL1]) == 0) && (_l2ToL1Addresses[collectionL2] == address(0)))\n            || (force == true)) {\n            _l1ToL2Addresses[collectionL1] = collectionL2;\n            _l2ToL1Addresses[collectionL2] = collectionL1;\n        } else {\n            revert CollectionMappingAlreadySet();\n        }\n    }\n\n}\n\n"
      },
      "src/Protocol.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.8;\n\nimport \"./sn/Cairo.sol\";\nimport \"./token/TokenUtil.sol\";\n\n/**\n   @notice Request to bridge tokens.\n*/\nstruct Request {\n    felt252 header;\n    uint256 hash;\n\n    address collectionL1;\n    snaddress collectionL2;\n\n    address ownerL1;\n    snaddress ownerL2;\n\n    string name;\n    string symbol;\n    string uri;\n\n    uint256[] tokenIds;\n    uint256[] tokenValues;\n    string[] tokenURIs;\n    uint256[] newOwners;\n}\n\nerror CollectionTypeMaskUnsupported();\n\n/**\n   @title Library related to the protocol for bridging tokens.\n*/\nlibrary Protocol {\n\n    // Byte 0 of the header: Version.\n    uint256 private constant HEADER_V1 = 0x01;\n\n    // Byte 1 of the header: Collection type.\n    uint256 private constant COLLECTION_TYPE_MASK = (0xff << (8 * 1));\n    uint256 private constant ERC721_TYPE = (0x01 << (8 * 1));\n    uint256 private constant ERC1155_TYPE = (0x02 << (8 * 1));\n\n    // Byte 2 of the header: deposit config.\n    uint256 private constant DEPOSIT_AUTO_BURN = (0x01 << (8 * 2));\n\n    // Byte 3 of the header: withdraw config.\n    uint256 private constant WITHDRAW_AUTO = (0x01 << (8 * 3));\n\n    /**\n       @notice Verifies if the given header supports the withdraw auto.\n\n       @return True if withdraw auto is supported, false otherwise.\n    */\n    function canUseWithdrawAuto(\n        uint256 header\n    )\n        internal\n        pure\n        returns (bool)\n    {\n        return (header & WITHDRAW_AUTO) == WITHDRAW_AUTO;\n    }\n\n    /**\n       @notice Retrieves the collection type from the header.\n\n       @return Collection type found in the header.\n    */\n    function collectionTypeFromHeader(\n        uint256 header\n    )\n        internal\n        pure\n        returns (CollectionType)\n    {\n        uint256 ct = header & COLLECTION_TYPE_MASK;\n        if (ct == ERC721_TYPE) {\n            return CollectionType.ERC721;\n        } else if (ct == ERC1155_TYPE)  {\n            return CollectionType.ERC1155;\n        } else {\n            revert CollectionTypeMaskUnsupported();\n        }\n    }\n\n    /**\n       @notice Computes the V1 header value.\n\n       @dev Header is a felt252 (31 bits).\n       Byte 0 is the version (0x1).\n       Byte 1 is the contract interface (0x1 = ERC721, 0x2 = ERC1155).\n       Byte 2 is the deposit config.\n       Byte 3 is the withdraw config.\n\n       @param ctype The collection type.\n    */\n    function requestHeaderV1(\n        CollectionType ctype,\n        bool useDepositAutoBurn,\n        bool useWithdrawAuto\n    )\n        internal\n        pure\n        returns (felt252)\n    {\n        uint256 h = HEADER_V1;\n\n        if (ctype == CollectionType.ERC721) {\n            h |= ERC721_TYPE;\n        } else {\n            h |= ERC1155_TYPE;\n        }\n\n        if (useDepositAutoBurn) {\n            h |= DEPOSIT_AUTO_BURN;\n        }\n        \n        if (useWithdrawAuto) {\n            h |= WITHDRAW_AUTO;\n        }\n\n        return Cairo.felt252Wrap(h);\n    }\n\n    /**\n       @notice Computes the request hash.\n\n       @param salt Random salt.\n       @param collection Token collection contract address (L1).\n       @param toL2Address New owner on Starknet (L2).\n       @param tokenIds List of token ids to be transfered.\n\n       @return Request hash.\n    */\n    function requestHash(\n        uint256 salt,\n        address collection,\n        snaddress toL2Address,\n        uint256[] memory tokenIds\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        bytes32 hash = keccak256(\n            abi.encodePacked(\n                salt,\n                // Cairo uses felts, which are converted into u256 to compute keccak.\n                // As we use abi.encodePacked, we want the address to also be 32 bytes long.\n                uint256(uint160(collection)),\n                snaddress.unwrap(toL2Address),\n                tokenIds\n            )\n        );\n\n        return uint256(hash);\n    }\n\n    /**\n       @notice Computes the serialized length of a request.\n\n       @param req Request of which the length is computed.\n\n       @return Length of the uint256[] that can contain the serialized request.\n    */\n    function requestSerializedLength(\n        Request memory req\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        // Constant length part of the request is always 7 uint256 long.\n        uint256 len = 7;\n\n        len += Cairo.cairoStringSerializedLength(req.name);\n        len += Cairo.cairoStringSerializedLength(req.symbol);\n        len += Cairo.cairoStringSerializedLength(req.uri);\n\n        // Arrays always have their length first, then serialized length of each element.\n        // For uint256, we can pre-compute it as a uint256 is 2 felts long.\n        len += (req.tokenIds.length * 2) + 1;\n        len += (req.tokenValues.length * 2) + 1;\n        len += (req.newOwners.length * 2) + 1;\n\n        // For strings, we must iterate on the array to know the length of each string.\n        // We start by adding the length of the tokenURIs array.\n        len += 1;\n        for (uint256 i = 0; i < req.tokenURIs.length; i++) {\n            len += Cairo.cairoStringSerializedLength(req.tokenURIs[i]);\n        }\n\n        return len;\n    }\n\n    /**\n       @notice Serializes a bridge request into an array of uint256\n       that is compatible with serialization expected by Starknet messaging.\n\n       @param req Request to serialize.\n\n       @return uint256[] with the serialized request.\n    */\n    function requestSerialize(\n        Request memory req\n    )\n        internal\n        pure\n        returns (uint256[] memory)\n    {\n        uint256[] memory buf = new uint256[](requestSerializedLength(req));\n\n        // Constant length part of the request.\n        buf[0] = felt252.unwrap(req.header);\n        buf[1] = uint128(req.hash);\n        buf[2] = uint128(req.hash >> 128);\n\n        buf[3] = uint256(uint160(req.collectionL1));\n        buf[4] = snaddress.unwrap(req.collectionL2);\n\n        buf[5] = uint256(uint160(req.ownerL1));\n        buf[6] = snaddress.unwrap(req.ownerL2);\n\n        // Variable length part of the request.\n        uint256 offset = 7;\n        offset += Cairo.cairoStringSerialize(req.name, buf, offset);\n        offset += Cairo.cairoStringSerialize(req.symbol, buf, offset);\n        offset += Cairo.cairoStringSerialize(req.uri, buf, offset);\n\n        offset += Cairo.uint256ArraySerialize(req.tokenIds, buf, offset);\n        offset += Cairo.uint256ArraySerialize(req.tokenValues, buf, offset);\n        offset += Cairo.cairoStringArraySerialize(req.tokenURIs, buf, offset);\n        offset += Cairo.uint256ArraySerialize(req.newOwners, buf, offset);\n\n        return buf;\n    }\n\n    /**\n       @notice Deserializes a request from uint256[] from starknet messaging.\n\n       @param buf Uint256[] buffer with the serialized request.\n       @param offset Offset in the buffer where deserialization starts.\n\n       @return Request.\n    */\n    function requestDeserialize(\n        uint256[] memory buf,\n        uint256 offset\n    )\n        internal\n        pure\n        returns (Request memory)\n    {\n        Request memory req;\n\n        req.header = Cairo.felt252Wrap(buf[offset++]);\n        req.hash = Cairo.uint256Deserialize(buf, offset);\n        offset += 2;\n\n        req.collectionL1 = address(uint160(buf[offset++]));\n        req.collectionL2 = Cairo.snaddressWrap(buf[offset++]);\n\n        req.ownerL1 = address(uint160(buf[offset++]));\n        req.ownerL2 = Cairo.snaddressWrap(buf[offset++]);\n\n        uint256 inc;\n\n        (inc, req.name) = Cairo.cairoStringDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.symbol) = Cairo.cairoStringDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.uri) = Cairo.cairoStringDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.tokenIds) = Cairo.uint256ArrayDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.tokenValues) = Cairo.uint256ArrayDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.tokenURIs) = Cairo.cairoStringArrayDeserialize(buf, offset);\n        offset += inc;\n\n        (inc, req.newOwners) = Cairo.uint256ArrayDeserialize(buf, offset);\n        offset += inc;\n\n        return req;\n    }\n\n}\n"
      },
      "src/State.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./sn/Cairo.sol\";\n\nimport \"starknet/IStarknetMessaging.sol\";\nimport \"openzeppelin-contracts/contracts/access/Ownable.sol\";\n\n/**\n @title Starklane state.\n*/\ncontract StarklaneState is Ownable {\n\n    // StarknetCore.\n    IStarknetMessaging _starknetCoreAddress;\n\n    // Starklane L2 address for messaging.\n    snaddress _starklaneL2Address;\n\n    // Bridge L2 selector to deposit token from L1.\n    felt252 _starklaneL2Selector;\n\n    /**\n       @notice Retrieves info about Starklane L2 mapping.\n\n       @return (starklane L2 address, starklane L2 selector).\n    */\n    function l2Info()\n        external\n        view\n        returns (snaddress, felt252)\n    {\n        return (_starklaneL2Address, _starklaneL2Selector);\n    }\n\n    /**\n       @notice Sets Starklane L2 address.\n\n       @param l2Address Starklane L2 address.\n    */\n    function setStarklaneL2Address(\n        uint256 l2Address\n    )\n        public\n        onlyOwner\n    {\n        _starklaneL2Address = Cairo.snaddressWrap(l2Address);\n    }\n\n    /**\n       @notice Sets Starklane L2 selector of Starklane L2 contract to be\n       called when a message arrives into Starknet.\n\n       @param l2Selector Starklane L2 selector.\n    */\n    function setStarklaneL2Selector(\n        uint256 l2Selector\n    )\n        public\n        onlyOwner\n    {\n        _starklaneL2Selector = Cairo.felt252Wrap(l2Selector);\n    }\n\n\n}\n"
      },
      "src/Escrow.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/token/ERC721/IERC721.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol\";\n\nimport \"./token/TokenUtil.sol\";\n\n/**\n   @title Contract responsible of escrowing tokens.\n*/\ncontract StarklaneEscrow is Context {\n\n    // Escrowed token.\n    // Mapping (collectionAddres => (tokenId => depositor)).\n    mapping(address => mapping(uint256 => address)) _escrow;\n\n    /**\n       @notice Deposits the given tokens into escrow.\n\n       @param collectionType The token type,\n       @param collection Token collection address.\n       @param ids Tokens to be deposited.\n     */\n    function _depositIntoEscrow(\n        CollectionType collectionType,\n        address collection,\n        uint256[] memory ids\n    )\n        internal\n    {\n        assert(ids.length > 0);\n\n        for (uint256 i = 0; i < ids.length; i++) {\n            uint256 id = ids[i];\n\n            if (collectionType == CollectionType.ERC721) {\n                IERC721(collection).transferFrom(msg.sender, address(this), id);\n            } else {\n                // TODO: check the supply is exactly one.\n                // (this is the low level call to verify if a contract has some function).\n                // (but it's better to check with supported interfaces? It's 2 calls instead\n                // of one where we control the fail.)\n                //(bool success, bytes memory data) = contractAddress.call(\"\");\n                IERC1155(collection).safeTransferFrom(msg.sender, address(this), id, 1, \"\");\n            }\n\n            _escrow[collection][id] = msg.sender;\n        }\n    }\n\n    /**\n       @notice Withdraw a token from escrow.\n\n       @param collectionType The token type,\n       @param collection Token collection address.\n       @param to Owner withdrawing the token.\n       @param id Token to be deposited.\n\n       @return True if the token was into escrow, false otherwise.\n     */\n    function _withdrawFromEscrow(\n        CollectionType collectionType,\n        address collection,\n        address to,\n        uint256 id\n    )\n        internal\n        returns (bool)\n    {\n        if (!_isEscrowed(collection, id)) {\n            return false;\n        }\n\n        address from = address(this);\n\n        if (collectionType == CollectionType.ERC721) {\n            IERC721(collection).safeTransferFrom(from, to, id);\n        } else {\n            // TODO:\n            // Check here if the token supply is currently 0.\n            IERC1155(collection).safeTransferFrom(from, to, id, 1, \"\");\n        }\n\n        _escrow[collection][id] = address(0x0);\n\n        return true;\n    }\n\n    /**\n       @notice Verifies if the given token is in escrow.\n\n       @param collection Token collection address.\n       @param id Token id.\n\n       @return True if the token is in escrow, false otherwise.\n     */\n    function _isEscrowed(\n        address collection,\n        uint256 id\n    )\n        internal\n        view\n        returns (bool)\n    {\n        return _escrow[collection][id] > address(0x0);\n    }\n\n}\n"
      },
      "src/Messaging.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/access/Ownable.sol\";\nimport \"starknet/IStarknetMessaging.sol\";\n\nimport \"./sn/Cairo.sol\";\n\nuint256 constant WITHDRAW_AUTO_NONE = 0x00;\nuint256 constant WITHDRAW_AUTO_READY = 0x01;\nuint256 constant WITHDRAW_AUTO_CONSUMED = 0x02;\n\nerror WithdrawMethodError();\nerror WithdrawAlreadyError();\n\n/**\n   @title Contract responsible of withdrawing token from messaging.\n\n   @dev If any message is configured to be withdraw with the auto methods,\n   then the regular starknet messaging will always be ignored and vice-versa.\n\n   In solidity, when we query a mapping, if the key does not exist, 0 is returned when\n   the value is an uint256.\n\n   For this reason, we use here a enum-like to ensure the correct state of the message.\n*/\ncontract StarklaneMessaging is Ownable {\n\n    // Messages sent directly from L2 indexer, that can be withdrawn with\n    // the auto method.\n    //\n    // The mapping mimics the Starknet messaging with a ref count like status.\n    mapping(bytes32 => uint256) _autoWithdrawn;\n\n    /**\n     */\n    event MessageHashAutoWithdrawAdded(bytes32 msgHash);\n\n    /**\n       @notice Adds the hash of a message that can be consumed with the auto\n       method.\n\n       @param msgHash Hash of the message to be considered as consumable.\n    */\n    function addMessageHashForAutoWithdraw(\n        uint256 msgHash\n    )\n        external\n        payable\n        onlyOwner\n    {\n        bytes32 hash = bytes32(msgHash);\n\n        if (_autoWithdrawn[hash] != WITHDRAW_AUTO_NONE) {\n            revert WithdrawMethodError();\n        }\n\n        _autoWithdrawn[hash] = WITHDRAW_AUTO_READY;\n        emit MessageHashAutoWithdrawAdded(hash);\n    }\n\n    /**\n       @notice Consumes a message with the Auto withdraw method.\n\n       @param fromL2Address Address of the L2 contract that send the message.\n       @param request Request containing the tokens to withdraw.\n    */\n    function _consumeMessageAutoWithdraw(\n        snaddress fromL2Address,\n        uint256[] memory request\n    )\n        internal\n    {\n        bytes32 msgHash = keccak256(\n            abi.encodePacked(\n                snaddress.unwrap(fromL2Address),\n                uint256(uint160(address(this))),\n                request.length,\n                request)\n        );\n\n        uint256 status = _autoWithdrawn[msgHash];\n\n        if (status == WITHDRAW_AUTO_CONSUMED) {\n            revert WithdrawAlreadyError();\n        }\n\n        _autoWithdrawn[msgHash] = WITHDRAW_AUTO_CONSUMED;\n    }\n\n    /**\n       @notice Consumes a message from Starknet core contract.\n\n       @param starknetCore Address of the Starknet Core contract.\n       @param fromL2Address Address of the L2 contract that send the message.\n       @param request Request containing the tokens to withdraw.\n    */\n    function _consumeMessageStarknet(\n        IStarknetMessaging starknetCore,\n        snaddress fromL2Address,\n        uint256[] memory request\n    )\n        internal\n    {\n        // Will revert if the message is not consumable.\n        bytes32 msgHash = starknetCore.consumeMessageFromL2(\n            snaddress.unwrap(fromL2Address),\n            request\n        );\n\n        // If the message were configured to be withdrawn with auto method,\n        // starknet method is denied.\n        if (_autoWithdrawn[msgHash] != WITHDRAW_AUTO_NONE) {\n            revert WithdrawMethodError();\n        }\n    }\n\n\n}\n"
      },
      "src/UUPSProxied.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/access/Ownable.sol\";\nimport \"openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol\";\n\nerror NotSupportedError();\nerror NotPayableError();\n\n/**\n   @title Convenient contract to have ownable UUPS proxied contract.\n*/\ncontract UUPSOwnableProxied is Ownable, UUPSUpgradeable {\n\n    // Mapping for implementations initialization.\n    mapping(address implementation => bool initialized) _initializedImpls;\n\n    // onlyInit\n    modifier onlyInit() {\n        address impl = _getImplementation();\n        require(!_initializedImpls[impl], \"Already init\");\n        _initializedImpls[impl] = true;\n\n        _;\n    }\n\n    /**\n       @notice Only owner should be able to upgrade.\n    */\n    function _authorizeUpgrade(\n        address\n    )\n        internal\n        override\n        onlyOwner\n    { }\n\n    /**\n       @notice Ensures unsupported function is directly reverted.\n    */\n    fallback()\n        external\n        payable\n        {\n            revert NotSupportedError();\n        }\n\n    /**\n       @notice Ensures no ether is received without a function call.\n    */\n    receive()\n        external\n        payable\n        {\n            revert NotPayableError();\n        }\n}\n\n"
      },
      "lib/starknet/IStarknetMessaging.sol": {
        "content": "/*\n  Copyright 2019-2022 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\nimport \"./IStarknetMessagingEvents.sol\";\n\ninterface IStarknetMessaging is IStarknetMessagingEvents {\n    /**\n      Returns the max fee (in Wei) that StarkNet will accept per single message.\n    */\n    function getMaxL1MsgFee() external pure returns (uint256);\n\n    /**\n      Sends a message to an L2 contract.\n      This function is payable, the payed amount is the message fee.\n\n      Returns the hash of the message and the nonce of the message.\n    */\n    function sendMessageToL2(\n        uint256 toAddress,\n        uint256 selector,\n        uint256[] calldata payload\n    ) external payable returns (bytes32, uint256);\n\n    /**\n      Consumes a message that was sent from an L2 contract.\n\n      Returns the hash of the message.\n    */\n    function consumeMessageFromL2(uint256 fromAddress, uint256[] calldata payload)\n        external\n        returns (bytes32);\n\n    /**\n      Starts the cancellation of an L1 to L2 message.\n      A message can be canceled messageCancellationDelay() seconds after this function is called.\n\n      Note: This function may only be called for a message that is currently pending and the caller\n      must be the sender of the that message.\n    */\n    function startL1ToL2MessageCancellation(\n        uint256 toAddress,\n        uint256 selector,\n        uint256[] calldata payload,\n        uint256 nonce\n    ) external returns (bytes32);\n\n    /**\n      Cancels an L1 to L2 message, this function should be called at least\n      messageCancellationDelay() seconds after the call to startL1ToL2MessageCancellation().\n      A message may only be cancelled by its sender.\n      If the message is missing, the call will revert.\n\n      Note that the message fee is not refunded.\n    */\n    function cancelL1ToL2Message(\n        uint256 toAddress,\n        uint256 selector,\n        uint256[] calldata payload,\n        uint256 nonce\n    ) external returns (bytes32);\n}\n"
      },
      "src/IStarklaneEvent.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IStarklaneEvent {\n\n    /**\n       @notice Request initiated on L1.\n    */\n    event DepositRequestInitiated(\n        uint256 indexed hash,\n        uint256 block_timestamp,\n        uint256[] reqContent\n    );\n\n    /**\n       @notice Request from L2 completed.\n    */\n    event WithdrawRequestCompleted(\n        uint256 indexed hash,\n        uint256 block_timestamp,\n        uint256[] reqContent\n    );\n\n    /**\n        @notice A request cancellation is started\n    */\n    event CancelRequestStarted(\n        uint256 indexed hash,\n        uint256 block_timestamp\n    );\n\n    /**\n        @notice A request cancellation is completed\n    */\n    event CancelRequestCompleted(\n        uint256 indexed hash,\n        uint256 block_timestamp\n    );\n\n    /**\n        @notice White list for deposit.\n     */\n    event WhiteListUpdated(\n        bool enable\n    );\n\n    /**\n        @notice White list status updated for collection.\n     */\n    event CollectionWhiteListUpdated(\n        address indexed collection,\n        bool enable\n    );\n\n    /**\n        @notice L1 L2 collection mapping updated\n     */\n    event L1L2CollectionMappingUpdated(\n        address indexed colllectionL1,\n        uint256 indexed collectionL2\n    );\n}"
      },
      "lib/openzeppelin-contracts/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n    using Address for address;\n    using Strings for uint256;\n\n    // Token name\n    string private _name;\n\n    // Token symbol\n    string private _symbol;\n\n    // Mapping from token ID to owner address\n    mapping(uint256 => address) private _owners;\n\n    // Mapping owner address to token count\n    mapping(address => uint256) private _balances;\n\n    // Mapping from token ID to approved address\n    mapping(uint256 => address) private _tokenApprovals;\n\n    // Mapping from owner to operator approvals\n    mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n    /**\n     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return\n            interfaceId == type(IERC721).interfaceId ||\n            interfaceId == type(IERC721Metadata).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC721-balanceOf}.\n     */\n    function balanceOf(address owner) public view virtual override returns (uint256) {\n        require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n        return _balances[owner];\n    }\n\n    /**\n     * @dev See {IERC721-ownerOf}.\n     */\n    function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n        address owner = _ownerOf(tokenId);\n        require(owner != address(0), \"ERC721: invalid token ID\");\n        return owner;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-name}.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-symbol}.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-tokenURI}.\n     */\n    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n        _requireMinted(tokenId);\n\n        string memory baseURI = _baseURI();\n        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n    }\n\n    /**\n     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n     * by default, can be overridden in child contracts.\n     */\n    function _baseURI() internal view virtual returns (string memory) {\n        return \"\";\n    }\n\n    /**\n     * @dev See {IERC721-approve}.\n     */\n    function approve(address to, uint256 tokenId) public virtual override {\n        address owner = ERC721.ownerOf(tokenId);\n        require(to != owner, \"ERC721: approval to current owner\");\n\n        require(\n            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n            \"ERC721: approve caller is not token owner or approved for all\"\n        );\n\n        _approve(to, tokenId);\n    }\n\n    /**\n     * @dev See {IERC721-getApproved}.\n     */\n    function getApproved(uint256 tokenId) public view virtual override returns (address) {\n        _requireMinted(tokenId);\n\n        return _tokenApprovals[tokenId];\n    }\n\n    /**\n     * @dev See {IERC721-setApprovalForAll}.\n     */\n    function setApprovalForAll(address operator, bool approved) public virtual override {\n        _setApprovalForAll(_msgSender(), operator, approved);\n    }\n\n    /**\n     * @dev See {IERC721-isApprovedForAll}.\n     */\n    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n        return _operatorApprovals[owner][operator];\n    }\n\n    /**\n     * @dev See {IERC721-transferFrom}.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n        //solhint-disable-next-line max-line-length\n        require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n        _transfer(from, to, tokenId);\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n        safeTransferFrom(from, to, tokenId, \"\");\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n        require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n        _safeTransfer(from, to, tokenId, data);\n    }\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * `data` is additional data, it has no specified format and it is sent in call to `to`.\n     *\n     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n     * implement alternative mechanisms to perform token transfer, such as signature-based.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n        _transfer(from, to, tokenId);\n        require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n    }\n\n    /**\n     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n     */\n    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n        return _owners[tokenId];\n    }\n\n    /**\n     * @dev Returns whether `tokenId` exists.\n     *\n     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n     *\n     * Tokens start existing when they are minted (`_mint`),\n     * and stop existing when they are burned (`_burn`).\n     */\n    function _exists(uint256 tokenId) internal view virtual returns (bool) {\n        return _ownerOf(tokenId) != address(0);\n    }\n\n    /**\n     * @dev Returns whether `spender` is allowed to manage `tokenId`.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n        address owner = ERC721.ownerOf(tokenId);\n        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n    }\n\n    /**\n     * @dev Safely mints `tokenId` and transfers it to `to`.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeMint(address to, uint256 tokenId) internal virtual {\n        _safeMint(to, tokenId, \"\");\n    }\n\n    /**\n     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n     */\n    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n        _mint(to, tokenId);\n        require(\n            _checkOnERC721Received(address(0), to, tokenId, data),\n            \"ERC721: transfer to non ERC721Receiver implementer\"\n        );\n    }\n\n    /**\n     * @dev Mints `tokenId` and transfers it to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - `to` cannot be the zero address.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _mint(address to, uint256 tokenId) internal virtual {\n        require(to != address(0), \"ERC721: mint to the zero address\");\n        require(!_exists(tokenId), \"ERC721: token already minted\");\n\n        _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n        // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n        require(!_exists(tokenId), \"ERC721: token already minted\");\n\n        unchecked {\n            // Will not overflow unless all 2**256 token ids are minted to the same owner.\n            // Given that tokens are minted one by one, it is impossible in practice that\n            // this ever happens. Might change if we allow batch minting.\n            // The ERC fails to describe this case.\n            _balances[to] += 1;\n        }\n\n        _owners[tokenId] = to;\n\n        emit Transfer(address(0), to, tokenId);\n\n        _afterTokenTransfer(address(0), to, tokenId, 1);\n    }\n\n    /**\n     * @dev Destroys `tokenId`.\n     * The approval is cleared when the token is burned.\n     * This is an internal function that does not check if the sender is authorized to operate on the token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _burn(uint256 tokenId) internal virtual {\n        address owner = ERC721.ownerOf(tokenId);\n\n        _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n        owner = ERC721.ownerOf(tokenId);\n\n        // Clear approvals\n        delete _tokenApprovals[tokenId];\n\n        unchecked {\n            // Cannot overflow, as that would require more tokens to be burned/transferred\n            // out than the owner initially received through minting and transferring in.\n            _balances[owner] -= 1;\n        }\n        delete _owners[tokenId];\n\n        emit Transfer(owner, address(0), tokenId);\n\n        _afterTokenTransfer(owner, address(0), tokenId, 1);\n    }\n\n    /**\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _transfer(address from, address to, uint256 tokenId) internal virtual {\n        require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n        require(to != address(0), \"ERC721: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, tokenId, 1);\n\n        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n        require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n        // Clear approvals from the previous owner\n        delete _tokenApprovals[tokenId];\n\n        unchecked {\n            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n            // `from`'s balance is the number of token held, which is at least one before the current\n            // transfer.\n            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n            // all 2**256 token ids to be minted, which in practice is impossible.\n            _balances[from] -= 1;\n            _balances[to] += 1;\n        }\n        _owners[tokenId] = to;\n\n        emit Transfer(from, to, tokenId);\n\n        _afterTokenTransfer(from, to, tokenId, 1);\n    }\n\n    /**\n     * @dev Approve `to` to operate on `tokenId`\n     *\n     * Emits an {Approval} event.\n     */\n    function _approve(address to, uint256 tokenId) internal virtual {\n        _tokenApprovals[tokenId] = to;\n        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n    }\n\n    /**\n     * @dev Approve `operator` to operate on all of `owner` tokens\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n        require(owner != operator, \"ERC721: approve to caller\");\n        _operatorApprovals[owner][operator] = approved;\n        emit ApprovalForAll(owner, operator, approved);\n    }\n\n    /**\n     * @dev Reverts if the `tokenId` has not been minted yet.\n     */\n    function _requireMinted(uint256 tokenId) internal view virtual {\n        require(_exists(tokenId), \"ERC721: invalid token ID\");\n    }\n\n    /**\n     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n     * The call is not executed if the target address is not a contract.\n     *\n     * @param from address representing the previous owner of the given token ID\n     * @param to target address that will receive the tokens\n     * @param tokenId uint256 ID of the token to be transferred\n     * @param data bytes optional data to send along with the call\n     * @return bool whether the call correctly returned the expected magic value\n     */\n    function _checkOnERC721Received(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory data\n    ) private returns (bool) {\n        if (to.isContract()) {\n            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n                return retval == IERC721Receiver.onERC721Received.selector;\n            } catch (bytes memory reason) {\n                if (reason.length == 0) {\n                    revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n                } else {\n                    /// @solidity memory-safe-assembly\n                    assembly {\n                        revert(add(32, reason), mload(reason))\n                    }\n                }\n            }\n        } else {\n            return true;\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n     * - When `from` is zero, the tokens will be minted for `to`.\n     * - When `to` is zero, ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     * - `batchSize` is non-zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n     * - When `from` is zero, the tokens were minted for `to`.\n     * - When `to` is zero, ``from``'s tokens were burned.\n     * - `from` and `to` are never both zero.\n     * - `batchSize` is non-zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n    /**\n     * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n     *\n     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n     * that `ownerOf(tokenId)` is `a`.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function __unsafe_increaseBalance(address account, uint256 amount) internal {\n        _balances[account] += amount;\n    }\n}\n"
      },
      "src/token/IERC721Bridgeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n   @title ERC721Bridgeable token.\n   \n   @notice This interface allows a contract to expose functions\n   that allows a bridge to mint and burn token.\n*/\ninterface IERC721Bridgeable {\n\n    /**\n       @notice Mints a token from the bridge.\n\n       @param to The new owner.\n       @param id The token to mint.\n    */\n    function mintFromBridge(address to, uint256 id)\n        external;\n\n    /**\n       @notice Burns a token from the bridge.\n\n       @param id The token to burn.\n    */\n    function burnFromBridge(uint256 id)\n        external;\n\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n    /**\n     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n     */\n    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n    /**\n     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n     * transfers.\n     */\n    event TransferBatch(\n        address indexed operator,\n        address indexed from,\n        address indexed to,\n        uint256[] ids,\n        uint256[] values\n    );\n\n    /**\n     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n     * `approved`.\n     */\n    event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n    /**\n     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n     *\n     * If an {URI} event was emitted for `id`, the standard\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n     * returned by {IERC1155MetadataURI-uri}.\n     */\n    event URI(string value, uint256 indexed id);\n\n    /**\n     * @dev Returns the amount of tokens of token type `id` owned by `account`.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function balanceOf(address account, uint256 id) external view returns (uint256);\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n     *\n     * Requirements:\n     *\n     * - `accounts` and `ids` must have the same length.\n     */\n    function balanceOfBatch(\n        address[] calldata accounts,\n        uint256[] calldata ids\n    ) external view returns (uint256[] memory);\n\n    /**\n     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n     *\n     * Emits an {ApprovalForAll} event.\n     *\n     * Requirements:\n     *\n     * - `operator` cannot be the caller.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address account, address operator) external view returns (bool);\n\n    /**\n     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n     * - `from` must have a balance of tokens of type `id` of at least `amount`.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - `ids` and `amounts` must have the same length.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] calldata ids,\n        uint256[] calldata amounts,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n    /**\n     * @dev Returns the URI for token type `id`.\n     *\n     * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n     * clients with the actual token type ID.\n     */\n    function uri(uint256 id) external view returns (string memory);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Supply.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155Supply is ERC1155 {\n    mapping(uint256 => uint256) private _totalSupply;\n\n    /**\n     * @dev Total amount of tokens in with a given id.\n     */\n    function totalSupply(uint256 id) public view virtual returns (uint256) {\n        return _totalSupply[id];\n    }\n\n    /**\n     * @dev Indicates whether any token exist with a given id, or not.\n     */\n    function exists(uint256 id) public view virtual returns (bool) {\n        return ERC1155Supply.totalSupply(id) > 0;\n    }\n\n    /**\n     * @dev See {ERC1155-_beforeTokenTransfer}.\n     */\n    function _beforeTokenTransfer(\n        address operator,\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) internal virtual override {\n        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n        if (from == address(0)) {\n            for (uint256 i = 0; i < ids.length; ++i) {\n                _totalSupply[ids[i]] += amounts[i];\n            }\n        }\n\n        if (to == address(0)) {\n            for (uint256 i = 0; i < ids.length; ++i) {\n                uint256 id = ids[i];\n                uint256 amount = amounts[i];\n                uint256 supply = _totalSupply[id];\n                require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n                unchecked {\n                    _totalSupply[id] = supply - amount;\n                }\n            }\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165Checker.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n    // As per the EIP-165 spec, no interface should ever match 0xffffffff\n    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n    /**\n     * @dev Returns true if `account` supports the {IERC165} interface.\n     */\n    function supportsERC165(address account) internal view returns (bool) {\n        // Any contract that implements ERC165 must explicitly indicate support of\n        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n        return\n            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n    }\n\n    /**\n     * @dev Returns true if `account` supports the interface defined by\n     * `interfaceId`. Support for {IERC165} itself is queried automatically.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n        // query support of both ERC165 as per the spec and support of _interfaceId\n        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n    }\n\n    /**\n     * @dev Returns a boolean array where each value corresponds to the\n     * interfaces passed in and whether they're supported or not. This allows\n     * you to batch check interfaces for a contract where your expectation\n     * is that some interfaces may not be supported.\n     *\n     * See {IERC165-supportsInterface}.\n     *\n     * _Available since v3.4._\n     */\n    function getSupportedInterfaces(\n        address account,\n        bytes4[] memory interfaceIds\n    ) internal view returns (bool[] memory) {\n        // an array of booleans corresponding to interfaceIds and whether they're supported or not\n        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n        // query support of ERC165 itself\n        if (supportsERC165(account)) {\n            // query support of each interface in interfaceIds\n            for (uint256 i = 0; i < interfaceIds.length; i++) {\n                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n            }\n        }\n\n        return interfaceIdsSupported;\n    }\n\n    /**\n     * @dev Returns true if `account` supports all the interfaces defined in\n     * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n     *\n     * Batch-querying can lead to gas savings by skipping repeated checks for\n     * {IERC165} support.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n        // query support of ERC165 itself\n        if (!supportsERC165(account)) {\n            return false;\n        }\n\n        // query support of each interface in interfaceIds\n        for (uint256 i = 0; i < interfaceIds.length; i++) {\n            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n                return false;\n            }\n        }\n\n        // all interfaces supported\n        return true;\n    }\n\n    /**\n     * @notice Query if a contract implements an interface, does not check ERC165 support\n     * @param account The address of the contract to query for support of an interface\n     * @param interfaceId The interface identifier, as specified in ERC-165\n     * @return true if the contract at account indicates support of the interface with\n     * identifier interfaceId, false otherwise\n     * @dev Assumes that account contains a contract that supports ERC165, otherwise\n     * the behavior of this method is undefined. This precondition can be checked\n     * with {supportsERC165}.\n     *\n     * Some precompiled contracts will falsely indicate support for a given interface, so caution\n     * should be exercised when using this function.\n     *\n     * Interface identification is specified in ERC-165.\n     */\n    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n        // prepare call\n        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n        // perform static call\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly {\n            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0x00)\n        }\n\n        return success && returnSize >= 0x20 && returnValue > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n    /**\n     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n     *\n     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n     * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n     */\n    constructor(address _logic, bytes memory _data) payable {\n        _upgradeToAndCall(_logic, _data, false);\n    }\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _implementation() internal view virtual override returns (address impl) {\n        return ERC1967Upgrade._getImplementation();\n    }\n}\n"
      },
      "src/token/Deployer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\nimport \"./ERC721Bridgeable.sol\";\nimport \"./ERC1155Bridgeable.sol\";\n\n/**\n   @title Collection contract deployer.\n*/\nlibrary Deployer {\n\n    /**\n       @notice Deploys a UUPS proxied ERC721 contract.\n\n       @param name Descriptive name for the token collection.\n       @param symbol Abbreviated name for the token collection.\n\n       @return Address of the proxy.\n    */\n    function deployERC721Bridgeable(\n        string memory name,\n        string memory symbol\n    )\n        public\n        returns (address)\n    {\n        address impl = address(new ERC721Bridgeable());\n        \n        bytes memory dataInit = abi.encodeWithSelector(\n            ERC721Bridgeable.initialize.selector,\n            abi.encode(name, symbol)\n        );\n\n        return address(new ERC1967Proxy(impl, dataInit));\n    }\n\n    /**\n       @notice Deploys a UUPS proxied ERC1155 contract.\n\n       @param uri URI with token id placeholder.\n\n       @return Address of the proxy.\n    */\n    function deployERC1155Bridgeable(\n        string memory uri\n    )\n        public\n        returns (address)\n    {\n        address impl = address(new ERC1155Bridgeable());\n        \n        bytes memory dataInit = abi.encodeWithSelector(\n            ERC1155Bridgeable.initialize.selector,\n            abi.encode(uri)\n        );\n\n        return address(new ERC1967Proxy(impl, dataInit));\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n    address private immutable __self = address(this);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        require(address(this) != __self, \"Function must be called through delegatecall\");\n        require(_getImplementation() == __self, \"Function must be called through active proxy\");\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n        _;\n    }\n\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n        return _IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeTo(address newImplementation) public virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data, true);\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeTo} and {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal override onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n}\n"
      },
      "lib/starknet/IStarknetMessagingEvents.sol": {
        "content": "/*\n  Copyright 2019-2022 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\ninterface IStarknetMessagingEvents {\n    // This event needs to be compatible with the one defined in Output.sol.\n    event LogMessageToL1(uint256 indexed fromAddress, address indexed toAddress, uint256[] payload);\n\n    // An event that is raised when a message is sent from L1 to L2.\n    event LogMessageToL2(\n        address indexed fromAddress,\n        uint256 indexed toAddress,\n        uint256 indexed selector,\n        uint256[] payload,\n        uint256 nonce,\n        uint256 fee\n    );\n\n    // An event that is raised when a message from L2 to L1 is consumed.\n    event ConsumedMessageToL1(\n        uint256 indexed fromAddress,\n        address indexed toAddress,\n        uint256[] payload\n    );\n\n    // An event that is raised when a message from L1 to L2 is consumed.\n    event ConsumedMessageToL2(\n        address indexed fromAddress,\n        uint256 indexed toAddress,\n        uint256 indexed selector,\n        uint256[] payload,\n        uint256 nonce\n    );\n\n    // An event that is raised when a message from L1 to L2 Cancellation is started.\n    event MessageToL2CancellationStarted(\n        address indexed fromAddress,\n        uint256 indexed toAddress,\n        uint256 indexed selector,\n        uint256[] payload,\n        uint256 nonce\n    );\n\n    // An event that is raised when a message from L1 to L2 is canceled.\n    event MessageToL2Canceled(\n        address indexed fromAddress,\n        uint256 indexed toAddress,\n        uint256 indexed selector,\n        uint256[] payload,\n        uint256 nonce\n    );\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1, \"Math: mulDiv overflow\");\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155.sol\";\nimport \"./IERC1155Receiver.sol\";\nimport \"./extensions/IERC1155MetadataURI.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {\n    using Address for address;\n\n    // Mapping from token ID to account balances\n    mapping(uint256 => mapping(address => uint256)) private _balances;\n\n    // Mapping from account to operator approvals\n    mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n    string private _uri;\n\n    /**\n     * @dev See {_setURI}.\n     */\n    constructor(string memory uri_) {\n        _setURI(uri_);\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return\n            interfaceId == type(IERC1155).interfaceId ||\n            interfaceId == type(IERC1155MetadataURI).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC1155MetadataURI-uri}.\n     *\n     * This implementation returns the same URI for *all* token types. It relies\n     * on the token type ID substitution mechanism\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n     *\n     * Clients calling this function must replace the `\\{id\\}` substring with the\n     * actual token type ID.\n     */\n    function uri(uint256) public view virtual override returns (string memory) {\n        return _uri;\n    }\n\n    /**\n     * @dev See {IERC1155-balanceOf}.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n        require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n        return _balances[id][account];\n    }\n\n    /**\n     * @dev See {IERC1155-balanceOfBatch}.\n     *\n     * Requirements:\n     *\n     * - `accounts` and `ids` must have the same length.\n     */\n    function balanceOfBatch(\n        address[] memory accounts,\n        uint256[] memory ids\n    ) public view virtual override returns (uint256[] memory) {\n        require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n        uint256[] memory batchBalances = new uint256[](accounts.length);\n\n        for (uint256 i = 0; i < accounts.length; ++i) {\n            batchBalances[i] = balanceOf(accounts[i], ids[i]);\n        }\n\n        return batchBalances;\n    }\n\n    /**\n     * @dev See {IERC1155-setApprovalForAll}.\n     */\n    function setApprovalForAll(address operator, bool approved) public virtual override {\n        _setApprovalForAll(_msgSender(), operator, approved);\n    }\n\n    /**\n     * @dev See {IERC1155-isApprovedForAll}.\n     */\n    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n        return _operatorApprovals[account][operator];\n    }\n\n    /**\n     * @dev See {IERC1155-safeTransferFrom}.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 id,\n        uint256 amount,\n        bytes memory data\n    ) public virtual override {\n        require(\n            from == _msgSender() || isApprovedForAll(from, _msgSender()),\n            \"ERC1155: caller is not token owner or approved\"\n        );\n        _safeTransferFrom(from, to, id, amount, data);\n    }\n\n    /**\n     * @dev See {IERC1155-safeBatchTransferFrom}.\n     */\n    function safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) public virtual override {\n        require(\n            from == _msgSender() || isApprovedForAll(from, _msgSender()),\n            \"ERC1155: caller is not token owner or approved\"\n        );\n        _safeBatchTransferFrom(from, to, ids, amounts, data);\n    }\n\n    /**\n     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of tokens of type `id` of at least `amount`.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function _safeTransferFrom(\n        address from,\n        address to,\n        uint256 id,\n        uint256 amount,\n        bytes memory data\n    ) internal virtual {\n        require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n        address operator = _msgSender();\n        uint256[] memory ids = _asSingletonArray(id);\n        uint256[] memory amounts = _asSingletonArray(amount);\n\n        _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n        uint256 fromBalance = _balances[id][from];\n        require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n        unchecked {\n            _balances[id][from] = fromBalance - amount;\n        }\n        _balances[id][to] += amount;\n\n        emit TransferSingle(operator, from, to, id, amount);\n\n        _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n    }\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function _safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) internal virtual {\n        require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n        require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n        address operator = _msgSender();\n\n        _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n        for (uint256 i = 0; i < ids.length; ++i) {\n            uint256 id = ids[i];\n            uint256 amount = amounts[i];\n\n            uint256 fromBalance = _balances[id][from];\n            require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n            unchecked {\n                _balances[id][from] = fromBalance - amount;\n            }\n            _balances[id][to] += amount;\n        }\n\n        emit TransferBatch(operator, from, to, ids, amounts);\n\n        _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n    }\n\n    /**\n     * @dev Sets a new URI for all token types, by relying on the token type ID\n     * substitution mechanism\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n     *\n     * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n     * URI or any of the amounts in the JSON file at said URI will be replaced by\n     * clients with the token type ID.\n     *\n     * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n     * interpreted by clients as\n     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n     * for token type ID 0x4cce0.\n     *\n     * See {uri}.\n     *\n     * Because these URIs cannot be meaningfully represented by the {URI} event,\n     * this function emits no events.\n     */\n    function _setURI(string memory newuri) internal virtual {\n        _uri = newuri;\n    }\n\n    /**\n     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n        require(to != address(0), \"ERC1155: mint to the zero address\");\n\n        address operator = _msgSender();\n        uint256[] memory ids = _asSingletonArray(id);\n        uint256[] memory amounts = _asSingletonArray(amount);\n\n        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n        _balances[id][to] += amount;\n        emit TransferSingle(operator, address(0), to, id, amount);\n\n        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n    }\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - `ids` and `amounts` must have the same length.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function _mintBatch(\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) internal virtual {\n        require(to != address(0), \"ERC1155: mint to the zero address\");\n        require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n        address operator = _msgSender();\n\n        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n        for (uint256 i = 0; i < ids.length; i++) {\n            _balances[ids[i]][to] += amounts[i];\n        }\n\n        emit TransferBatch(operator, address(0), to, ids, amounts);\n\n        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens of token type `id` from `from`\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `from` must have at least `amount` tokens of token type `id`.\n     */\n    function _burn(address from, uint256 id, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC1155: burn from the zero address\");\n\n        address operator = _msgSender();\n        uint256[] memory ids = _asSingletonArray(id);\n        uint256[] memory amounts = _asSingletonArray(amount);\n\n        _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n        uint256 fromBalance = _balances[id][from];\n        require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n        unchecked {\n            _balances[id][from] = fromBalance - amount;\n        }\n\n        emit TransferSingle(operator, from, address(0), id, amount);\n\n        _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n    }\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - `ids` and `amounts` must have the same length.\n     */\n    function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {\n        require(from != address(0), \"ERC1155: burn from the zero address\");\n        require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n        address operator = _msgSender();\n\n        _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n        for (uint256 i = 0; i < ids.length; i++) {\n            uint256 id = ids[i];\n            uint256 amount = amounts[i];\n\n            uint256 fromBalance = _balances[id][from];\n            require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n            unchecked {\n                _balances[id][from] = fromBalance - amount;\n            }\n        }\n\n        emit TransferBatch(operator, from, address(0), ids, amounts);\n\n        _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n    }\n\n    /**\n     * @dev Approve `operator` to operate on all of `owner` tokens\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n        require(owner != operator, \"ERC1155: setting approval status for self\");\n        _operatorApprovals[owner][operator] = approved;\n        emit ApprovalForAll(owner, operator, approved);\n    }\n\n    /**\n     * @dev Hook that is called before any token transfer. This includes minting\n     * and burning, as well as batched variants.\n     *\n     * The same hook is called on both single and batched variants. For single\n     * transfers, the length of the `ids` and `amounts` arrays will be 1.\n     *\n     * Calling conditions (for each `id` and `amount` pair):\n     *\n     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * of token type `id` will be  transferred to `to`.\n     * - When `from` is zero, `amount` tokens of token type `id` will be minted\n     * for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n     * will be burned.\n     * - `from` and `to` are never both zero.\n     * - `ids` and `amounts` have the same, non-zero length.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(\n        address operator,\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any token transfer. This includes minting\n     * and burning, as well as batched variants.\n     *\n     * The same hook is called on both single and batched variants. For single\n     * transfers, the length of the `id` and `amount` arrays will be 1.\n     *\n     * Calling conditions (for each `id` and `amount` pair):\n     *\n     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * of token type `id` will be  transferred to `to`.\n     * - When `from` is zero, `amount` tokens of token type `id` will be minted\n     * for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n     * will be burned.\n     * - `from` and `to` are never both zero.\n     * - `ids` and `amounts` have the same, non-zero length.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(\n        address operator,\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) internal virtual {}\n\n    function _doSafeTransferAcceptanceCheck(\n        address operator,\n        address from,\n        address to,\n        uint256 id,\n        uint256 amount,\n        bytes memory data\n    ) private {\n        if (to.isContract()) {\n            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n                if (response != IERC1155Receiver.onERC1155Received.selector) {\n                    revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n                }\n            } catch Error(string memory reason) {\n                revert(reason);\n            } catch {\n                revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n            }\n        }\n    }\n\n    function _doSafeBatchTransferAcceptanceCheck(\n        address operator,\n        address from,\n        address to,\n        uint256[] memory ids,\n        uint256[] memory amounts,\n        bytes memory data\n    ) private {\n        if (to.isContract()) {\n            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n                bytes4 response\n            ) {\n                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {\n                    revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n                }\n            } catch Error(string memory reason) {\n                revert(reason);\n            } catch {\n                revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n            }\n        }\n    }\n\n    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n        uint256[] memory array = new uint256[](1);\n        array[0] = element;\n\n        return array;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/Proxy.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n    /**\n     * @dev Delegates the current call to `implementation`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _delegate(address implementation) internal virtual {\n        assembly {\n            // Copy msg.data. We take full control of memory in this inline assembly\n            // block because it will not return to Solidity code. We overwrite the\n            // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n            // Call the implementation.\n            // out and outsize are 0 because we don't know the size yet.\n            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n            // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /**\n     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n     * and {_fallback} should delegate.\n     */\n    function _implementation() internal view virtual returns (address);\n\n    /**\n     * @dev Delegates the current call to the address returned by `_implementation()`.\n     *\n     * This function does not return to its internal call site, it will return directly to the external caller.\n     */\n    function _fallback() internal virtual {\n        _beforeFallback();\n        _delegate(_implementation());\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n     * function in the contract matches the call data.\n     */\n    fallback() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n     * is empty.\n     */\n    receive() external payable virtual {\n        _fallback();\n    }\n\n    /**\n     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n     * call, or as part of the Solidity `fallback` or `receive` functions.\n     *\n     * If overridden should call `super._beforeFallback()`.\n     */\n    function _beforeFallback() internal virtual {}\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            Address.isContract(IBeacon(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n        }\n    }\n}\n"
      },
      "src/token/ERC1155Bridgeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol\";\nimport \"openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Supply.sol\";\n\nimport \"./IERC1155Bridgeable.sol\";\nimport \"../UUPSProxied.sol\";\n\n/**\n   @title ERC1155 that can be minted by the bridge.\n\n   @dev As this ERC1155 must be upgradable, the name and symbol must\n   be overriden to work correctly, as the constructor can't be called,\n   but initialization function instead.\n*/\ncontract ERC1155Bridgeable is ERC1155Supply, UUPSOwnableProxied, IERC1155Bridgeable {\n\n    /**\n       @notice Default constructor, but intialize is used instead.\n    */\n    constructor()\n        ERC1155(\"\")\n    { }\n\n    /**\n       @notice Initializes the implementation, only callable once.\n\n       @param data Data to init the implementation.\n    */\n    function initialize(\n        bytes calldata data\n    )\n        public\n        onlyInit\n    {\n        (string memory uri_) = abi.decode(data, (string));\n\n        _setURI(uri_);\n\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n       @notice A free mint for testing.\n\n       @param to The new owner.\n       @param id The token type to mint.\n       @param value Amount of the token.\n    */\n    function mintFree(\n        address to,\n        uint256 id,\n        uint256 value\n    )\n        external\n    {\n        _mint(to, id, value, \"\");\n    }\n\n    /**\n       @inheritdoc IERC1155Bridgeable\n\n       @dev In this implementation, the owner is the bridge by default. So `onlyOwner`\n       is enough.\n    */\n    function mintFromBridge(\n        address to,\n        uint256 id,\n        uint256 value\n    )\n        public\n        onlyOwner\n    {\n        _mint(to, id, value, \"\");\n    }\n\n    /**\n       @inheritdoc IERC1155Bridgeable\n\n       @dev In this implementation, the owner is the bridge by default. So `onlyOwner`\n       is enough.\n    */\n    function burnFromBridge(\n        address from,\n        uint256 id,\n        uint256 value\n    )\n        public\n        onlyOwner\n    {\n        _burn(from, id, value);\n    }\n\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Emitted when the beacon is changed.\n     */\n    event BeaconUpgraded(address indexed beacon);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\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 ERC1967 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(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\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    /**\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 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}\n"
      },
      "src/token/IERC1155Bridgeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n   @title ERC1155Bridgeable token.\n   \n   @notice This interface allows a contract to expose functions\n   that allows a bridge to mint and burn token.\n*/\ninterface IERC1155Bridgeable {\n\n    /**\n       @notice Mints a token from the bridge.\n\n       @param to The new owner.\n       @param id The token type to mint.\n       @param value Amount of the token.\n    */\n    function mintFromBridge(address to, uint256 id, uint256 value)\n        external;\n\n    /**\n       @notice Burns a token from the bridge.\n\n       @param from The owner burning tokens.\n       @param id The token type to burn.\n       @param value Amount to burn.\n    */\n    function burnFromBridge(address from, uint256 id, uint256 value)\n        external;\n\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "openzeppelin/=lib/openzeppelin-contracts/contracts/",
        "starknet/=lib/starknet/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "libraries": {
        "src/token/Deployer.sol": {
          "Deployer": "0x69192616f41d7151ec7b8bb85bd80655cc14557d"
        }
      }
    }
  }}