UNPKG

truffle-analyze

Version:

Add vulnerability and weakness analysis via the MythX

1,186 lines 69.8 kB
{ "contractName": "SimpleDAO", "abi": [ { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "credit", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "to", "type": "address" } ], "name": "donate", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "amount", "type": "uint256" } ], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "name": "to", "type": "address" } ], "name": "queryCredit", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b50610320806100206000396000f300608060405260043610610061576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062362a95146100665780632e1a7d4d1461009c57806359f1286d146100c9578063d5d44d8014610120575b600080fd5b61009a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610177565b005b3480156100a857600080fd5b506100c7600480360381019080803590602001909291905050506101c6565b005b3480156100d557600080fd5b5061010a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610294565b6040518082815260200191505060405180910390f35b34801561012c57600080fd5b50610161600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102dc565b6040518082815260200191505060405180910390f35b346000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555050565b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515610291573373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151561024457600080fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600060205280600052604060002060009150905054815600a165627a7a72305820995dd360cfe1e03c0dded401ac885f902c03677f72bdcce6d8d845db1f313dca0029", "deployedBytecode": "0x608060405260043610610061576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062362a95146100665780632e1a7d4d1461009c57806359f1286d146100c9578063d5d44d8014610120575b600080fd5b61009a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610177565b005b3480156100a857600080fd5b506100c7600480360381019080803590602001909291905050506101c6565b005b3480156100d557600080fd5b5061010a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610294565b6040518082815260200191505060405180910390f35b34801561012c57600080fd5b50610161600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102dc565b6040518082815260200191505060405180910390f35b346000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555050565b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515610291573373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151561024457600080fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600060205280600052604060002060009150905054815600a165627a7a72305820995dd360cfe1e03c0dded401ac885f902c03677f72bdcce6d8d845db1f313dca0029", "sourceMap": "195:408:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;195:408:1;;;;;;;", "deployedSourceMap": "195:408:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;262:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;342:169;;8:9:-1;5:2;;;30:1;27;20:12;5:2;342:169:1;;;;;;;;;;;;;;;;;;;;;;;;;;515:86;;8:9:-1;5:2;;;30:1;27;20:12;5:2;515:86:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;218:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;218:39:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;262:76;324:9;310:6;:10;317:2;310:10;;;;;;;;;;;;;;;;:23;;;;;;;;;;;262:76;:::o;342:169::-;410:6;389;:18;396:10;389:18;;;;;;;;;;;;;;;;:27;;385:122;;;434:10;:15;;456:6;434:31;;;;;;;;;;;;;;;;;426:40;;;;;;;;494:6;474;:18;481:10;474:18;;;;;;;;;;;;;;;;:26;;;;;;;;;;;385:122;342:169;:::o;515:86::-;568:4;586:6;:10;593:2;586:10;;;;;;;;;;;;;;;;579:17;;515:86;;;:::o;218:39::-;;;;;;;;;;;;;;;;;:::o", "source": "/*\n * @source: http://blockchain.unica.it/projects/ethereum-survey/attacks.html#simpledao\n * @author: Atzei N., Bartoletti M., Cimoli T\n * Modified by Josselin Feist\n */\npragma solidity 0.4.25;\n\ncontract SimpleDAO {\n mapping (address => uint) public credit;\n\n function donate(address to) payable public{\n credit[to] += msg.value;\n }\n\n function withdraw(uint amount) public{\n if (credit[msg.sender]>= amount) {\n require(msg.sender.call.value(amount)());\n credit[msg.sender]-=amount;\n }\n }\n\n function queryCredit(address to) view public returns(uint){\n return credit[to];\n }\n}\n", "sourcePath": "/src/external-vcs/github/consensys/truffle-analyze/test/sample-truffle/contracts/simple_dao.sol", "ast": { "absolutePath": "/src/external-vcs/github/consensys/truffle-analyze/test/sample-truffle/contracts/simple_dao.sol", "exportedSymbols": { "SimpleDAO": [ 119 ] }, "id": 120, "nodeType": "SourceUnit", "nodes": [ { "id": 58, "literals": [ "solidity", "0.4", ".25" ], "nodeType": "PragmaDirective", "src": "170:23:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 119, "linearizedBaseContracts": [ 119 ], "name": "SimpleDAO", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 62, "name": "credit", "nodeType": "VariableDeclaration", "scope": 119, "src": "218:39:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 61, "keyType": { "id": 59, "name": "address", "nodeType": "ElementaryTypeName", "src": "227:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "218:25:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 60, "name": "uint", "nodeType": "ElementaryTypeName", "src": "238:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "body": { "id": 74, "nodeType": "Block", "src": "304:34:1", "statements": [ { "expression": { "argumentTypes": null, "id": 72, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 67, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "310:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 69, "indexExpression": { "argumentTypes": null, "id": 68, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, "src": "317:2:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "310:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 70, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "324:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 71, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "324:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "310:23:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 73, "nodeType": "ExpressionStatement", "src": "310:23:1" } ] }, "documentation": null, "id": 75, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 65, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 64, "name": "to", "nodeType": "VariableDeclaration", "scope": 75, "src": "278:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 63, "name": "address", "nodeType": "ElementaryTypeName", "src": "278:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "277:12:1" }, "payable": true, "returnParameters": { "id": 66, "nodeType": "ParameterList", "parameters": [], "src": "304:0:1" }, "scope": 119, "src": "262:76:1", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 105, "nodeType": "Block", "src": "379:132:1", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 85, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 80, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "389:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 83, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 81, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "396:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 82, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "396:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "389:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 84, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 77, "src": "410:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "389:27:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 104, "nodeType": "IfStatement", "src": "385:122:1", "trueBody": { "id": 103, "nodeType": "Block", "src": "418:89:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "arguments": [ { "argumentTypes": null, "id": 91, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 77, "src": "456:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 87, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "434:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 88, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "434:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 89, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "call", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "434:15:1", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$__$returns$_t_bool_$", "typeString": "function () payable returns (bool)" } }, "id": 90, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "434:21:1", "typeDescriptions": { "typeIdentifier": "t_function_setvalue_nonpayable$_t_uint256_$returns$_t_function_barecall_payable$__$returns$_t_bool_$value_$", "typeString": "function (uint256) returns (function () payable returns (bool))" } }, "id": 92, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "434:29:1", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$__$returns$_t_bool_$value", "typeString": "function () payable returns (bool)" } }, "id": 93, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "434:31:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 86, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 137, 138 ], "referencedDeclaration": 137, "src": "426:7:1", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 94, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "426:40:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 95, "nodeType": "ExpressionStatement", "src": "426:40:1" }, { "expression": { "argumentTypes": null, "id": 101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 96, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "474:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 99, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 97, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "481:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 98, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "481:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "474:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "-=", "rightHandSide": { "argumentTypes": null, "id": 100, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 77, "src": "494:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "474:26:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 102, "nodeType": "ExpressionStatement", "src": "474:26:1" } ] } } ] }, "documentation": null, "id": 106, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "withdraw", "nodeType": "FunctionDefinition", "parameters": { "id": 78, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 77, "name": "amount", "nodeType": "VariableDeclaration", "scope": 106, "src": "360:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 76, "name": "uint", "nodeType": "ElementaryTypeName", "src": "360:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "359:13:1" }, "payable": false, "returnParameters": { "id": 79, "nodeType": "ParameterList", "parameters": [], "src": "379:0:1" }, "scope": 119, "src": "342:169:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 117, "nodeType": "Block", "src": "573:28:1", "statements": [ { "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 113, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "586:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 115, "indexExpression": { "argumentTypes": null, "id": 114, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 108, "src": "593:2:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "586:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 112, "id": 116, "nodeType": "Return", "src": "579:17:1" } ] }, "documentation": null, "id": 118, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "queryCredit", "nodeType": "FunctionDefinition", "parameters": { "id": 109, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 108, "name": "to", "nodeType": "VariableDeclaration", "scope": 118, "src": "536:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 107, "name": "address", "nodeType": "ElementaryTypeName", "src": "536:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "535:12:1" }, "payable": false, "returnParameters": { "id": 112, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 111, "name": "", "nodeType": "VariableDeclaration", "scope": 118, "src": "568:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 110, "name": "uint", "nodeType": "ElementaryTypeName", "src": "568:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "567:6:1" }, "scope": 119, "src": "515:86:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 120, "src": "195:408:1" } ], "src": "170:434:1" }, "legacyAST": { "absolutePath": "/src/external-vcs/github/consensys/truffle-analyze/test/sample-truffle/contracts/simple_dao.sol", "exportedSymbols": { "SimpleDAO": [ 119 ] }, "id": 120, "nodeType": "SourceUnit", "nodes": [ { "id": 58, "literals": [ "solidity", "0.4", ".25" ], "nodeType": "PragmaDirective", "src": "170:23:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 119, "linearizedBaseContracts": [ 119 ], "name": "SimpleDAO", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 62, "name": "credit", "nodeType": "VariableDeclaration", "scope": 119, "src": "218:39:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "typeName": { "id": 61, "keyType": { "id": 59, "name": "address", "nodeType": "ElementaryTypeName", "src": "227:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "218:25:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" }, "valueType": { "id": 60, "name": "uint", "nodeType": "ElementaryTypeName", "src": "238:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "value": null, "visibility": "public" }, { "body": { "id": 74, "nodeType": "Block", "src": "304:34:1", "statements": [ { "expression": { "argumentTypes": null, "id": 72, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 67, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "310:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 69, "indexExpression": { "argumentTypes": null, "id": 68, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, "src": "317:2:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "310:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 70, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "324:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 71, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "324:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "310:23:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 73, "nodeType": "ExpressionStatement", "src": "310:23:1" } ] }, "documentation": null, "id": 75, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 65, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 64, "name": "to", "nodeType": "VariableDeclaration", "scope": 75, "src": "278:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 63, "name": "address", "nodeType": "ElementaryTypeName", "src": "278:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "277:12:1" }, "payable": true, "returnParameters": { "id": 66, "nodeType": "ParameterList", "parameters": [], "src": "304:0:1" }, "scope": 119, "src": "262:76:1", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 105, "nodeType": "Block", "src": "379:132:1", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 85, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 80, "name": "credit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "389:6:1", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", "typeString": "mapping(address => uint256)" } }, "id": 83, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 81, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "396:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 82, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "396:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "389:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 84, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 77, "src": "410:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "389:27:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 104, "nodeType": "IfStatement", "src": "385:122:1", "trueBody"