@etherspot/contracts
Version:
Etherspot Solidity contracts
862 lines • 29.4 kB
JSON
{
"id": "dffb475fe3e49e3596342afea814b0c6",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.4",
"solcLongVersion": "0.8.4+commit.c7e474f2",
"input": {
"language": "Solidity",
"sources": {
"DiamondReentrancyGuard_flat.sol": {
"content": "\n// File: common/helpers/DiamondReentrancyGuard.sol\n\n\npragma solidity 0.8.4;\n\n/// @title Reentrancy Guard\n/// @notice Abstract contract to provide protection against reentrancy\nabstract contract ReentrancyGuard {\n //////////////////////////////////////////////////////////////\n ////////////////////////// Storage ///////////////////////////\n //////////////////////////////////////////////////////////////\n\n bytes32 private constant NAMESPACE =\n keccak256(\"io.etherspot.helpers.reentrancyguard\");\n\n //////////////////////////////////////////////////////////////\n ////////////////////////// Structs ///////////////////////////\n //////////////////////////////////////////////////////////////\n\n struct ReentrancyStorage {\n uint256 status;\n }\n\n //////////////////////////////////////////////////////////////\n ////////////////////////// Errors ////////////////////////////\n //////////////////////////////////////////////////////////////\n\n error ReentrancyError();\n\n //////////////////////////////////////////////////////////////\n ///////////////////////// Constants //////////////////////////\n //////////////////////////////////////////////////////////////\n\n uint256 private constant _NOT_ENTERED = 0;\n uint256 private constant _ENTERED = 1;\n\n //////////////////////////////////////////////////////////////\n ///////////////////////// Modifiers ///////////////////////////\n //////////////////////////////////////////////////////////////\n\n modifier nonReentrant() {\n ReentrancyStorage storage s = reentrancyStorage();\n if (s.status == _ENTERED) revert ReentrancyError();\n s.status = _ENTERED;\n _;\n s.status = _NOT_ENTERED;\n }\n\n //////////////////////////////////////////////////////////////\n ////////////////////// Private Functions /////////////////////\n //////////////////////////////////////////////////////////////\n\n /// @dev fetch local storage\n function reentrancyStorage()\n private\n pure\n returns (ReentrancyStorage storage data)\n {\n bytes32 position = NAMESPACE;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n data.slot := position\n }\n }\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"
]
}
}
}
},
"output": {
"contracts": {
"DiamondReentrancyGuard_flat.sol": {
"ReentrancyGuard": {
"abi": [
{
"inputs": [],
"name": "ReentrancyError",
"type": "error"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"title": "Reentrancy Guard",
"version": 1
},
"evm": {
"assembly": "",
"bytecode": {
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"legacyAssembly": null,
"methodIdentifiers": {}
},
"metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ReentrancyError\",\"type\":\"error\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Reentrancy Guard\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Abstract contract to provide protection against reentrancy\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"DiamondReentrancyGuard_flat.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"DiamondReentrancyGuard_flat.sol\":{\"keccak256\":\"0x125bdf7e6c38d9ed6bfc3ee676931618f17ef04f2161c4d0b437c606b69cf2b8\",\"urls\":[\"bzz-raw://a67fc3ccec6ff95423c06dc48cea9a683c4db5b9bdaa90ef45e3da89c512f491\",\"dweb:/ipfs/QmeajCM5sxwJwCVmc4bhhQgsutrFyjvtrU1EThzB55S9Ai\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"notice": "Abstract contract to provide protection against reentrancy",
"version": 1
}
}
}
},
"errors": [
{
"component": "general",
"errorCode": "1878",
"formattedMessage": "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.\n--> DiamondReentrancyGuard_flat.sol\n\n",
"message": "SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.",
"severity": "warning",
"sourceLocation": {
"end": -1,
"file": "DiamondReentrancyGuard_flat.sol",
"start": -1
},
"type": "Warning"
}
],
"sources": {
"DiamondReentrancyGuard_flat.sol": {
"ast": {
"absolutePath": "DiamondReentrancyGuard_flat.sol",
"exportedSymbols": {
"ReentrancyGuard": [
62
]
},
"id": 63,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"0.8",
".4"
],
"nodeType": "PragmaDirective",
"src": "54:22:0"
},
{
"abstract": true,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 2,
"nodeType": "StructuredDocumentation",
"src": "78:99:0",
"text": "@title Reentrancy Guard\n @notice Abstract contract to provide protection against reentrancy"
},
"fullyImplemented": true,
"id": 62,
"linearizedBaseContracts": [
62
],
"name": "ReentrancyGuard",
"nameLocation": "195:15:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 7,
"mutability": "constant",
"name": "NAMESPACE",
"nameLocation": "444:9:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "419:94:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 3,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "419:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": {
"arguments": [
{
"hexValue": "696f2e657468657273706f742e68656c706572732e7265656e7472616e63796775617264",
"id": 5,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "474:38:0",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_c59b5acc5a6673a6c49ca2de898f87adbd9fdfdff36f689476b1c9e0c50964b4",
"typeString": "literal_string \"io.etherspot.helpers.reentrancyguard\""
},
"value": "io.etherspot.helpers.reentrancyguard"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_stringliteral_c59b5acc5a6673a6c49ca2de898f87adbd9fdfdff36f689476b1c9e0c50964b4",
"typeString": "literal_string \"io.etherspot.helpers.reentrancyguard\""
}
],
"id": 4,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967288,
"src": "464:9:0",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 6,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "464:49:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "private"
},
{
"canonicalName": "ReentrancyGuard.ReentrancyStorage",
"id": 10,
"members": [
{
"constant": false,
"id": 9,
"mutability": "mutable",
"name": "status",
"nameLocation": "765:6:0",
"nodeType": "VariableDeclaration",
"scope": 10,
"src": "757:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 8,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "757:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "ReentrancyStorage",
"nameLocation": "729:17:0",
"nodeType": "StructDefinition",
"scope": 62,
"src": "722:56:0",
"visibility": "public"
},
{
"id": 12,
"name": "ReentrancyError",
"nameLocation": "992:15:0",
"nodeType": "ErrorDefinition",
"parameters": {
"id": 11,
"nodeType": "ParameterList",
"parameters": [],
"src": "1007:2:0"
},
"src": "986:24:0"
},
{
"constant": true,
"id": 15,
"mutability": "constant",
"name": "_NOT_ENTERED",
"nameLocation": "1243:12:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "1218:41:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1218:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"hexValue": "30",
"id": 14,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1258:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"visibility": "private"
},
{
"constant": true,
"id": 18,
"mutability": "constant",
"name": "_ENTERED",
"nameLocation": "1290:8:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "1265:37:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1265:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"hexValue": "31",
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1301:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "private"
},
{
"body": {
"id": 47,
"nodeType": "Block",
"src": "1536:199:0",
"statements": [
{
"assignments": [
22
],
"declarations": [
{
"constant": false,
"id": 22,
"mutability": "mutable",
"name": "s",
"nameLocation": "1572:1:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "1546:27:0",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage"
},
"typeName": {
"id": 21,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 20,
"name": "ReentrancyStorage",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "1546:17:0"
},
"referencedDeclaration": 10,
"src": "1546:17:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage"
}
},
"visibility": "internal"
}
],
"id": 25,
"initialValue": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 23,
"name": "reentrancyStorage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 61,
"src": "1576:17:0",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$__$returns$_t_struct$_ReentrancyStorage_$10_storage_ptr_$",
"typeString": "function () pure returns (struct ReentrancyGuard.ReentrancyStorage storage pointer)"
}
},
"id": 24,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1576:19:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage storage pointer"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1546:49:0"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 29,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"id": 26,
"name": "s",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22,
"src": "1609:1:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage storage pointer"
}
},
"id": 27,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "status",
"nodeType": "MemberAccess",
"referencedDeclaration": 9,
"src": "1609:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 28,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18,
"src": "1621:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1609:20:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 33,
"nodeType": "IfStatement",
"src": "1605:50:0",
"trueBody": {
"errorCall": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 30,
"name": "ReentrancyError",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 12,
"src": "1638:15:0",
"typeDescriptions": {
"typeIdentifier": "t_function_error_pure$__$returns$__$",
"typeString": "function () pure"
}
},
"id": 31,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1638:17:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 32,
"nodeType": "RevertStatement",
"src": "1631:24:0"
}
},
{
"expression": {
"id": 38,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"expression": {
"id": 34,
"name": "s",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22,
"src": "1665:1:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage storage pointer"
}
},
"id": 36,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "status",
"nodeType": "MemberAccess",
"referencedDeclaration": 9,
"src": "1665:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 37,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18,
"src": "1676:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1665:19:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 39,
"nodeType": "ExpressionStatement",
"src": "1665:19:0"
},
{
"id": 40,
"nodeType": "PlaceholderStatement",
"src": "1694:1:0"
},
{
"expression": {
"id": 45,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"expression": {
"id": 41,
"name": "s",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22,
"src": "1705:1:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage storage pointer"
}
},
"id": 43,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"memberName": "status",
"nodeType": "MemberAccess",
"referencedDeclaration": 9,
"src": "1705:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 44,
"name": "_NOT_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15,
"src": "1716:12:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1705:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 46,
"nodeType": "ExpressionStatement",
"src": "1705:23:0"
}
]
},
"id": 48,
"name": "nonReentrant",
"nameLocation": "1521:12:0",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 19,
"nodeType": "ParameterList",
"parameters": [],
"src": "1533:2:0"
},
"src": "1512:223:0",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 60,
"nodeType": "Block",
"src": "2087:164:0",
"statements": [
{
"assignments": [
56
],
"declarations": [
{
"constant": false,
"id": 56,
"mutability": "mutable",
"name": "position",
"nameLocation": "2105:8:0",
"nodeType": "VariableDeclaration",
"scope": 60,
"src": "2097:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 55,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2097:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
}
],
"id": 58,
"initialValue": {
"id": 57,
"name": "NAMESPACE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "2116:9:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2097:28:0"
},
{
"AST": {
"nodeType": "YulBlock",
"src": "2200:45:0",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2214:21:0",
"value": {
"name": "position",
"nodeType": "YulIdentifier",
"src": "2227:8:0"
},
"variableNames": [
{
"name": "data.slot",
"nodeType": "YulIdentifier",
"src": "2214:9:0"
}
]
}
]
},
"evmVersion": "istanbul",
"externalReferences": [
{
"declaration": 53,
"isOffset": false,
"isSlot": true,
"src": "2214:9:0",
"suffix": "slot",
"valueSize": 1
},
{
"declaration": 56,
"isOffset": false,
"isSlot": false,
"src": "2227:8:0",
"valueSize": 1
}
],
"id": 59,
"nodeType": "InlineAssembly",
"src": "2191:54:0"
}
]
},
"documentation": {
"id": 49,
"nodeType": "StructuredDocumentation",
"src": "1943:28:0",
"text": "@dev fetch local storage"
},
"id": 61,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "reentrancyStorage",
"nameLocation": "1985:17:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 50,
"nodeType": "ParameterList",
"parameters": [],
"src": "2002:2:0"
},
"returnParameters": {
"id": 54,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 53,
"mutability": "mutable",
"name": "data",
"nameLocation": "2077:4:0",
"nodeType": "VariableDeclaration",
"scope": 61,
"src": "2051:30:0",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage"
},
"typeName": {
"id": 52,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 51,
"name": "ReentrancyStorage",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "2051:17:0"
},
"referencedDeclaration": 10,
"src": "2051:17:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage"
}
},
"visibility": "internal"
}
],
"src": "2050:32:0"
},
"scope": 62,
"src": "1976:275:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "private"
}
],
"scope": 63,
"src": "177:2076:0",
"usedErrors": [
12
]
}
],
"src": "54:2200:0"
},
"id": 0
}
}
}
}