Skip to content

Instantly share code, notes, and snippets.

@must479
Created February 26, 2026 16:46
Show Gist options
  • Select an option

  • Save must479/d5d4a5dc52774dcc7bc6eff9780e0a50 to your computer and use it in GitHub Desktop.

Select an option

Save must479/d5d4a5dc52774dcc7bc6eff9780e0a50 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.31+commit.fd3a2265.js&optimize=undefined&runs=200&gist=
{
"id": "9d9cb5e04d12c4b60872ec92df87b98d",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.31",
"solcLongVersion": "0.8.31+commit.fd3a2265",
"input": {
"language": "Solidity",
"sources": {
"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/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"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
},
"remappings": []
}
},
"output": {
"contracts": {
"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol": {
"Proxy": {
"abi": [
{
"stateMutability": "payable",
"type": "fallback"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"devdoc": {
"details": "This abstract contract provides a fallback function that delegates all calls to another contract using the EVM instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to be specified by overriding the virtual {_implementation} function. Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a different contract through the {_delegate} function. The success and return data of the delegated call will be returned back to the caller of the proxy.",
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"assembly": "",
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"legacyAssembly": null,
"methodIdentifiers": {}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.31+commit.fd3a2265\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This abstract contract provides a fallback function that delegates all calls to another contract using the EVM instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to be specified by overriding the virtual {_implementation} function. Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a different contract through the {_delegate} function. The success and return data of the delegated call will be returned back to the caller of the proxy.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol\":\"Proxy\"},\"evmVersion\":\"osaka\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol\":{\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8831721b6f4cc26534d190f9f1631c3f59c9ff38efdd911f85e0882b8e360472\",\"dweb:/ipfs/QmQZnLErZNStirSQ13ZNWQgvEYUtGE5tXYwn4QUPaVUfPN\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol": {
"ast": {
"absolutePath": "eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol",
"exportedSymbols": {
"Proxy": [
51
]
},
"id": 52,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "99:23:0"
},
{
"abstract": true,
"baseContracts": [],
"canonicalName": "Proxy",
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 2,
"nodeType": "StructuredDocumentation",
"src": "124:598:0",
"text": " @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 Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n different contract through the {_delegate} function.\n The success and return data of the delegated call will be returned back to the caller of the proxy."
},
"fullyImplemented": false,
"id": 51,
"linearizedBaseContracts": [
51
],
"name": "Proxy",
"nameLocation": "741:5:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 9,
"nodeType": "Block",
"src": "1008:835:0",
"statements": [
{
"AST": {
"nativeSrc": "1027:810:0",
"nodeType": "YulBlock",
"src": "1027:810:0",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1280:1:0",
"nodeType": "YulLiteral",
"src": "1280:1:0",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1283:1:0",
"nodeType": "YulLiteral",
"src": "1283:1:0",
"type": "",
"value": "0"
},
{
"arguments": [],
"functionName": {
"name": "calldatasize",
"nativeSrc": "1286:12:0",
"nodeType": "YulIdentifier",
"src": "1286:12:0"
},
"nativeSrc": "1286:14:0",
"nodeType": "YulFunctionCall",
"src": "1286:14:0"
}
],
"functionName": {
"name": "calldatacopy",
"nativeSrc": "1267:12:0",
"nodeType": "YulIdentifier",
"src": "1267:12:0"
},
"nativeSrc": "1267:34:0",
"nodeType": "YulFunctionCall",
"src": "1267:34:0"
},
"nativeSrc": "1267:34:0",
"nodeType": "YulExpressionStatement",
"src": "1267:34:0"
},
{
"nativeSrc": "1428:74:0",
"nodeType": "YulVariableDeclaration",
"src": "1428:74:0",
"value": {
"arguments": [
{
"arguments": [],
"functionName": {
"name": "gas",
"nativeSrc": "1455:3:0",
"nodeType": "YulIdentifier",
"src": "1455:3:0"
},
"nativeSrc": "1455:5:0",
"nodeType": "YulFunctionCall",
"src": "1455:5:0"
},
{
"name": "implementation",
"nativeSrc": "1462:14:0",
"nodeType": "YulIdentifier",
"src": "1462:14:0"
},
{
"kind": "number",
"nativeSrc": "1478:1:0",
"nodeType": "YulLiteral",
"src": "1478:1:0",
"type": "",
"value": "0"
},
{
"arguments": [],
"functionName": {
"name": "calldatasize",
"nativeSrc": "1481:12:0",
"nodeType": "YulIdentifier",
"src": "1481:12:0"
},
"nativeSrc": "1481:14:0",
"nodeType": "YulFunctionCall",
"src": "1481:14:0"
},
{
"kind": "number",
"nativeSrc": "1497:1:0",
"nodeType": "YulLiteral",
"src": "1497:1:0",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1500:1:0",
"nodeType": "YulLiteral",
"src": "1500:1:0",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "delegatecall",
"nativeSrc": "1442:12:0",
"nodeType": "YulIdentifier",
"src": "1442:12:0"
},
"nativeSrc": "1442:60:0",
"nodeType": "YulFunctionCall",
"src": "1442:60:0"
},
"variables": [
{
"name": "result",
"nativeSrc": "1432:6:0",
"nodeType": "YulTypedName",
"src": "1432:6:0",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1570:1:0",
"nodeType": "YulLiteral",
"src": "1570:1:0",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1573:1:0",
"nodeType": "YulLiteral",
"src": "1573:1:0",
"type": "",
"value": "0"
},
{
"arguments": [],
"functionName": {
"name": "returndatasize",
"nativeSrc": "1576:14:0",
"nodeType": "YulIdentifier",
"src": "1576:14:0"
},
"nativeSrc": "1576:16:0",
"nodeType": "YulFunctionCall",
"src": "1576:16:0"
}
],
"functionName": {
"name": "returndatacopy",
"nativeSrc": "1555:14:0",
"nodeType": "YulIdentifier",
"src": "1555:14:0"
},
"nativeSrc": "1555:38:0",
"nodeType": "YulFunctionCall",
"src": "1555:38:0"
},
"nativeSrc": "1555:38:0",
"nodeType": "YulExpressionStatement",
"src": "1555:38:0"
},
{
"cases": [
{
"body": {
"nativeSrc": "1688:59:0",
"nodeType": "YulBlock",
"src": "1688:59:0",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1713:1:0",
"nodeType": "YulLiteral",
"src": "1713:1:0",
"type": "",
"value": "0"
},
{
"arguments": [],
"functionName": {
"name": "returndatasize",
"nativeSrc": "1716:14:0",
"nodeType": "YulIdentifier",
"src": "1716:14:0"
},
"nativeSrc": "1716:16:0",
"nodeType": "YulFunctionCall",
"src": "1716:16:0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "1706:6:0",
"nodeType": "YulIdentifier",
"src": "1706:6:0"
},
"nativeSrc": "1706:27:0",
"nodeType": "YulFunctionCall",
"src": "1706:27:0"
},
"nativeSrc": "1706:27:0",
"nodeType": "YulExpressionStatement",
"src": "1706:27:0"
}
]
},
"nativeSrc": "1681:66:0",
"nodeType": "YulCase",
"src": "1681:66:0",
"value": {
"kind": "number",
"nativeSrc": "1686:1:0",
"nodeType": "YulLiteral",
"src": "1686:1:0",
"type": "",
"value": "0"
}
},
{
"body": {
"nativeSrc": "1768:59:0",
"nodeType": "YulBlock",
"src": "1768:59:0",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1793:1:0",
"nodeType": "YulLiteral",
"src": "1793:1:0",
"type": "",
"value": "0"
},
{
"arguments": [],
"functionName": {
"name": "returndatasize",
"nativeSrc": "1796:14:0",
"nodeType": "YulIdentifier",
"src": "1796:14:0"
},
"nativeSrc": "1796:16:0",
"nodeType": "YulFunctionCall",
"src": "1796:16:0"
}
],
"functionName": {
"name": "return",
"nativeSrc": "1786:6:0",
"nodeType": "YulIdentifier",
"src": "1786:6:0"
},
"nativeSrc": "1786:27:0",
"nodeType": "YulFunctionCall",
"src": "1786:27:0"
},
"nativeSrc": "1786:27:0",
"nodeType": "YulExpressionStatement",
"src": "1786:27:0"
}
]
},
"nativeSrc": "1760:67:0",
"nodeType": "YulCase",
"src": "1760:67:0",
"value": "default"
}
],
"expression": {
"name": "result",
"nativeSrc": "1614:6:0",
"nodeType": "YulIdentifier",
"src": "1614:6:0"
},
"nativeSrc": "1607:220:0",
"nodeType": "YulSwitch",
"src": "1607:220:0"
}
]
},
"evmVersion": "osaka",
"externalReferences": [
{
"declaration": 5,
"isOffset": false,
"isSlot": false,
"src": "1462:14:0",
"valueSize": 1
}
],
"id": 8,
"nodeType": "InlineAssembly",
"src": "1018:819:0"
}
]
},
"documentation": {
"id": 3,
"nodeType": "StructuredDocumentation",
"src": "753:190:0",
"text": " @dev Delegates the current call to `implementation`.\n This function does not return to its internal call site, it will return directly to the external caller."
},
"id": 10,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_delegate",
"nameLocation": "957:9:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 5,
"mutability": "mutable",
"name": "implementation",
"nameLocation": "975:14:0",
"nodeType": "VariableDeclaration",
"scope": 10,
"src": "967:22:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "967:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "966:24:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "1008:0:0"
},
"scope": 51,
"src": "948:895:0",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "internal"
},
{
"documentation": {
"id": 11,
"nodeType": "StructuredDocumentation",
"src": "1849:173:0",
"text": " @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."
},
"id": 16,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "_implementation",
"nameLocation": "2036:15:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 12,
"nodeType": "ParameterList",
"parameters": [],
"src": "2051:2:0"
},
"returnParameters": {
"id": 15,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 14,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 16,
"src": "2085:7:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 13,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2085:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "2084:9:0"
},
"scope": 51,
"src": "2027:67:0",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
{
"body": {
"id": 28,
"nodeType": "Block",
"src": "2360:72:0",
"statements": [
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 20,
"name": "_beforeFallback",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 50,
"src": "2370:15:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 21,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2370:17:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22,
"nodeType": "ExpressionStatement",
"src": "2370:17:0"
},
{
"expression": {
"arguments": [
{
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 24,
"name": "_implementation",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16,
"src": "2407:15:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 25,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2407:17:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 23,
"name": "_delegate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10,
"src": "2397:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$",
"typeString": "function (address)"
}
},
"id": 26,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2397:28:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 27,
"nodeType": "ExpressionStatement",
"src": "2397:28:0"
}
]
},
"documentation": {
"id": 17,
"nodeType": "StructuredDocumentation",
"src": "2100:217:0",
"text": " @dev Delegates the current call to the address returned by `_implementation()`.\n This function does not return to its internal call site, it will return directly to the external caller."
},
"id": 29,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_fallback",
"nameLocation": "2331:9:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 18,
"nodeType": "ParameterList",
"parameters": [],
"src": "2340:2:0"
},
"returnParameters": {
"id": 19,
"nodeType": "ParameterList",
"parameters": [],
"src": "2360:0:0"
},
"scope": 51,
"src": "2322:110:0",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "internal"
},
{
"body": {
"id": 36,
"nodeType": "Block",
"src": "2665:28:0",
"statements": [
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 33,
"name": "_fallback",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 29,
"src": "2675:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 34,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2675:11:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 35,
"nodeType": "ExpressionStatement",
"src": "2675:11:0"
}
]
},
"documentation": {
"id": 30,
"nodeType": "StructuredDocumentation",
"src": "2438:186:0",
"text": " @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."
},
"id": 37,
"implemented": true,
"kind": "fallback",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 31,
"nodeType": "ParameterList",
"parameters": [],
"src": "2637:2:0"
},
"returnParameters": {
"id": 32,
"nodeType": "ParameterList",
"parameters": [],
"src": "2665:0:0"
},
"scope": 51,
"src": "2629:64:0",
"stateMutability": "payable",
"virtual": true,
"visibility": "external"
},
{
"body": {
"id": 44,
"nodeType": "Block",
"src": "2888:28:0",
"statements": [
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 41,
"name": "_fallback",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 29,
"src": "2898:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 42,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2898:11:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 43,
"nodeType": "ExpressionStatement",
"src": "2898:11:0"
}
]
},
"documentation": {
"id": 38,
"nodeType": "StructuredDocumentation",
"src": "2699:149:0",
"text": " @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n is empty."
},
"id": 45,
"implemented": true,
"kind": "receive",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 39,
"nodeType": "ParameterList",
"parameters": [],
"src": "2860:2:0"
},
"returnParameters": {
"id": 40,
"nodeType": "ParameterList",
"parameters": [],
"src": "2888:0:0"
},
"scope": 51,
"src": "2853:63:0",
"stateMutability": "payable",
"virtual": true,
"visibility": "external"
},
{
"body": {
"id": 49,
"nodeType": "Block",
"src": "3242:2:0",
"statements": []
},
"documentation": {
"id": 46,
"nodeType": "StructuredDocumentation",
"src": "2922:271:0",
"text": " @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 If overridden should call `super._beforeFallback()`."
},
"id": 50,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_beforeFallback",
"nameLocation": "3207:15:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 47,
"nodeType": "ParameterList",
"parameters": [],
"src": "3222:2:0"
},
"returnParameters": {
"id": 48,
"nodeType": "ParameterList",
"parameters": [],
"src": "3242:0:0"
},
"scope": 51,
"src": "3198:46:0",
"stateMutability": "nonpayable",
"virtual": true,
"visibility": "internal"
}
],
"scope": 52,
"src": "723:2523:0",
"usedErrors": [],
"usedEvents": []
}
],
"src": "99:3148:0"
},
"id": 0
}
}
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"sepolia:11155111": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {}
},
"abi": [
{
"stateMutability": "payable",
"type": "fallback"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
}
{
"compiler": {
"version": "0.8.31+commit.fd3a2265"
},
"language": "Solidity",
"output": {
"abi": [
{
"stateMutability": "payable",
"type": "fallback"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"devdoc": {
"details": "This abstract contract provides a fallback function that delegates all calls to another contract using the EVM instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to be specified by overriding the virtual {_implementation} function. Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a different contract through the {_delegate} function. The success and return data of the delegated call will be returned back to the caller of the proxy.",
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol": "Proxy"
},
"evmVersion": "osaka",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"eth-holesky.blockscout.com/0xF59fC390d35873Cc33Cf1C3896aCf5215d7E25Ca/@openzeppelin/contracts/proxy/Proxy.sol": {
"keccak256": "0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27",
"license": "MIT",
"urls": [
"bzz-raw://8831721b6f4cc26534d190f9f1631c3f59c9ff38efdd911f85e0882b8e360472",
"dweb:/ipfs/QmQZnLErZNStirSQ13ZNWQgvEYUtGE5tXYwn4QUPaVUfPN"
]
}
},
"version": 1
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)
pragma solidity ^0.8.0;
import "../Proxy.sol";
import "./ERC1967Upgrade.sol";
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*/
contract ERC1967Proxy is Proxy, ERC1967Upgrade {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializing the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
_upgradeToAndCall(_logic, _data, false);
}
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
return ERC1967Upgrade._getImplementation();
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade is IERC1967 {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment