@kollateral/kollateral-contracts
Version:
808 lines • 34.3 kB
JSON
{
"contractName": "ReentrancyGuard",
"abi": [
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"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.\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xe86fdc15fbc379ecf14d6aa4f51b87c0be8476e114e23c171b790a6717230655\",\"urls\":[\"bzz-raw://81905037f66d37ed211a4e3430af74f36e18b3a5d5b688e6d7d5ee199824a41a\",\"dweb:/ipfs/QmTcpgNKqLVRbcgNSUHazAbVf2bz5uh5mPkAijGeYW7Sqb\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "pragma solidity ^0.5.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 */\ncontract ReentrancyGuard {\n // counter to allow mutex lock with only one SSTORE operation\n uint256 private _guardCounter;\n\n constructor () internal {\n // The counter starts at one to prevent changing it from zero to a non-zero\n // value, which is a more expensive operation.\n _guardCounter = 1;\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 make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _guardCounter += 1;\n uint256 localCounter = _guardCounter;\n _;\n require(localCounter == _guardCounter, \"ReentrancyGuard: reentrant call\");\n }\n}\n",
"sourcePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
3581
]
},
"id": 3582,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3551,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:22"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@dev Contract module that helps prevent reentrant calls to a function.\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\navailable, 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\nthose functions `private`, and then adding `external` `nonReentrant` entry\npoints to them.",
"fullyImplemented": true,
"id": 3581,
"linearizedBaseContracts": [
3581
],
"name": "ReentrancyGuard",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3553,
"name": "_guardCounter",
"nodeType": "VariableDeclaration",
"scope": 3581,
"src": "654:29:22",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3552,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "654:7:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 3560,
"nodeType": "Block",
"src": "714:173:22",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3556,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "863:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "31",
"id": 3557,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "879:1:22",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "863:17:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3559,
"nodeType": "ExpressionStatement",
"src": "863:17:22"
}
]
},
"documentation": null,
"id": 3561,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3554,
"nodeType": "ParameterList",
"parameters": [],
"src": "702:2:22"
},
"returnParameters": {
"id": 3555,
"nodeType": "ParameterList",
"parameters": [],
"src": "714:0:22"
},
"scope": 3581,
"src": "690:197:22",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 3579,
"nodeType": "Block",
"src": "1286:175:22",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3565,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3563,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1296:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "31",
"id": 3564,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1313:1:22",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "1296:18:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3566,
"nodeType": "ExpressionStatement",
"src": "1296:18:22"
},
{
"assignments": [
3568
],
"declarations": [
{
"constant": false,
"id": 3568,
"name": "localCounter",
"nodeType": "VariableDeclaration",
"scope": 3579,
"src": "1324:20:22",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3567,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1324:7:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 3570,
"initialValue": {
"argumentTypes": null,
"id": 3569,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1347:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1324:36:22"
},
{
"id": 3571,
"nodeType": "PlaceholderStatement",
"src": "1370:1:22"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3575,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3573,
"name": "localCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3568,
"src": "1389:12:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 3574,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1405:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1389:29:22",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5265656e7472616e637947756172643a207265656e7472616e742063616c6c",
"id": 3576,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1420:33:22",
"subdenomination": null,
"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": 3572,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
3599,
3600
],
"referencedDeclaration": 3600,
"src": "1381:7:22",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 3577,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1381:73:22",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3578,
"nodeType": "ExpressionStatement",
"src": "1381:73:22"
}
]
},
"documentation": "@dev Prevents a contract from calling itself, directly or indirectly.\nCalling a `nonReentrant` function from another `nonReentrant`\nfunction is not supported. It is possible to prevent this from happening\nby making the `nonReentrant` function external, and make it call a\n`private` function that does the actual work.",
"id": 3580,
"name": "nonReentrant",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 3562,
"nodeType": "ParameterList",
"parameters": [],
"src": "1283:2:22"
},
"src": "1262:199:22",
"visibility": "internal"
}
],
"scope": 3582,
"src": "557:906:22"
}
],
"src": "0:1464:22"
},
"legacyAST": {
"absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
3581
]
},
"id": 3582,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3551,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:22"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@dev Contract module that helps prevent reentrant calls to a function.\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\navailable, 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\nthose functions `private`, and then adding `external` `nonReentrant` entry\npoints to them.",
"fullyImplemented": true,
"id": 3581,
"linearizedBaseContracts": [
3581
],
"name": "ReentrancyGuard",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3553,
"name": "_guardCounter",
"nodeType": "VariableDeclaration",
"scope": 3581,
"src": "654:29:22",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3552,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "654:7:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 3560,
"nodeType": "Block",
"src": "714:173:22",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3556,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "863:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "31",
"id": 3557,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "879:1:22",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "863:17:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3559,
"nodeType": "ExpressionStatement",
"src": "863:17:22"
}
]
},
"documentation": null,
"id": 3561,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3554,
"nodeType": "ParameterList",
"parameters": [],
"src": "702:2:22"
},
"returnParameters": {
"id": 3555,
"nodeType": "ParameterList",
"parameters": [],
"src": "714:0:22"
},
"scope": 3581,
"src": "690:197:22",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 3579,
"nodeType": "Block",
"src": "1286:175:22",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3565,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3563,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1296:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "31",
"id": 3564,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1313:1:22",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "1296:18:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3566,
"nodeType": "ExpressionStatement",
"src": "1296:18:22"
},
{
"assignments": [
3568
],
"declarations": [
{
"constant": false,
"id": 3568,
"name": "localCounter",
"nodeType": "VariableDeclaration",
"scope": 3579,
"src": "1324:20:22",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3567,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1324:7:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 3570,
"initialValue": {
"argumentTypes": null,
"id": 3569,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1347:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1324:36:22"
},
{
"id": 3571,
"nodeType": "PlaceholderStatement",
"src": "1370:1:22"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3575,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3573,
"name": "localCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3568,
"src": "1389:12:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 3574,
"name": "_guardCounter",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3553,
"src": "1405:13:22",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1389:29:22",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5265656e7472616e637947756172643a207265656e7472616e742063616c6c",
"id": 3576,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1420:33:22",
"subdenomination": null,
"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": 3572,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
3599,
3600
],
"referencedDeclaration": 3600,
"src": "1381:7:22",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 3577,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1381:73:22",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3578,
"nodeType": "ExpressionStatement",
"src": "1381:73:22"
}
]
},
"documentation": "@dev Prevents a contract from calling itself, directly or indirectly.\nCalling a `nonReentrant` function from another `nonReentrant`\nfunction is not supported. It is possible to prevent this from happening\nby making the `nonReentrant` function external, and make it call a\n`private` function that does the actual work.",
"id": 3580,
"name": "nonReentrant",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 3562,
"nodeType": "ParameterList",
"parameters": [],
"src": "1283:2:22"
},
"src": "1262:199:22",
"visibility": "internal"
}
],
"scope": 3582,
"src": "557:906:22"
}
],
"src": "0:1464:22"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.20",
"updatedAt": "2020-02-01T23:51:00.359Z",
"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.",
"methods": {}
},
"userdoc": {
"methods": {}
}
}