becrypto/build/contracts/ReentrancyGuard.json

748 lines
32 KiB
JSON

{
"contractName": "ReentrancyGuard",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"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 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].\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://41319e7f621f2dc3733511332c4fd032f8e32ad2aa7fd6f665c19741d9941a34\",\"dweb:/ipfs/QmcYR3bd862GD1Bc7jwrU9bGxrhUu5na1oP964bDCu2id1\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\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 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 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 require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\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\\security\\ReentrancyGuard.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/security/ReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
1939
]
},
"id": 1940,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1876,
"literals": [
"solidity",
"^",
"0.8",
".0"
],
"nodeType": "PragmaDirective",
"src": "112:23:8"
},
{
"abstract": true,
"baseContracts": [],
"canonicalName": "ReentrancyGuard",
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 1877,
"nodeType": "StructuredDocumentation",
"src": "137:750:8",
"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 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": 1939,
"linearizedBaseContracts": [
1939
],
"name": "ReentrancyGuard",
"nameLocation": "906:15:8",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1880,
"mutability": "constant",
"name": "_NOT_ENTERED",
"nameLocation": "1701:12:8",
"nodeType": "VariableDeclaration",
"scope": 1939,
"src": "1676:41:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1878,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1676:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"hexValue": "31",
"id": 1879,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1716:1:8",
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "private"
},
{
"constant": true,
"id": 1883,
"mutability": "constant",
"name": "_ENTERED",
"nameLocation": "1748:8:8",
"nodeType": "VariableDeclaration",
"scope": 1939,
"src": "1723:37:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1881,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1723:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"hexValue": "32",
"id": 1882,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1759:1:8",
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"visibility": "private"
},
{
"constant": false,
"id": 1885,
"mutability": "mutable",
"name": "_status",
"nameLocation": "1783:7:8",
"nodeType": "VariableDeclaration",
"scope": 1939,
"src": "1767:23:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1884,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1767:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "private"
},
{
"body": {
"id": 1892,
"nodeType": "Block",
"src": "1811:39:8",
"statements": [
{
"expression": {
"id": 1890,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1888,
"name": "_status",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1885,
"src": "1821:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1889,
"name": "_NOT_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1880,
"src": "1831:12:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1821:22:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1891,
"nodeType": "ExpressionStatement",
"src": "1821:22:8"
}
]
},
"id": 1893,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1886,
"nodeType": "ParameterList",
"parameters": [],
"src": "1808:2:8"
},
"returnParameters": {
"id": 1887,
"nodeType": "ParameterList",
"parameters": [],
"src": "1811:0:8"
},
"scope": 1939,
"src": "1797:53:8",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1903,
"nodeType": "Block",
"src": "2251:79:8",
"statements": [
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1896,
"name": "_nonReentrantBefore",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1919,
"src": "2261:19:8",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 1897,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2261:21:8",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1898,
"nodeType": "ExpressionStatement",
"src": "2261:21:8"
},
{
"id": 1899,
"nodeType": "PlaceholderStatement",
"src": "2292:1:8"
},
{
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1900,
"name": "_nonReentrantAfter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1927,
"src": "2303:18:8",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
"typeString": "function ()"
}
},
"id": 1901,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2303:20:8",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1902,
"nodeType": "ExpressionStatement",
"src": "2303:20:8"
}
]
},
"documentation": {
"id": 1894,
"nodeType": "StructuredDocumentation",
"src": "1856:366:8",
"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": 1904,
"name": "nonReentrant",
"nameLocation": "2236:12:8",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 1895,
"nodeType": "ParameterList",
"parameters": [],
"src": "2248:2:8"
},
"src": "2227:103:8",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1918,
"nodeType": "Block",
"src": "2375:248:8",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1910,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 1908,
"name": "_status",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1885,
"src": "2468:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"id": 1909,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1883,
"src": "2479:8:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "2468:19:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "5265656e7472616e637947756172643a207265656e7472616e742063616c6c",
"id": 1911,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2489:33:8",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
},
"value": "ReentrancyGuard: reentrant call"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
}
],
"id": 1907,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "2460:7:8",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1912,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2460:63:8",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1913,
"nodeType": "ExpressionStatement",
"src": "2460:63:8"
},
{
"expression": {
"id": 1916,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1914,
"name": "_status",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1885,
"src": "2598:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1915,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1883,
"src": "2608:8:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "2598:18:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1917,
"nodeType": "ExpressionStatement",
"src": "2598:18:8"
}
]
},
"id": 1919,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_nonReentrantBefore",
"nameLocation": "2345:19:8",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1905,
"nodeType": "ParameterList",
"parameters": [],
"src": "2364:2:8"
},
"returnParameters": {
"id": 1906,
"nodeType": "ParameterList",
"parameters": [],
"src": "2375:0:8"
},
"scope": 1939,
"src": "2336:287:8",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "private"
},
{
"body": {
"id": 1926,
"nodeType": "Block",
"src": "2667:171:8",
"statements": [
{
"expression": {
"id": 1924,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1922,
"name": "_status",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1885,
"src": "2809:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1923,
"name": "_NOT_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1880,
"src": "2819:12:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "2809:22:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1925,
"nodeType": "ExpressionStatement",
"src": "2809:22:8"
}
]
},
"id": 1927,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_nonReentrantAfter",
"nameLocation": "2638:18:8",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1920,
"nodeType": "ParameterList",
"parameters": [],
"src": "2656:2:8"
},
"returnParameters": {
"id": 1921,
"nodeType": "ParameterList",
"parameters": [],
"src": "2667:0:8"
},
"scope": 1939,
"src": "2629:209:8",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "private"
},
{
"body": {
"id": 1937,
"nodeType": "Block",
"src": "3081:43:8",
"statements": [
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1935,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 1933,
"name": "_status",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1885,
"src": "3098:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 1934,
"name": "_ENTERED",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1883,
"src": "3109:8:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "3098:19:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 1932,
"id": 1936,
"nodeType": "Return",
"src": "3091:26:8"
}
]
},
"documentation": {
"id": 1928,
"nodeType": "StructuredDocumentation",
"src": "2844:168:8",
"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": 1938,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_reentrancyGuardEntered",
"nameLocation": "3026:23:8",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1929,
"nodeType": "ParameterList",
"parameters": [],
"src": "3049:2:8"
},
"returnParameters": {
"id": 1932,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1931,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 1938,
"src": "3075:4:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1930,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "3075:4:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "3074:6:8"
},
"scope": 1939,
"src": "3017:107:8",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
}
],
"scope": 1940,
"src": "888:2238:8",
"usedErrors": []
}
],
"src": "112:3015:8"
},
"compiler": {
"name": "solc",
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.4.14",
"updatedAt": "2023-07-12T06:52:15.222Z",
"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 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].",
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}