UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

770 lines 33.5 kB
{ "contractName": "ReentrancyGuard", "abi": [ { "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, consider using {ReentrancyGuardTransient} instead. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\",\"errors\":{\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0x11a5a79827df29e915a12740caf62fe21ebe27c08c9ae3e09abe9ee3ba3866d3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3cf0c69ab827e3251db9ee6a50647d62c90ba580a4d7bbff21f2bea39e7b2f4a\",\"dweb:/ipfs/QmZiKwtKU1SBX4RGfQtY7PZfiapbbu6SZ9vizGQD9UHjRA\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant NOT_ENTERED = 1;\n uint256 private constant ENTERED = 2;\n\n uint256 private _status;\n\n /**\n * @dev Unauthorized reentrant call.\n */\n error ReentrancyGuardReentrantCall();\n\n constructor() {\n _status = NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be NOT_ENTERED\n if (_status == ENTERED) {\n revert ReentrancyGuardReentrantCall();\n }\n\n // Any calls to nonReentrant after this point will fail\n _status = ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == ENTERED;\n }\n}\n", "sourcePath": "@openzeppelin\\contracts\\utils\\ReentrancyGuard.sol", "ast": { "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", "exportedSymbols": { "ReentrancyGuard": [ 592 ] }, "id": 593, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 525, "literals": [ "solidity", "^", "0.8", ".20" ], "nodeType": "PragmaDirective", "src": "109:24:4" }, { "abstract": true, "baseContracts": [], "canonicalName": "ReentrancyGuard", "contractDependencies": [], "contractKind": "contract", "documentation": { "id": 526, "nodeType": "StructuredDocumentation", "src": "135:894:4", "text": " @dev Contract module that helps prevent reentrant calls to a function.\n Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n available, which can be applied to functions to make sure there are no nested\n (reentrant) calls to them.\n Note that because there is a single `nonReentrant` guard, functions marked as\n `nonReentrant` may not call one another. This can be worked around by making\n those functions `private`, and then adding `external` `nonReentrant` entry\n points to them.\n TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n consider using {ReentrancyGuardTransient} instead.\n TIP: If you would like to learn more about reentrancy and alternative ways\n to protect against it, check out our blog post\n https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]." }, "fullyImplemented": true, "id": 592, "linearizedBaseContracts": [ 592 ], "name": "ReentrancyGuard", "nameLocation": "1048:15:4", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 529, "mutability": "constant", "name": "NOT_ENTERED", "nameLocation": "1843:11:4", "nodeType": "VariableDeclaration", "scope": 592, "src": "1818:40:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 527, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1818:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "hexValue": "31", "id": 528, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1857:1:4", "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "visibility": "private" }, { "constant": true, "id": 532, "mutability": "constant", "name": "ENTERED", "nameLocation": "1889:7:4", "nodeType": "VariableDeclaration", "scope": 592, "src": "1864:36:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 530, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1864:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "hexValue": "32", "id": 531, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1899:1:4", "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "visibility": "private" }, { "constant": false, "id": 534, "mutability": "mutable", "name": "_status", "nameLocation": "1923:7:4", "nodeType": "VariableDeclaration", "scope": 592, "src": "1907:23:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 533, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1907:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "private" }, { "documentation": { "id": 535, "nodeType": "StructuredDocumentation", "src": "1937:52:4", "text": " @dev Unauthorized reentrant call." }, "errorSelector": "3ee5aeb5", "id": 537, "name": "ReentrancyGuardReentrantCall", "nameLocation": "2000:28:4", "nodeType": "ErrorDefinition", "parameters": { "id": 536, "nodeType": "ParameterList", "parameters": [], "src": "2028:2:4" }, "src": "1994:37:4" }, { "body": { "id": 544, "nodeType": "Block", "src": "2051:38:4", "statements": [ { "expression": { "id": 542, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 540, "name": "_status", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 534, "src": "2061:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "id": 541, "name": "NOT_ENTERED", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 529, "src": "2071:11:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2061:21:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 543, "nodeType": "ExpressionStatement", "src": "2061:21:4" } ] }, "id": 545, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { "id": 538, "nodeType": "ParameterList", "parameters": [], "src": "2048:2:4" }, "returnParameters": { "id": 539, "nodeType": "ParameterList", "parameters": [], "src": "2051:0:4" }, "scope": 592, "src": "2037:52:4", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 555, "nodeType": "Block", "src": "2490:79:4", "statements": [ { "expression": { "arguments": [], "expression": { "argumentTypes": [], "id": 548, "name": "_nonReentrantBefore", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 572, "src": "2500:19:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 549, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "2500:21:4", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 550, "nodeType": "ExpressionStatement", "src": "2500:21:4" }, { "id": 551, "nodeType": "PlaceholderStatement", "src": "2531:1:4" }, { "expression": { "arguments": [], "expression": { "argumentTypes": [], "id": 552, "name": "_nonReentrantAfter", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 580, "src": "2542:18:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 553, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "2542:20:4", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 554, "nodeType": "ExpressionStatement", "src": "2542:20:4" } ] }, "documentation": { "id": 546, "nodeType": "StructuredDocumentation", "src": "2095:366:4", "text": " @dev Prevents a contract from calling itself, directly or indirectly.\n Calling a `nonReentrant` function from another `nonReentrant`\n function is not supported. It is possible to prevent this from happening\n by making the `nonReentrant` function external, and making it call a\n `private` function that does the actual work." }, "id": 556, "name": "nonReentrant", "nameLocation": "2475:12:4", "nodeType": "ModifierDefinition", "parameters": { "id": 547, "nodeType": "ParameterList", "parameters": [], "src": "2487:2:4" }, "src": "2466:103:4", "virtual": false, "visibility": "internal" }, { "body": { "id": 571, "nodeType": "Block", "src": "2614:268:4", "statements": [ { "condition": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 561, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 559, "name": "_status", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 534, "src": "2702:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "id": 560, "name": "ENTERED", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 532, "src": "2713:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2702:18:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 566, "nodeType": "IfStatement", "src": "2698:86:4", "trueBody": { "id": 565, "nodeType": "Block", "src": "2722:62:4", "statements": [ { "errorCall": { "arguments": [], "expression": { "argumentTypes": [], "id": 562, "name": "ReentrancyGuardReentrantCall", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 537, "src": "2743:28:4", "typeDescriptions": { "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", "typeString": "function () pure returns (error)" } }, "id": 563, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "2743:30:4", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_error", "typeString": "error" } }, "id": 564, "nodeType": "RevertStatement", "src": "2736:37:4" } ] } }, { "expression": { "id": 569, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 567, "name": "_status", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 534, "src": "2858:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "id": 568, "name": "ENTERED", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 532, "src": "2868:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2858:17:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 570, "nodeType": "ExpressionStatement", "src": "2858:17:4" } ] }, "id": 572, "implemented": true, "kind": "function", "modifiers": [], "name": "_nonReentrantBefore", "nameLocation": "2584:19:4", "nodeType": "FunctionDefinition", "parameters": { "id": 557, "nodeType": "ParameterList", "parameters": [], "src": "2603:2:4" }, "returnParameters": { "id": 558, "nodeType": "ParameterList", "parameters": [], "src": "2614:0:4" }, "scope": 592, "src": "2575:307:4", "stateMutability": "nonpayable", "virtual": false, "visibility": "private" }, { "body": { "id": 579, "nodeType": "Block", "src": "2926:170:4", "statements": [ { "expression": { "id": 577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 575, "name": "_status", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 534, "src": "3068:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "id": 576, "name": "NOT_ENTERED", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 529, "src": "3078:11:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "3068:21:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 578, "nodeType": "ExpressionStatement", "src": "3068:21:4" } ] }, "id": 580, "implemented": true, "kind": "function", "modifiers": [], "name": "_nonReentrantAfter", "nameLocation": "2897:18:4", "nodeType": "FunctionDefinition", "parameters": { "id": 573, "nodeType": "ParameterList", "parameters": [], "src": "2915:2:4" }, "returnParameters": { "id": 574, "nodeType": "ParameterList", "parameters": [], "src": "2926:0:4" }, "scope": 592, "src": "2888:208:4", "stateMutability": "nonpayable", "virtual": false, "visibility": "private" }, { "body": { "id": 590, "nodeType": "Block", "src": "3339:42:4", "statements": [ { "expression": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 588, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 586, "name": "_status", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 534, "src": "3356:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "id": 587, "name": "ENTERED", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 532, "src": "3367:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "3356:18:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 585, "id": 589, "nodeType": "Return", "src": "3349:25:4" } ] }, "documentation": { "id": 581, "nodeType": "StructuredDocumentation", "src": "3102:168:4", "text": " @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n `nonReentrant` function in the call stack." }, "id": 591, "implemented": true, "kind": "function", "modifiers": [], "name": "_reentrancyGuardEntered", "nameLocation": "3284:23:4", "nodeType": "FunctionDefinition", "parameters": { "id": 582, "nodeType": "ParameterList", "parameters": [], "src": "3307:2:4" }, "returnParameters": { "id": 585, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 584, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 591, "src": "3333:4:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 583, "name": "bool", "nodeType": "ElementaryTypeName", "src": "3333:4:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "3332:6:4" }, "scope": 592, "src": "3275:106:4", "stateMutability": "view", "virtual": false, "visibility": "internal" } ], "scope": 593, "src": "1030:2353:4", "usedErrors": [ 537 ], "usedEvents": [] } ], "src": "109:3275:4" }, "compiler": { "name": "solc", "version": "0.8.30+commit.73712a01.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.4.16", "updatedAt": "2025-10-15T14:34:45.317Z", "devdoc": { "details": "Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, consider using {ReentrancyGuardTransient} instead. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].", "errors": { "ReentrancyGuardReentrantCall()": [ { "details": "Unauthorized reentrant call." } ] }, "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }