{ "contractName": "TestReentrancyGuardAttacker", "abi": [ { "inputs": [ { "internalType": "contract TestReentrancyGuard", "name": "_target", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "attacking", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "callProtectedMethod", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "reentrancy", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "target", "outputs": [ { "internalType": "contract TestReentrancyGuard", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bool", "name": "_reentrancy", "type": "bool" } ], "name": "setReentrancy", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bool", "name": "_callProtectedMethod", "type": "bool" } ], "name": "setCallProtectedMethod", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "run", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "callback", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract TestReentrancyGuard\",\"name\":\"_target\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"attacking\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"callProtectedMethod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"callback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reentrancy\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"run\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_callProtectedMethod\",\"type\":\"bool\"}],\"name\":\"setCallProtectedMethod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_reentrancy\",\"type\":\"bool\"}],\"name\":\"setReentrancy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"target\",\"outputs\":[{\"internalType\":\"contract TestReentrancyGuard\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/helpers/TestReentrancyGuard.sol\":\"TestReentrancyGuardAttacker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/helpers/TestReentrancyGuard.sol\":{\"keccak256\":\"0x10cc32288bb587945509a8d78bf7d96b999df3bfd631162acf07b8db00404c3e\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://0eae14c3bc545882b4afdf7ef001c24b70781ed0216bdb559ec11218d4182e6c\",\"dweb:/ipfs/QmNpdpANj4EA2DgLHEmVH4FtKrQL91boCdEGSZ87coJLj4\"]},\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/ReentrancyGuard.sol\":{\"keccak256\":\"0x5ea87c10dd6e7e79212da712eb5f079c03361e6c96e299a4ffd9aaee8d6a3899\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://882aac64a791df35a942480e6ce611d1acb399af4ac0c4ef0288965c3785bf50\",\"dweb:/ipfs/QmeWeYYFh5HZAzJ1SzPHoTcPvZrE4NPUVfmjvH9Q3m36Gg\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5060405161035f38038061035f8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b03199092169190911790556102fa806100656000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806399563f101161005b57806399563f10146100da578063c0406226146100f9578063d4b8399214610101578063e11f493e1461012557610088565b8063083b27321461008d57806317846e3914610097578063322d5010146100b35780633c0bbcd9146100d2575b600080fd5b61009561012d565b005b61009f61017f565b604080519115158252519081900360200190f35b610095600480360360208110156100c957600080fd5b5035151561018f565b61009f6101ad565b610095600480360360208110156100f057600080fd5b503515156101bd565b6100956101db565b6101096102a5565b604080516001600160a01b039092168252519081900360200190f35b61009f6102b4565b600054600160a01b900460ff166101435761017d565b600054600160b01b900460ff1661016f576000805460ff60b01b1916600160b01b17905561016f6101db565b6000805460ff60b01b191690555b565b600054600160a81b900460ff1681565b60008054911515600160a01b0260ff60a01b19909216919091179055565b600054600160b01b900460ff1681565b60008054911515600160a81b0260ff60a81b19909216919091179055565b600054600160a81b900460ff1661024a57600080546040805163f86485d960e01b815290516001600160a01b039092169263f86485d99260048084019382900301818387803b15801561022d57600080fd5b505af1158015610241573d6000803e3d6000fd5b5050505061017d565b6000805460408051630b53600360e21b815290516001600160a01b0390921692632d4d800c9260048084019382900301818387803b15801561028b57600080fd5b505af115801561029f573d6000803e3d6000fd5b50505050565b6000546001600160a01b031681565b600054600160a01b900460ff168156fea26469706673582212208d7d98a2042522a18e2752b12a596016434ddc6a6041ef373551516b2e1dcc6464736f6c634300060c0033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100885760003560e01c806399563f101161005b57806399563f10146100da578063c0406226146100f9578063d4b8399214610101578063e11f493e1461012557610088565b8063083b27321461008d57806317846e3914610097578063322d5010146100b35780633c0bbcd9146100d2575b600080fd5b61009561012d565b005b61009f61017f565b604080519115158252519081900360200190f35b610095600480360360208110156100c957600080fd5b5035151561018f565b61009f6101ad565b610095600480360360208110156100f057600080fd5b503515156101bd565b6100956101db565b6101096102a5565b604080516001600160a01b039092168252519081900360200190f35b61009f6102b4565b600054600160a01b900460ff166101435761017d565b600054600160b01b900460ff1661016f576000805460ff60b01b1916600160b01b17905561016f6101db565b6000805460ff60b01b191690555b565b600054600160a81b900460ff1681565b60008054911515600160a01b0260ff60a01b19909216919091179055565b600054600160b01b900460ff1681565b60008054911515600160a81b0260ff60a81b19909216919091179055565b600054600160a81b900460ff1661024a57600080546040805163f86485d960e01b815290516001600160a01b039092169263f86485d99260048084019382900301818387803b15801561022d57600080fd5b505af1158015610241573d6000803e3d6000fd5b5050505061017d565b6000805460408051630b53600360e21b815290516001600160a01b0390921692632d4d800c9260048084019382900301818387803b15801561028b57600080fd5b505af115801561029f573d6000803e3d6000fd5b50505050565b6000546001600160a01b031681565b600054600160a01b900460ff168156fea26469706673582212208d7d98a2042522a18e2752b12a596016434ddc6a6041ef373551516b2e1dcc6464736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "118:822:43:-:0;;;293:81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;293:81:43;351:6;:16;;-1:-1:-1;;;;;351:16:43;;;-1:-1:-1;;;;;;351:16:43;;;;;;;;;118:822;;;;;;", "deployedSourceMap": "118:822:43:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;730:208;;;:::i;:::-;;228:31;;;:::i;:::-;;;;;;;;;;;;;;;;;;380:91;;;;;;;;;;;;;;;;-1:-1:-1;380:91:43;;;;:::i;265:21::-;;;:::i;477:127::-;;;;;;;;;;;;;;;;-1:-1:-1;477:127:43;;;;:::i;610:114::-;;;:::i;161:33::-;;;:::i;:::-;;;;-1:-1:-1;;;;;161:33:43;;;;;;;;;;;;;;200:22;;;:::i;730:208::-;774:10;;-1:-1:-1;;;774:10:43;;;;769:48;;800:7;;769:48;832:9;;-1:-1:-1;;;832:9:43;;;;827:77;;857:9;:16;;-1:-1:-1;;;;857:16:43;-1:-1:-1;;;857:16:43;;;888:5;:3;:5::i;:::-;926;914:17;;-1:-1:-1;;;;914:17:43;;;730:208;:::o;228:31::-;;;-1:-1:-1;;;228:31:43;;;;;:::o;380:91::-;440:10;:24;;;;;-1:-1:-1;;;440:24:43;-1:-1:-1;;;;440:24:43;;;;;;;;;380:91::o;265:21::-;;;-1:-1:-1;;;265:21:43;;;;;:::o;477:127::-;555:19;:42;;;;;-1:-1:-1;;;555:42:43;-1:-1:-1;;;;555:42:43;;;;;;;;;477:127::o;610:114::-;642:19;;-1:-1:-1;;;642:19:43;;;;:75;;691:6;;;:26;;;-1:-1:-1;;;691:26:43;;;;-1:-1:-1;;;;;691:6:43;;;;:24;;:26;;;;;;;;;;:6;;:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;642:75;;;664:6;;;:24;;;-1:-1:-1;;;664:24:43;;;;-1:-1:-1;;;;;664:6:43;;;;:22;;:24;;;;;;;;;;:6;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;610:114::o;161:33::-;;;-1:-1:-1;;;;;161:33:43;;:::o;200:22::-;;;-1:-1:-1;;;200:22:43;;;;;:::o", "source": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\npragma solidity 0.6.12;\nimport \"../utility/ReentrancyGuard.sol\";\n\n\ncontract TestReentrancyGuardAttacker {\n TestReentrancyGuard public target;\n bool public reentrancy;\n bool public callProtectedMethod;\n bool public attacking;\n\n constructor(TestReentrancyGuard _target) public {\n target = _target;\n }\n\n function setReentrancy(bool _reentrancy) external {\n reentrancy = _reentrancy;\n }\n\n function setCallProtectedMethod(bool _callProtectedMethod) external {\n callProtectedMethod = _callProtectedMethod;\n }\n\n function run() public {\n callProtectedMethod ? target.protectedMethod() : target.unprotectedMethod();\n }\n\n function callback() external {\n if (!reentrancy) {\n return;\n }\n\n if (!attacking) {\n attacking = true;\n\n run();\n }\n\n attacking = false;\n }\n}\n\ncontract TestReentrancyGuard is ReentrancyGuard {\n uint256 public calls;\n\n function protectedMethod() external protected {\n run();\n }\n\n function unprotectedMethod() external {\n run();\n }\n\n function run() private {\n calls++;\n\n TestReentrancyGuardAttacker(msg.sender).callback();\n }\n}\n", "sourcePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/helpers/TestReentrancyGuard.sol", "ast": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/helpers/TestReentrancyGuard.sol", "exportedSymbols": { "TestReentrancyGuard": [ 19640 ], "TestReentrancyGuardAttacker": [ 19605 ] }, "id": 19641, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 19528, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "51:23:43" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/ReentrancyGuard.sol", "file": "../utility/ReentrancyGuard.sol", "id": 19529, "nodeType": "ImportDirective", "scope": 19641, "sourceUnit": 22243, "src": "75:40:43", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 19605, "linearizedBaseContracts": [ 19605 ], "name": "TestReentrancyGuardAttacker", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "d4b83992", "id": 19531, "mutability": "mutable", "name": "target", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "161:33:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" }, "typeName": { "contractScope": null, "id": 19530, "name": "TestReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 19640, "src": "161:19:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "e11f493e", "id": 19533, "mutability": "mutable", "name": "reentrancy", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "200:22:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19532, "name": "bool", "nodeType": "ElementaryTypeName", "src": "200:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "17846e39", "id": 19535, "mutability": "mutable", "name": "callProtectedMethod", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "228:31:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19534, "name": "bool", "nodeType": "ElementaryTypeName", "src": "228:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "3c0bbcd9", "id": 19537, "mutability": "mutable", "name": "attacking", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "265:21:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19536, "name": "bool", "nodeType": "ElementaryTypeName", "src": "265:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "body": { "id": 19546, "nodeType": "Block", "src": "341:33:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19544, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19542, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "351:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19543, "name": "_target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19539, "src": "360:7:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "src": "351:16:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19545, "nodeType": "ExpressionStatement", "src": "351:16:43" } ] }, "documentation": null, "id": 19547, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19540, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19539, "mutability": "mutable", "name": "_target", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19547, "src": "305:27:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" }, "typeName": { "contractScope": null, "id": 19538, "name": "TestReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 19640, "src": "305:19:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "value": null, "visibility": "internal" } ], "src": "304:29:43" }, "returnParameters": { "id": 19541, "nodeType": "ParameterList", "parameters": [], "src": "341:0:43" }, "scope": 19605, "src": "293:81:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 19556, "nodeType": "Block", "src": "430:41:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19554, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19552, "name": "reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19533, "src": "440:10:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19553, "name": "_reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19549, "src": "453:11:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "440:24:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19555, "nodeType": "ExpressionStatement", "src": "440:24:43" } ] }, "documentation": null, "functionSelector": "322d5010", "id": 19557, "implemented": true, "kind": "function", "modifiers": [], "name": "setReentrancy", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19550, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19549, "mutability": "mutable", "name": "_reentrancy", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19557, "src": "403:16:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19548, "name": "bool", "nodeType": "ElementaryTypeName", "src": "403:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "402:18:43" }, "returnParameters": { "id": 19551, "nodeType": "ParameterList", "parameters": [], "src": "430:0:43" }, "scope": 19605, "src": "380:91:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19566, "nodeType": "Block", "src": "545:59:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19564, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19562, "name": "callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19535, "src": "555:19:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19563, "name": "_callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19559, "src": "577:20:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "555:42:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19565, "nodeType": "ExpressionStatement", "src": "555:42:43" } ] }, "documentation": null, "functionSelector": "99563f10", "id": 19567, "implemented": true, "kind": "function", "modifiers": [], "name": "setCallProtectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19560, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19559, "mutability": "mutable", "name": "_callProtectedMethod", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19567, "src": "509:25:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19558, "name": "bool", "nodeType": "ElementaryTypeName", "src": "509:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "508:27:43" }, "returnParameters": { "id": 19561, "nodeType": "ParameterList", "parameters": [], "src": "545:0:43" }, "scope": 19605, "src": "477:127:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19579, "nodeType": "Block", "src": "632:92:43", "statements": [ { "expression": { "argumentTypes": null, "condition": { "argumentTypes": null, "id": 19570, "name": "callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19535, "src": "642:19:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 19574, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "691:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19575, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "unprotectedMethod", "nodeType": "MemberAccess", "referencedDeclaration": 19625, "src": "691:24:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19576, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:26:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "642:75:43", "trueExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 19571, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "664:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19572, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "protectedMethod", "nodeType": "MemberAccess", "referencedDeclaration": 19618, "src": "664:22:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "664:24:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19578, "nodeType": "ExpressionStatement", "src": "642:75:43" } ] }, "documentation": null, "functionSelector": "c0406226", "id": 19580, "implemented": true, "kind": "function", "modifiers": [], "name": "run", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19568, "nodeType": "ParameterList", "parameters": [], "src": "622:2:43" }, "returnParameters": { "id": 19569, "nodeType": "ParameterList", "parameters": [], "src": "632:0:43" }, "scope": 19605, "src": "610:114:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 19603, "nodeType": "Block", "src": "759:179:43", "statements": [ { "condition": { "argumentTypes": null, "id": 19584, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "!", "prefix": true, "src": "773:11:43", "subExpression": { "argumentTypes": null, "id": 19583, "name": "reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19533, "src": "774:10:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 19587, "nodeType": "IfStatement", "src": "769:48:43", "trueBody": { "id": 19586, "nodeType": "Block", "src": "786:31:43", "statements": [ { "expression": null, "functionReturnParameters": 19582, "id": 19585, "nodeType": "Return", "src": "800:7:43" } ] } }, { "condition": { "argumentTypes": null, "id": 19589, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "!", "prefix": true, "src": "831:10:43", "subExpression": { "argumentTypes": null, "id": 19588, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "832:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 19598, "nodeType": "IfStatement", "src": "827:77:43", "trueBody": { "id": 19597, "nodeType": "Block", "src": "843:61:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19592, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19590, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "857:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "74727565", "id": 19591, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "869:4:43", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "src": "857:16:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19593, "nodeType": "ExpressionStatement", "src": "857:16:43" }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19594, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19580, "src": "888:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19595, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "888:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19596, "nodeType": "ExpressionStatement", "src": "888:5:43" } ] } }, { "expression": { "argumentTypes": null, "id": 19601, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19599, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "914:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "66616c7365", "id": 19600, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "926:5:43", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "src": "914:17:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19602, "nodeType": "ExpressionStatement", "src": "914:17:43" } ] }, "documentation": null, "functionSelector": "083b2732", "id": 19604, "implemented": true, "kind": "function", "modifiers": [], "name": "callback", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19581, "nodeType": "ParameterList", "parameters": [], "src": "747:2:43" }, "returnParameters": { "id": 19582, "nodeType": "ParameterList", "parameters": [], "src": "759:0:43" }, "scope": 19605, "src": "730:208:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" } ], "scope": 19641, "src": "118:822:43" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 19606, "name": "ReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22242, "src": "974:15:43", "typeDescriptions": { "typeIdentifier": "t_contract$_ReentrancyGuard_$22242", "typeString": "contract ReentrancyGuard" } }, "id": 19607, "nodeType": "InheritanceSpecifier", "src": "974:15:43" } ], "contractDependencies": [ 22242 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 19640, "linearizedBaseContracts": [ 19640, 22242 ], "name": "TestReentrancyGuard", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "305f72b7", "id": 19609, "mutability": "mutable", "name": "calls", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19640, "src": "996:20:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 19608, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "996:7:43", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 19617, "nodeType": "Block", "src": "1069:22:43", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19614, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19639, "src": "1079:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19615, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1079:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19616, "nodeType": "ExpressionStatement", "src": "1079:5:43" } ] }, "documentation": null, "functionSelector": "2d4d800c", "id": 19618, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 19612, "modifierName": { "argumentTypes": null, "id": 19611, "name": "protected", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22231, "src": "1059:9:43", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1059:9:43" } ], "name": "protectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19610, "nodeType": "ParameterList", "parameters": [], "src": "1047:2:43" }, "returnParameters": { "id": 19613, "nodeType": "ParameterList", "parameters": [], "src": "1069:0:43" }, "scope": 19640, "src": "1023:68:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19624, "nodeType": "Block", "src": "1135:22:43", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19621, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19639, "src": "1145:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19622, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1145:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19623, "nodeType": "ExpressionStatement", "src": "1145:5:43" } ] }, "documentation": null, "functionSelector": "f86485d9", "id": 19625, "implemented": true, "kind": "function", "modifiers": [], "name": "unprotectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19619, "nodeType": "ParameterList", "parameters": [], "src": "1123:2:43" }, "returnParameters": { "id": 19620, "nodeType": "ParameterList", "parameters": [], "src": "1135:0:43" }, "scope": 19640, "src": "1097:60:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19638, "nodeType": "Block", "src": "1186:85:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19629, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1196:7:43", "subExpression": { "argumentTypes": null, "id": 19628, "name": "calls", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19609, "src": "1196:5:43", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 19630, "nodeType": "ExpressionStatement", "src": "1196:7:43" }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 19632, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "1242:3:43", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 19633, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1242:10:43", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 19631, "name": "TestReentrancyGuardAttacker", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19605, "src": "1214:27:43", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_TestReentrancyGuardAttacker_$19605_$", "typeString": "type(contract TestReentrancyGuardAttacker)" } }, "id": 19634, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1214:39:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuardAttacker_$19605", "typeString": "contract TestReentrancyGuardAttacker" } }, "id": 19635, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "callback", "nodeType": "MemberAccess", "referencedDeclaration": 19604, "src": "1214:48:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19636, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1214:50:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19637, "nodeType": "ExpressionStatement", "src": "1214:50:43" } ] }, "documentation": null, "id": 19639, "implemented": true, "kind": "function", "modifiers": [], "name": "run", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19626, "nodeType": "ParameterList", "parameters": [], "src": "1175:2:43" }, "returnParameters": { "id": 19627, "nodeType": "ParameterList", "parameters": [], "src": "1186:0:43" }, "scope": 19640, "src": "1163:108:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "private" } ], "scope": 19641, "src": "942:331:43" } ], "src": "51:1223:43" }, "legacyAST": { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/helpers/TestReentrancyGuard.sol", "exportedSymbols": { "TestReentrancyGuard": [ 19640 ], "TestReentrancyGuardAttacker": [ 19605 ] }, "id": 19641, "license": "SEE LICENSE IN LICENSE", "nodeType": "SourceUnit", "nodes": [ { "id": 19528, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "51:23:43" }, { "absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/ReentrancyGuard.sol", "file": "../utility/ReentrancyGuard.sol", "id": 19529, "nodeType": "ImportDirective", "scope": 19641, "sourceUnit": 22243, "src": "75:40:43", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 19605, "linearizedBaseContracts": [ 19605 ], "name": "TestReentrancyGuardAttacker", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "d4b83992", "id": 19531, "mutability": "mutable", "name": "target", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "161:33:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" }, "typeName": { "contractScope": null, "id": 19530, "name": "TestReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 19640, "src": "161:19:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "e11f493e", "id": 19533, "mutability": "mutable", "name": "reentrancy", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "200:22:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19532, "name": "bool", "nodeType": "ElementaryTypeName", "src": "200:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "17846e39", "id": 19535, "mutability": "mutable", "name": "callProtectedMethod", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "228:31:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19534, "name": "bool", "nodeType": "ElementaryTypeName", "src": "228:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "3c0bbcd9", "id": 19537, "mutability": "mutable", "name": "attacking", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19605, "src": "265:21:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19536, "name": "bool", "nodeType": "ElementaryTypeName", "src": "265:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "body": { "id": 19546, "nodeType": "Block", "src": "341:33:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19544, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19542, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "351:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19543, "name": "_target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19539, "src": "360:7:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "src": "351:16:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19545, "nodeType": "ExpressionStatement", "src": "351:16:43" } ] }, "documentation": null, "id": 19547, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19540, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19539, "mutability": "mutable", "name": "_target", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19547, "src": "305:27:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" }, "typeName": { "contractScope": null, "id": 19538, "name": "TestReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 19640, "src": "305:19:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "value": null, "visibility": "internal" } ], "src": "304:29:43" }, "returnParameters": { "id": 19541, "nodeType": "ParameterList", "parameters": [], "src": "341:0:43" }, "scope": 19605, "src": "293:81:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 19556, "nodeType": "Block", "src": "430:41:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19554, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19552, "name": "reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19533, "src": "440:10:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19553, "name": "_reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19549, "src": "453:11:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "440:24:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19555, "nodeType": "ExpressionStatement", "src": "440:24:43" } ] }, "documentation": null, "functionSelector": "322d5010", "id": 19557, "implemented": true, "kind": "function", "modifiers": [], "name": "setReentrancy", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19550, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19549, "mutability": "mutable", "name": "_reentrancy", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19557, "src": "403:16:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19548, "name": "bool", "nodeType": "ElementaryTypeName", "src": "403:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "402:18:43" }, "returnParameters": { "id": 19551, "nodeType": "ParameterList", "parameters": [], "src": "430:0:43" }, "scope": 19605, "src": "380:91:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19566, "nodeType": "Block", "src": "545:59:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19564, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19562, "name": "callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19535, "src": "555:19:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 19563, "name": "_callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19559, "src": "577:20:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "555:42:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19565, "nodeType": "ExpressionStatement", "src": "555:42:43" } ] }, "documentation": null, "functionSelector": "99563f10", "id": 19567, "implemented": true, "kind": "function", "modifiers": [], "name": "setCallProtectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19560, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 19559, "mutability": "mutable", "name": "_callProtectedMethod", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19567, "src": "509:25:43", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 19558, "name": "bool", "nodeType": "ElementaryTypeName", "src": "509:4:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "508:27:43" }, "returnParameters": { "id": 19561, "nodeType": "ParameterList", "parameters": [], "src": "545:0:43" }, "scope": 19605, "src": "477:127:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19579, "nodeType": "Block", "src": "632:92:43", "statements": [ { "expression": { "argumentTypes": null, "condition": { "argumentTypes": null, "id": 19570, "name": "callProtectedMethod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19535, "src": "642:19:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 19574, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "691:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19575, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "unprotectedMethod", "nodeType": "MemberAccess", "referencedDeclaration": 19625, "src": "691:24:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19576, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:26:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "642:75:43", "trueExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 19571, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19531, "src": "664:6:43", "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuard_$19640", "typeString": "contract TestReentrancyGuard" } }, "id": 19572, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "protectedMethod", "nodeType": "MemberAccess", "referencedDeclaration": 19618, "src": "664:22:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "664:24:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19578, "nodeType": "ExpressionStatement", "src": "642:75:43" } ] }, "documentation": null, "functionSelector": "c0406226", "id": 19580, "implemented": true, "kind": "function", "modifiers": [], "name": "run", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19568, "nodeType": "ParameterList", "parameters": [], "src": "622:2:43" }, "returnParameters": { "id": 19569, "nodeType": "ParameterList", "parameters": [], "src": "632:0:43" }, "scope": 19605, "src": "610:114:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 19603, "nodeType": "Block", "src": "759:179:43", "statements": [ { "condition": { "argumentTypes": null, "id": 19584, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "!", "prefix": true, "src": "773:11:43", "subExpression": { "argumentTypes": null, "id": 19583, "name": "reentrancy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19533, "src": "774:10:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 19587, "nodeType": "IfStatement", "src": "769:48:43", "trueBody": { "id": 19586, "nodeType": "Block", "src": "786:31:43", "statements": [ { "expression": null, "functionReturnParameters": 19582, "id": 19585, "nodeType": "Return", "src": "800:7:43" } ] } }, { "condition": { "argumentTypes": null, "id": 19589, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "!", "prefix": true, "src": "831:10:43", "subExpression": { "argumentTypes": null, "id": 19588, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "832:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 19598, "nodeType": "IfStatement", "src": "827:77:43", "trueBody": { "id": 19597, "nodeType": "Block", "src": "843:61:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19592, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19590, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "857:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "74727565", "id": 19591, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "869:4:43", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "src": "857:16:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19593, "nodeType": "ExpressionStatement", "src": "857:16:43" }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19594, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19580, "src": "888:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19595, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "888:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19596, "nodeType": "ExpressionStatement", "src": "888:5:43" } ] } }, { "expression": { "argumentTypes": null, "id": 19601, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 19599, "name": "attacking", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19537, "src": "914:9:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "66616c7365", "id": 19600, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "926:5:43", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "src": "914:17:43", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 19602, "nodeType": "ExpressionStatement", "src": "914:17:43" } ] }, "documentation": null, "functionSelector": "083b2732", "id": 19604, "implemented": true, "kind": "function", "modifiers": [], "name": "callback", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19581, "nodeType": "ParameterList", "parameters": [], "src": "747:2:43" }, "returnParameters": { "id": 19582, "nodeType": "ParameterList", "parameters": [], "src": "759:0:43" }, "scope": 19605, "src": "730:208:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" } ], "scope": 19641, "src": "118:822:43" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 19606, "name": "ReentrancyGuard", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22242, "src": "974:15:43", "typeDescriptions": { "typeIdentifier": "t_contract$_ReentrancyGuard_$22242", "typeString": "contract ReentrancyGuard" } }, "id": 19607, "nodeType": "InheritanceSpecifier", "src": "974:15:43" } ], "contractDependencies": [ 22242 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 19640, "linearizedBaseContracts": [ 19640, 22242 ], "name": "TestReentrancyGuard", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "305f72b7", "id": 19609, "mutability": "mutable", "name": "calls", "nodeType": "VariableDeclaration", "overrides": null, "scope": 19640, "src": "996:20:43", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 19608, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "996:7:43", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 19617, "nodeType": "Block", "src": "1069:22:43", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19614, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19639, "src": "1079:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19615, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1079:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19616, "nodeType": "ExpressionStatement", "src": "1079:5:43" } ] }, "documentation": null, "functionSelector": "2d4d800c", "id": 19618, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 19612, "modifierName": { "argumentTypes": null, "id": 19611, "name": "protected", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22231, "src": "1059:9:43", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1059:9:43" } ], "name": "protectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19610, "nodeType": "ParameterList", "parameters": [], "src": "1047:2:43" }, "returnParameters": { "id": 19613, "nodeType": "ParameterList", "parameters": [], "src": "1069:0:43" }, "scope": 19640, "src": "1023:68:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19624, "nodeType": "Block", "src": "1135:22:43", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 19621, "name": "run", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19639, "src": "1145:3:43", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", "typeString": "function ()" } }, "id": 19622, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1145:5:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19623, "nodeType": "ExpressionStatement", "src": "1145:5:43" } ] }, "documentation": null, "functionSelector": "f86485d9", "id": 19625, "implemented": true, "kind": "function", "modifiers": [], "name": "unprotectedMethod", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19619, "nodeType": "ParameterList", "parameters": [], "src": "1123:2:43" }, "returnParameters": { "id": 19620, "nodeType": "ParameterList", "parameters": [], "src": "1135:0:43" }, "scope": 19640, "src": "1097:60:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": { "id": 19638, "nodeType": "Block", "src": "1186:85:43", "statements": [ { "expression": { "argumentTypes": null, "id": 19629, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1196:7:43", "subExpression": { "argumentTypes": null, "id": 19628, "name": "calls", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19609, "src": "1196:5:43", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 19630, "nodeType": "ExpressionStatement", "src": "1196:7:43" }, { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 19632, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "1242:3:43", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 19633, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1242:10:43", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 19631, "name": "TestReentrancyGuardAttacker", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 19605, "src": "1214:27:43", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_TestReentrancyGuardAttacker_$19605_$", "typeString": "type(contract TestReentrancyGuardAttacker)" } }, "id": 19634, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1214:39:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_TestReentrancyGuardAttacker_$19605", "typeString": "contract TestReentrancyGuardAttacker" } }, "id": 19635, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "callback", "nodeType": "MemberAccess", "referencedDeclaration": 19604, "src": "1214:48:43", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$__$returns$__$", "typeString": "function () external" } }, "id": 19636, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1214:50:43", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 19637, "nodeType": "ExpressionStatement", "src": "1214:50:43" } ] }, "documentation": null, "id": 19639, "implemented": true, "kind": "function", "modifiers": [], "name": "run", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 19626, "nodeType": "ParameterList", "parameters": [], "src": "1175:2:43" }, "returnParameters": { "id": 19627, "nodeType": "ParameterList", "parameters": [], "src": "1186:0:43" }, "scope": 19640, "src": "1163:108:43", "stateMutability": "nonpayable", "virtual": false, "visibility": "private" } ], "scope": 19641, "src": "942:331:43" } ], "src": "51:1223:43" }, "compiler": { "name": "solc", "version": "0.6.12+commit.27d51765.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.2.3", "updatedAt": "2020-10-20T08:24:47.811Z", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }