@etherspot/contracts
Version:
Etherspot Solidity contracts
848 lines • 28.6 kB
JSON
{
"id": "cd3c2d3857d5f48391f6160d1ffd1d64",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.4",
"solcLongVersion": "0.8.4+commit.c7e474f2",
"input": {
"language": "Solidity",
"sources": {
"common/helpers/DiamondReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\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": {
"common/helpers/DiamondReentrancyGuard.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\":{\"common/helpers/DiamondReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"common/helpers/DiamondReentrancyGuard.sol\":{\"keccak256\":\"0x80669f5e1b6d50ad0b4020e8caeb447f515e3b904b14cad5d03cc32e345753d5\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://5411c17875ae78dc626ca80fb00a2f57f8b1652234ba16d2bfa0c0d7822447a5\",\"dweb:/ipfs/QmeY92iGRP7T7eNz7avJRwcA7AETSDNMhwujjEHarHJxY2\"]}},\"version\":1}",
"storageLayout": {
"storage": [],
"types": null
},
"userdoc": {
"kind": "user",
"methods": {},
"notice": "Abstract contract to provide protection against reentrancy",
"version": 1
}
}
}
},
"sources": {
"common/helpers/DiamondReentrancyGuard.sol": {
"ast": {
"absolutePath": "common/helpers/DiamondReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
62
]
},
"id": 63,
"license": "UNLICENSED",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
"0.8",
".4"
],
"nodeType": "PragmaDirective",
"src": "39:22:0"
},
{
"abstract": true,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 2,
"nodeType": "StructuredDocumentation",
"src": "63:99:0",
"text": "@title Reentrancy Guard\n @notice Abstract contract to provide protection against reentrancy"
},
"fullyImplemented": true,
"id": 62,
"linearizedBaseContracts": [
62
],
"name": "ReentrancyGuard",
"nameLocation": "180:15:0",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 7,
"mutability": "constant",
"name": "NAMESPACE",
"nameLocation": "429:9:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "404:94:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 3,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "404: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": "459: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": "449: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": "449: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": "750:6:0",
"nodeType": "VariableDeclaration",
"scope": 10,
"src": "742:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 8,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "742:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "ReentrancyStorage",
"nameLocation": "714:17:0",
"nodeType": "StructDefinition",
"scope": 62,
"src": "707:56:0",
"visibility": "public"
},
{
"id": 12,
"name": "ReentrancyError",
"nameLocation": "977:15:0",
"nodeType": "ErrorDefinition",
"parameters": {
"id": 11,
"nodeType": "ParameterList",
"parameters": [],
"src": "992:2:0"
},
"src": "971:24:0"
},
{
"constant": true,
"id": 15,
"mutability": "constant",
"name": "_NOT_ENTERED",
"nameLocation": "1228:12:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "1203:41:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1203: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": "1243: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": "1275:8:0",
"nodeType": "VariableDeclaration",
"scope": 62,
"src": "1250:37:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1250: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": "1286:1:0",
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "private"
},
{
"body": {
"id": 47,
"nodeType": "Block",
"src": "1521:199:0",
"statements": [
{
"assignments": [
22
],
"declarations": [
{
"constant": false,
"id": 22,
"mutability": "mutable",
"name": "s",
"nameLocation": "1557:1:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "1531: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": "1531:17:0"
},
"referencedDeclaration": 10,
"src": "1531: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": "1561: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": "1561:19:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage storage pointer"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1531: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": "1594: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": "1594:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 28,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18,
"src": "1606:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1594:20:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 33,
"nodeType": "IfStatement",
"src": "1590:50:0",
"trueBody": {
"errorCall": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 30,
"name": "ReentrancyError",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 12,
"src": "1623: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": "1623:17:0",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 32,
"nodeType": "RevertStatement",
"src": "1616: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": "1650: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": "1650:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 37,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 18,
"src": "1661:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1650:19:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 39,
"nodeType": "ExpressionStatement",
"src": "1650:19:0"
},
{
"id": 40,
"nodeType": "PlaceholderStatement",
"src": "1679: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": "1690: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": "1690:8:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 44,
"name": "_NOT_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15,
"src": "1701:12:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1690:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 46,
"nodeType": "ExpressionStatement",
"src": "1690:23:0"
}
]
},
"id": 48,
"name": "nonReentrant",
"nameLocation": "1506:12:0",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 19,
"nodeType": "ParameterList",
"parameters": [],
"src": "1518:2:0"
},
"src": "1497:223:0",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 60,
"nodeType": "Block",
"src": "2072:164:0",
"statements": [
{
"assignments": [
56
],
"declarations": [
{
"constant": false,
"id": 56,
"mutability": "mutable",
"name": "position",
"nameLocation": "2090:8:0",
"nodeType": "VariableDeclaration",
"scope": 60,
"src": "2082:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 55,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2082:7:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
}
],
"id": 58,
"initialValue": {
"id": 57,
"name": "NAMESPACE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7,
"src": "2101:9:0",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2082:28:0"
},
{
"AST": {
"nodeType": "YulBlock",
"src": "2185:45:0",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2199:21:0",
"value": {
"name": "position",
"nodeType": "YulIdentifier",
"src": "2212:8:0"
},
"variableNames": [
{
"name": "data.slot",
"nodeType": "YulIdentifier",
"src": "2199:9:0"
}
]
}
]
},
"evmVersion": "istanbul",
"externalReferences": [
{
"declaration": 53,
"isOffset": false,
"isSlot": true,
"src": "2199:9:0",
"suffix": "slot",
"valueSize": 1
},
{
"declaration": 56,
"isOffset": false,
"isSlot": false,
"src": "2212:8:0",
"valueSize": 1
}
],
"id": 59,
"nodeType": "InlineAssembly",
"src": "2176:54:0"
}
]
},
"documentation": {
"id": 49,
"nodeType": "StructuredDocumentation",
"src": "1928:28:0",
"text": "@dev fetch local storage"
},
"id": 61,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "reentrancyStorage",
"nameLocation": "1970:17:0",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 50,
"nodeType": "ParameterList",
"parameters": [],
"src": "1987:2:0"
},
"returnParameters": {
"id": 54,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 53,
"mutability": "mutable",
"name": "data",
"nameLocation": "2062:4:0",
"nodeType": "VariableDeclaration",
"scope": 61,
"src": "2036: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": "2036:17:0"
},
"referencedDeclaration": 10,
"src": "2036:17:0",
"typeDescriptions": {
"typeIdentifier": "t_struct$_ReentrancyStorage_$10_storage_ptr",
"typeString": "struct ReentrancyGuard.ReentrancyStorage"
}
},
"visibility": "internal"
}
],
"src": "2035:32:0"
},
"scope": 62,
"src": "1961:275:0",
"stateMutability": "pure",
"virtual": false,
"visibility": "private"
}
],
"scope": 63,
"src": "162:2076:0",
"usedErrors": [
12
]
}
],
"src": "39:2200:0"
},
"id": 0
}
}
}
}