UNPKG

@netvote/elections-solidity

Version:
329 lines 12.9 kB
{ "contractName": "ReentrancyGuard", "abi": [], "bytecode": "0x60606040526000805460ff191690553415601857600080fd5b60358060256000396000f3006060604052600080fd00a165627a7a723058204781af3b63d9a3586b6d484149f5b943ba0cb7bc125ec3b6ccb02a7d450339fd0029", "deployedBytecode": "0x6060604052600080fd00a165627a7a723058204781af3b63d9a3586b6d484149f5b943ba0cb7bc125ec3b6ccb02a7d450339fd0029", "sourceMap": "222:643:19:-;;;349:5;319:35;;-1:-1:-1;;319:35:19;;;222:643;;;;;;;;;;;;;;", "deployedSourceMap": "222:643:19:-;;;;;", "source": "pragma solidity ^0.4.11;\n\n/**\n * @title Helps contracts guard agains rentrancy attacks.\n * @author Remco Bloemen <remco@2π.com>\n * @notice If you mark a function `nonReentrant`, you should also\n * mark it `external`.\n */\ncontract ReentrancyGuard {\n\n /**\n * @dev We use a single lock for the whole contract.\n */\n bool private rentrancy_lock = false;\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * @notice If you mark a function `nonReentrant`, you should also\n * mark it `external`. Calling one nonReentrant function from\n * another is not supported. Instead, you can implement a\n * `private` function doing the actual work, and a `external`\n * wrapper marked as `nonReentrant`.\n */\n modifier nonReentrant() {\n require(!rentrancy_lock);\n rentrancy_lock = true;\n _;\n rentrancy_lock = false;\n }\n\n}\n", "sourcePath": "zeppelin-solidity/contracts/ReentrancyGuard.sol", "ast": { "attributes": { "absolutePath": "zeppelin-solidity/contracts/ReentrancyGuard.sol", "exportedSymbols": { "ReentrancyGuard": [ 2552 ] } }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.4", ".11" ] }, "id": 2531, "name": "PragmaDirective", "src": "0:24:19" }, { "attributes": { "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "contract", "documentation": "@title Helps contracts guard agains rentrancy attacks.\n@author Remco Bloemen <remco@2π.com>\n@notice If you mark a function `nonReentrant`, you should also\nmark it `external`.", "fullyImplemented": true, "linearizedBaseContracts": [ 2552 ], "name": "ReentrancyGuard", "scope": 2553 }, "children": [ { "attributes": { "constant": false, "name": "rentrancy_lock", "scope": 2552, "stateVariable": true, "storageLocation": "default", "type": "bool", "visibility": "private" }, "children": [ { "attributes": { "name": "bool", "type": "bool" }, "id": 2532, "name": "ElementaryTypeName", "src": "319:4:19" }, { "attributes": { "argumentTypes": null, "hexvalue": "66616c7365", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "bool", "type": "bool", "value": "false" }, "id": 2533, "name": "Literal", "src": "349:5:19" } ], "id": 2534, "name": "VariableDeclaration", "src": "319:35:19" }, { "attributes": { "name": "nonReentrant", "visibility": "internal" }, "children": [ { "attributes": { "parameters": [ null ] }, "children": [], "id": 2535, "name": "ParameterList", "src": "762:2:19" }, { "children": [ { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "tuple()", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "overloadedDeclarations": [ null ], "referencedDeclaration": 3241, "type": "function (bool) pure", "value": "require" }, "id": 2536, "name": "Identifier", "src": "771:7:19" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "!", "prefix": true, "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2534, "type": "bool", "value": "rentrancy_lock" }, "id": 2537, "name": "Identifier", "src": "780:14:19" } ], "id": 2538, "name": "UnaryOperation", "src": "779:15:19" } ], "id": 2539, "name": "FunctionCall", "src": "771:24:19" } ], "id": 2540, "name": "ExpressionStatement", "src": "771:24:19" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2534, "type": "bool", "value": "rentrancy_lock" }, "id": 2541, "name": "Identifier", "src": "801:14:19" }, { "attributes": { "argumentTypes": null, "hexvalue": "74727565", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "bool", "type": "bool", "value": "true" }, "id": 2542, "name": "Literal", "src": "818:4:19" } ], "id": 2543, "name": "Assignment", "src": "801:21:19" } ], "id": 2544, "name": "ExpressionStatement", "src": "801:21:19" }, { "id": 2545, "name": "PlaceholderStatement", "src": "828:1:19" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2534, "type": "bool", "value": "rentrancy_lock" }, "id": 2546, "name": "Identifier", "src": "835:14:19" }, { "attributes": { "argumentTypes": null, "hexvalue": "66616c7365", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "bool", "type": "bool", "value": "false" }, "id": 2547, "name": "Literal", "src": "852:5:19" } ], "id": 2548, "name": "Assignment", "src": "835:22:19" } ], "id": 2549, "name": "ExpressionStatement", "src": "835:22:19" } ], "id": 2550, "name": "Block", "src": "765:97:19" } ], "id": 2551, "name": "ModifierDefinition", "src": "741:121:19" } ], "id": 2552, "name": "ContractDefinition", "src": "222:643:19" } ], "id": 2553, "name": "SourceUnit", "src": "0:866:19" }, "compiler": { "name": "solc", "version": "0.4.18+commit.9cf6e910.Emscripten.clang" }, "networks": {}, "schemaVersion": "1.0.1", "updatedAt": "2018-03-26T15:46:12.490Z" }