├── .DS_Store ├── .gitignore ├── CalculatorV2.Interface.json ├── CalculatorV2.txt ├── InteractChannel.address.txt ├── InteractionChannel.json ├── Readme.md ├── build ├── .DS_Store └── contracts │ ├── Calculator.json │ ├── CalculatorV2.json │ ├── HelloEthereumString-ABI.json │ ├── HelloEthereumString.json │ ├── InteractionChannel.json │ ├── LastInteraction.json │ └── Migrations.json ├── contracts ├── Calculator.sol ├── CalculatorV2.sol ├── HelloEthereumString.sol ├── InteractionChannel.sol ├── InteractionChannelV2.sol └── Migrations.sol ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js ├── template ├── Calculator.sol └── calculator.case3.js ├── test ├── calculator.js └── calculatorV2.js └── truffle-config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acloudfan/Blockchain-Course-Calculator/6deda19489e8f2b7afd11d1f22de20242b955a57/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | app 2 | -------------------------------------------------------------------------------- /CalculatorV2.Interface.json: -------------------------------------------------------------------------------- 1 | 2 | [{"constant":false,"inputs":[{"name":"num","type":"uint256"}],"name":"addToNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"num","type":"uint256"}],"name":"substractNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"num","type":"uint256"}],"name":"multiplyWithNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getResult","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"num","type":"uint256"}],"name":"divideByNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"num","type":"uint256"}],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"n","type":"uint256"}],"name":"NumberAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"n","type":"uint256"}],"name":"NumberSubtracted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"n","type":"uint256"}],"name":"NumberMultiplied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"n","type":"uint256"}],"name":"NumberDivided","type":"event"}] -------------------------------------------------------------------------------- /CalculatorV2.txt: -------------------------------------------------------------------------------- 1 | This file has address for the Calculator V2 2 | 3 | Contract Address for ROPSTEN Network 4 | 0x91d5540851d98cbFB4b46EE9212EFE100eC85807 5 | 6 | Contract Address for Rinkeby Network 7 | 0xF363Aa13ACE678F7812aa2D6C0F08A3D71020c94 8 | 9 | 10 | To Deploy it in the contract - use the JSON in CalculatorV2.Interface.json + Address 11 | -------------------------------------------------------------------------------- /InteractChannel.address.txt: -------------------------------------------------------------------------------- 1 | 2 | Address in ROPSTEN Network 3 | 0x6d5dd261cad88ccc53990abd78cf527520a5522d 4 | 5 | Address in Rinkeby Network 6 | 0x1F20E0a14121276220Dc049696590fCbfa0621E0 7 | -------------------------------------------------------------------------------- /InteractionChannel.json: -------------------------------------------------------------------------------- 1 | [{"constant":false,"inputs":[{"name":"yourName","type":"bytes32"}],"name":"interact","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"currentName","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fromAddres","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"lastUpdatedMinutes","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"},{"indexed":true,"name":"addr","type":"address"},{"indexed":true,"name":"timeUpdated","type":"uint256"}],"name":"Interaction","type":"event"}] 2 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Part of the course on "Ethereum Blockchain DAPP Development" 2 | http://www.ACloudFan.com 3 | 4 | MAC/UBUNTU/LINUX Users: 5 | 6 | Please rename truffle-config to config.js 7 | 8 | Calculator/CalculatorV2/interactionChannel contract is used as a sample in lectures in the course 9 | 10 | 1 DAPP development sample and for demonstrating the use of wallets for managing contracts 11 | 2. For demonstrating use of Broweser based Solidity contract development 12 | 2. Development of contracts using Truffle framework -------------------------------------------------------------------------------- /build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acloudfan/Blockchain-Course-Calculator/6deda19489e8f2b7afd11d1f22de20242b955a57/build/.DS_Store -------------------------------------------------------------------------------- /build/contracts/Calculator.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Calculator", 3 | "abi": [ 4 | { 5 | "inputs": [], 6 | "payable": false, 7 | "stateMutability": "nonpayable", 8 | "type": "constructor" 9 | }, 10 | { 11 | "constant": true, 12 | "inputs": [], 13 | "name": "getResult", 14 | "outputs": [ 15 | { 16 | "name": "", 17 | "type": "uint256" 18 | } 19 | ], 20 | "payable": false, 21 | "stateMutability": "view", 22 | "type": "function" 23 | }, 24 | { 25 | "constant": false, 26 | "inputs": [ 27 | { 28 | "name": "num", 29 | "type": "uint256" 30 | } 31 | ], 32 | "name": "addToNumber", 33 | "outputs": [ 34 | { 35 | "name": "", 36 | "type": "uint256" 37 | } 38 | ], 39 | "payable": false, 40 | "stateMutability": "nonpayable", 41 | "type": "function" 42 | }, 43 | { 44 | "constant": false, 45 | "inputs": [ 46 | { 47 | "name": "num", 48 | "type": "uint256" 49 | } 50 | ], 51 | "name": "substractFromNumber", 52 | "outputs": [ 53 | { 54 | "name": "", 55 | "type": "uint256" 56 | } 57 | ], 58 | "payable": false, 59 | "stateMutability": "nonpayable", 60 | "type": "function" 61 | }, 62 | { 63 | "constant": true, 64 | "inputs": [], 65 | "name": "multiplyWithNumber", 66 | "outputs": [ 67 | { 68 | "name": "", 69 | "type": "uint256" 70 | } 71 | ], 72 | "payable": false, 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "constant": true, 78 | "inputs": [], 79 | "name": "divideNumberBy", 80 | "outputs": [ 81 | { 82 | "name": "", 83 | "type": "uint256" 84 | } 85 | ], 86 | "payable": false, 87 | "stateMutability": "view", 88 | "type": "function" 89 | } 90 | ], 91 | "bytecode": "0x6060604052341561000f57600080fd5b600a6000819055506101d8806100266000396000f30060606040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306ccd230146100725780630ce4805c146100a957806382f7d5c3146100d2578063de292789146100fb578063ef455b3c14610124575b600080fd5b341561007d57600080fd5b610093600480803590602001909190505061015b565b6040518082815260200191505060405180910390f35b34156100b457600080fd5b6100bc610176565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100e561017f565b6040518082815260200191505060405180910390f35b341561010657600080fd5b61010e610188565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101456004808035906020019091905050610191565b6040518082815260200191505060405180910390f35b60008160008082825401925050819055506000549050919050565b60008054905090565b60008054905090565b60008054905090565b600081600080828254039250508190555060005490509190505600a165627a7a723058203a9aec1f718788924981311996c4682aeb3ca0293880051cdaaa4ebf2c0bbe1e0029", 92 | "deployedBytecode": "0x60606040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306ccd230146100725780630ce4805c146100a957806382f7d5c3146100d2578063de292789146100fb578063ef455b3c14610124575b600080fd5b341561007d57600080fd5b610093600480803590602001909190505061015b565b6040518082815260200191505060405180910390f35b34156100b457600080fd5b6100bc610176565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100e561017f565b6040518082815260200191505060405180910390f35b341561010657600080fd5b61010e610188565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101456004808035906020019091905050610191565b6040518082815260200191505060405180910390f35b60008160008082825401925050819055506000549050919050565b60008054905090565b60008054905090565b60008054905090565b600081600080828254039250508190555060005490509190505600a165627a7a723058203a9aec1f718788924981311996c4682aeb3ca0293880051cdaaa4ebf2c0bbe1e0029", 93 | "sourceMap": "25:697:0:-;;;66:68;;;;;;;;127:2;120:6;:9;;;;25:697;;;;;;", 94 | "deployedSourceMap": "25:697:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;268:96;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;530:81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;642:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;162:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;395:104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;268:96;315:4;337:3;327:6;;:13;;;;;;;;;;;353:6;;346:13;;268:96;;;:::o;530:81::-;581:4;600:6;;593:13;;530:81;:::o;642:77::-;689:4;708:6;;701:13;;642:77;:::o;162:75::-;208:4;226:6;;219:13;;162:75;:::o;395:104::-;450:4;472:3;462:6;;:13;;;;;;;;;;;488:6;;481:13;;395:104;;;:::o", 95 | "source": "pragma solidity ^0.4.6;\n\ncontract Calculator {\n\n uint result;\n\n function Calculator() public {\n // constructor\n result=10;\n }\n\n // returns the result\n function getResult() public constant returns (uint){\n return result;\n }\n\n // result = result + num\n function addToNumber(uint num) public returns (uint) {\n result += num;\n return result;\n }\n\n // result = result - num\n function substractFromNumber(uint num) public returns (uint) {\n result -= num;\n return result;\n }\n\n // result = result * num\n function multiplyWithNumber() public view returns (uint) {\n return result;\n }\n\n // result = result / num\n function divideNumberBy() public view returns (uint) {\n return result;\n }\n\n}\n", 96 | "sourcePath": "C:\\Users\\Rajeev\\Documents\\Course\\Blockchain Course\\workspace\\Blockchain-Course-Calculator\\contracts\\Calculator.sol", 97 | "ast": { 98 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/Calculator.sol", 99 | "exportedSymbols": { 100 | "Calculator": [ 101 | 64 102 | ] 103 | }, 104 | "id": 65, 105 | "nodeType": "SourceUnit", 106 | "nodes": [ 107 | { 108 | "id": 1, 109 | "literals": [ 110 | "solidity", 111 | "^", 112 | "0.4", 113 | ".6" 114 | ], 115 | "nodeType": "PragmaDirective", 116 | "src": "0:23:0" 117 | }, 118 | { 119 | "baseContracts": [], 120 | "contractDependencies": [], 121 | "contractKind": "contract", 122 | "documentation": null, 123 | "fullyImplemented": true, 124 | "id": 64, 125 | "linearizedBaseContracts": [ 126 | 64 127 | ], 128 | "name": "Calculator", 129 | "nodeType": "ContractDefinition", 130 | "nodes": [ 131 | { 132 | "constant": false, 133 | "id": 3, 134 | "name": "result", 135 | "nodeType": "VariableDeclaration", 136 | "scope": 64, 137 | "src": "50:11:0", 138 | "stateVariable": true, 139 | "storageLocation": "default", 140 | "typeDescriptions": { 141 | "typeIdentifier": "t_uint256", 142 | "typeString": "uint256" 143 | }, 144 | "typeName": { 145 | "id": 2, 146 | "name": "uint", 147 | "nodeType": "ElementaryTypeName", 148 | "src": "50:4:0", 149 | "typeDescriptions": { 150 | "typeIdentifier": "t_uint256", 151 | "typeString": "uint256" 152 | } 153 | }, 154 | "value": null, 155 | "visibility": "internal" 156 | }, 157 | { 158 | "body": { 159 | "id": 10, 160 | "nodeType": "Block", 161 | "src": "95:39:0", 162 | "statements": [ 163 | { 164 | "expression": { 165 | "argumentTypes": null, 166 | "id": 8, 167 | "isConstant": false, 168 | "isLValue": false, 169 | "isPure": false, 170 | "lValueRequested": false, 171 | "leftHandSide": { 172 | "argumentTypes": null, 173 | "id": 6, 174 | "name": "result", 175 | "nodeType": "Identifier", 176 | "overloadedDeclarations": [], 177 | "referencedDeclaration": 3, 178 | "src": "120:6:0", 179 | "typeDescriptions": { 180 | "typeIdentifier": "t_uint256", 181 | "typeString": "uint256" 182 | } 183 | }, 184 | "nodeType": "Assignment", 185 | "operator": "=", 186 | "rightHandSide": { 187 | "argumentTypes": null, 188 | "hexValue": "3130", 189 | "id": 7, 190 | "isConstant": false, 191 | "isLValue": false, 192 | "isPure": true, 193 | "kind": "number", 194 | "lValueRequested": false, 195 | "nodeType": "Literal", 196 | "src": "127:2:0", 197 | "subdenomination": null, 198 | "typeDescriptions": { 199 | "typeIdentifier": "t_rational_10_by_1", 200 | "typeString": "int_const 10" 201 | }, 202 | "value": "10" 203 | }, 204 | "src": "120:9:0", 205 | "typeDescriptions": { 206 | "typeIdentifier": "t_uint256", 207 | "typeString": "uint256" 208 | } 209 | }, 210 | "id": 9, 211 | "nodeType": "ExpressionStatement", 212 | "src": "120:9:0" 213 | } 214 | ] 215 | }, 216 | "id": 11, 217 | "implemented": true, 218 | "isConstructor": true, 219 | "isDeclaredConst": false, 220 | "modifiers": [], 221 | "name": "Calculator", 222 | "nodeType": "FunctionDefinition", 223 | "parameters": { 224 | "id": 4, 225 | "nodeType": "ParameterList", 226 | "parameters": [], 227 | "src": "85:2:0" 228 | }, 229 | "payable": false, 230 | "returnParameters": { 231 | "id": 5, 232 | "nodeType": "ParameterList", 233 | "parameters": [], 234 | "src": "95:0:0" 235 | }, 236 | "scope": 64, 237 | "src": "66:68:0", 238 | "stateMutability": "nonpayable", 239 | "superFunction": null, 240 | "visibility": "public" 241 | }, 242 | { 243 | "body": { 244 | "id": 18, 245 | "nodeType": "Block", 246 | "src": "213:24:0", 247 | "statements": [ 248 | { 249 | "expression": { 250 | "argumentTypes": null, 251 | "id": 16, 252 | "name": "result", 253 | "nodeType": "Identifier", 254 | "overloadedDeclarations": [], 255 | "referencedDeclaration": 3, 256 | "src": "226:6:0", 257 | "typeDescriptions": { 258 | "typeIdentifier": "t_uint256", 259 | "typeString": "uint256" 260 | } 261 | }, 262 | "functionReturnParameters": 15, 263 | "id": 17, 264 | "nodeType": "Return", 265 | "src": "219:13:0" 266 | } 267 | ] 268 | }, 269 | "id": 19, 270 | "implemented": true, 271 | "isConstructor": false, 272 | "isDeclaredConst": true, 273 | "modifiers": [], 274 | "name": "getResult", 275 | "nodeType": "FunctionDefinition", 276 | "parameters": { 277 | "id": 12, 278 | "nodeType": "ParameterList", 279 | "parameters": [], 280 | "src": "180:2:0" 281 | }, 282 | "payable": false, 283 | "returnParameters": { 284 | "id": 15, 285 | "nodeType": "ParameterList", 286 | "parameters": [ 287 | { 288 | "constant": false, 289 | "id": 14, 290 | "name": "", 291 | "nodeType": "VariableDeclaration", 292 | "scope": 19, 293 | "src": "208:4:0", 294 | "stateVariable": false, 295 | "storageLocation": "default", 296 | "typeDescriptions": { 297 | "typeIdentifier": "t_uint256", 298 | "typeString": "uint256" 299 | }, 300 | "typeName": { 301 | "id": 13, 302 | "name": "uint", 303 | "nodeType": "ElementaryTypeName", 304 | "src": "208:4:0", 305 | "typeDescriptions": { 306 | "typeIdentifier": "t_uint256", 307 | "typeString": "uint256" 308 | } 309 | }, 310 | "value": null, 311 | "visibility": "internal" 312 | } 313 | ], 314 | "src": "207:6:0" 315 | }, 316 | "scope": 64, 317 | "src": "162:75:0", 318 | "stateMutability": "view", 319 | "superFunction": null, 320 | "visibility": "public" 321 | }, 322 | { 323 | "body": { 324 | "id": 32, 325 | "nodeType": "Block", 326 | "src": "321:43:0", 327 | "statements": [ 328 | { 329 | "expression": { 330 | "argumentTypes": null, 331 | "id": 28, 332 | "isConstant": false, 333 | "isLValue": false, 334 | "isPure": false, 335 | "lValueRequested": false, 336 | "leftHandSide": { 337 | "argumentTypes": null, 338 | "id": 26, 339 | "name": "result", 340 | "nodeType": "Identifier", 341 | "overloadedDeclarations": [], 342 | "referencedDeclaration": 3, 343 | "src": "327:6:0", 344 | "typeDescriptions": { 345 | "typeIdentifier": "t_uint256", 346 | "typeString": "uint256" 347 | } 348 | }, 349 | "nodeType": "Assignment", 350 | "operator": "+=", 351 | "rightHandSide": { 352 | "argumentTypes": null, 353 | "id": 27, 354 | "name": "num", 355 | "nodeType": "Identifier", 356 | "overloadedDeclarations": [], 357 | "referencedDeclaration": 21, 358 | "src": "337:3:0", 359 | "typeDescriptions": { 360 | "typeIdentifier": "t_uint256", 361 | "typeString": "uint256" 362 | } 363 | }, 364 | "src": "327:13:0", 365 | "typeDescriptions": { 366 | "typeIdentifier": "t_uint256", 367 | "typeString": "uint256" 368 | } 369 | }, 370 | "id": 29, 371 | "nodeType": "ExpressionStatement", 372 | "src": "327:13:0" 373 | }, 374 | { 375 | "expression": { 376 | "argumentTypes": null, 377 | "id": 30, 378 | "name": "result", 379 | "nodeType": "Identifier", 380 | "overloadedDeclarations": [], 381 | "referencedDeclaration": 3, 382 | "src": "353:6:0", 383 | "typeDescriptions": { 384 | "typeIdentifier": "t_uint256", 385 | "typeString": "uint256" 386 | } 387 | }, 388 | "functionReturnParameters": 25, 389 | "id": 31, 390 | "nodeType": "Return", 391 | "src": "346:13:0" 392 | } 393 | ] 394 | }, 395 | "id": 33, 396 | "implemented": true, 397 | "isConstructor": false, 398 | "isDeclaredConst": false, 399 | "modifiers": [], 400 | "name": "addToNumber", 401 | "nodeType": "FunctionDefinition", 402 | "parameters": { 403 | "id": 22, 404 | "nodeType": "ParameterList", 405 | "parameters": [ 406 | { 407 | "constant": false, 408 | "id": 21, 409 | "name": "num", 410 | "nodeType": "VariableDeclaration", 411 | "scope": 33, 412 | "src": "289:8:0", 413 | "stateVariable": false, 414 | "storageLocation": "default", 415 | "typeDescriptions": { 416 | "typeIdentifier": "t_uint256", 417 | "typeString": "uint256" 418 | }, 419 | "typeName": { 420 | "id": 20, 421 | "name": "uint", 422 | "nodeType": "ElementaryTypeName", 423 | "src": "289:4:0", 424 | "typeDescriptions": { 425 | "typeIdentifier": "t_uint256", 426 | "typeString": "uint256" 427 | } 428 | }, 429 | "value": null, 430 | "visibility": "internal" 431 | } 432 | ], 433 | "src": "288:10:0" 434 | }, 435 | "payable": false, 436 | "returnParameters": { 437 | "id": 25, 438 | "nodeType": "ParameterList", 439 | "parameters": [ 440 | { 441 | "constant": false, 442 | "id": 24, 443 | "name": "", 444 | "nodeType": "VariableDeclaration", 445 | "scope": 33, 446 | "src": "315:4:0", 447 | "stateVariable": false, 448 | "storageLocation": "default", 449 | "typeDescriptions": { 450 | "typeIdentifier": "t_uint256", 451 | "typeString": "uint256" 452 | }, 453 | "typeName": { 454 | "id": 23, 455 | "name": "uint", 456 | "nodeType": "ElementaryTypeName", 457 | "src": "315:4:0", 458 | "typeDescriptions": { 459 | "typeIdentifier": "t_uint256", 460 | "typeString": "uint256" 461 | } 462 | }, 463 | "value": null, 464 | "visibility": "internal" 465 | } 466 | ], 467 | "src": "314:6:0" 468 | }, 469 | "scope": 64, 470 | "src": "268:96:0", 471 | "stateMutability": "nonpayable", 472 | "superFunction": null, 473 | "visibility": "public" 474 | }, 475 | { 476 | "body": { 477 | "id": 46, 478 | "nodeType": "Block", 479 | "src": "456:43:0", 480 | "statements": [ 481 | { 482 | "expression": { 483 | "argumentTypes": null, 484 | "id": 42, 485 | "isConstant": false, 486 | "isLValue": false, 487 | "isPure": false, 488 | "lValueRequested": false, 489 | "leftHandSide": { 490 | "argumentTypes": null, 491 | "id": 40, 492 | "name": "result", 493 | "nodeType": "Identifier", 494 | "overloadedDeclarations": [], 495 | "referencedDeclaration": 3, 496 | "src": "462:6:0", 497 | "typeDescriptions": { 498 | "typeIdentifier": "t_uint256", 499 | "typeString": "uint256" 500 | } 501 | }, 502 | "nodeType": "Assignment", 503 | "operator": "-=", 504 | "rightHandSide": { 505 | "argumentTypes": null, 506 | "id": 41, 507 | "name": "num", 508 | "nodeType": "Identifier", 509 | "overloadedDeclarations": [], 510 | "referencedDeclaration": 35, 511 | "src": "472:3:0", 512 | "typeDescriptions": { 513 | "typeIdentifier": "t_uint256", 514 | "typeString": "uint256" 515 | } 516 | }, 517 | "src": "462:13:0", 518 | "typeDescriptions": { 519 | "typeIdentifier": "t_uint256", 520 | "typeString": "uint256" 521 | } 522 | }, 523 | "id": 43, 524 | "nodeType": "ExpressionStatement", 525 | "src": "462:13:0" 526 | }, 527 | { 528 | "expression": { 529 | "argumentTypes": null, 530 | "id": 44, 531 | "name": "result", 532 | "nodeType": "Identifier", 533 | "overloadedDeclarations": [], 534 | "referencedDeclaration": 3, 535 | "src": "488:6:0", 536 | "typeDescriptions": { 537 | "typeIdentifier": "t_uint256", 538 | "typeString": "uint256" 539 | } 540 | }, 541 | "functionReturnParameters": 39, 542 | "id": 45, 543 | "nodeType": "Return", 544 | "src": "481:13:0" 545 | } 546 | ] 547 | }, 548 | "id": 47, 549 | "implemented": true, 550 | "isConstructor": false, 551 | "isDeclaredConst": false, 552 | "modifiers": [], 553 | "name": "substractFromNumber", 554 | "nodeType": "FunctionDefinition", 555 | "parameters": { 556 | "id": 36, 557 | "nodeType": "ParameterList", 558 | "parameters": [ 559 | { 560 | "constant": false, 561 | "id": 35, 562 | "name": "num", 563 | "nodeType": "VariableDeclaration", 564 | "scope": 47, 565 | "src": "424:8:0", 566 | "stateVariable": false, 567 | "storageLocation": "default", 568 | "typeDescriptions": { 569 | "typeIdentifier": "t_uint256", 570 | "typeString": "uint256" 571 | }, 572 | "typeName": { 573 | "id": 34, 574 | "name": "uint", 575 | "nodeType": "ElementaryTypeName", 576 | "src": "424:4:0", 577 | "typeDescriptions": { 578 | "typeIdentifier": "t_uint256", 579 | "typeString": "uint256" 580 | } 581 | }, 582 | "value": null, 583 | "visibility": "internal" 584 | } 585 | ], 586 | "src": "423:10:0" 587 | }, 588 | "payable": false, 589 | "returnParameters": { 590 | "id": 39, 591 | "nodeType": "ParameterList", 592 | "parameters": [ 593 | { 594 | "constant": false, 595 | "id": 38, 596 | "name": "", 597 | "nodeType": "VariableDeclaration", 598 | "scope": 47, 599 | "src": "450:4:0", 600 | "stateVariable": false, 601 | "storageLocation": "default", 602 | "typeDescriptions": { 603 | "typeIdentifier": "t_uint256", 604 | "typeString": "uint256" 605 | }, 606 | "typeName": { 607 | "id": 37, 608 | "name": "uint", 609 | "nodeType": "ElementaryTypeName", 610 | "src": "450:4:0", 611 | "typeDescriptions": { 612 | "typeIdentifier": "t_uint256", 613 | "typeString": "uint256" 614 | } 615 | }, 616 | "value": null, 617 | "visibility": "internal" 618 | } 619 | ], 620 | "src": "449:6:0" 621 | }, 622 | "scope": 64, 623 | "src": "395:104:0", 624 | "stateMutability": "nonpayable", 625 | "superFunction": null, 626 | "visibility": "public" 627 | }, 628 | { 629 | "body": { 630 | "id": 54, 631 | "nodeType": "Block", 632 | "src": "587:24:0", 633 | "statements": [ 634 | { 635 | "expression": { 636 | "argumentTypes": null, 637 | "id": 52, 638 | "name": "result", 639 | "nodeType": "Identifier", 640 | "overloadedDeclarations": [], 641 | "referencedDeclaration": 3, 642 | "src": "600:6:0", 643 | "typeDescriptions": { 644 | "typeIdentifier": "t_uint256", 645 | "typeString": "uint256" 646 | } 647 | }, 648 | "functionReturnParameters": 51, 649 | "id": 53, 650 | "nodeType": "Return", 651 | "src": "593:13:0" 652 | } 653 | ] 654 | }, 655 | "id": 55, 656 | "implemented": true, 657 | "isConstructor": false, 658 | "isDeclaredConst": true, 659 | "modifiers": [], 660 | "name": "multiplyWithNumber", 661 | "nodeType": "FunctionDefinition", 662 | "parameters": { 663 | "id": 48, 664 | "nodeType": "ParameterList", 665 | "parameters": [], 666 | "src": "557:2:0" 667 | }, 668 | "payable": false, 669 | "returnParameters": { 670 | "id": 51, 671 | "nodeType": "ParameterList", 672 | "parameters": [ 673 | { 674 | "constant": false, 675 | "id": 50, 676 | "name": "", 677 | "nodeType": "VariableDeclaration", 678 | "scope": 55, 679 | "src": "581:4:0", 680 | "stateVariable": false, 681 | "storageLocation": "default", 682 | "typeDescriptions": { 683 | "typeIdentifier": "t_uint256", 684 | "typeString": "uint256" 685 | }, 686 | "typeName": { 687 | "id": 49, 688 | "name": "uint", 689 | "nodeType": "ElementaryTypeName", 690 | "src": "581:4:0", 691 | "typeDescriptions": { 692 | "typeIdentifier": "t_uint256", 693 | "typeString": "uint256" 694 | } 695 | }, 696 | "value": null, 697 | "visibility": "internal" 698 | } 699 | ], 700 | "src": "580:6:0" 701 | }, 702 | "scope": 64, 703 | "src": "530:81:0", 704 | "stateMutability": "view", 705 | "superFunction": null, 706 | "visibility": "public" 707 | }, 708 | { 709 | "body": { 710 | "id": 62, 711 | "nodeType": "Block", 712 | "src": "695:24:0", 713 | "statements": [ 714 | { 715 | "expression": { 716 | "argumentTypes": null, 717 | "id": 60, 718 | "name": "result", 719 | "nodeType": "Identifier", 720 | "overloadedDeclarations": [], 721 | "referencedDeclaration": 3, 722 | "src": "708:6:0", 723 | "typeDescriptions": { 724 | "typeIdentifier": "t_uint256", 725 | "typeString": "uint256" 726 | } 727 | }, 728 | "functionReturnParameters": 59, 729 | "id": 61, 730 | "nodeType": "Return", 731 | "src": "701:13:0" 732 | } 733 | ] 734 | }, 735 | "id": 63, 736 | "implemented": true, 737 | "isConstructor": false, 738 | "isDeclaredConst": true, 739 | "modifiers": [], 740 | "name": "divideNumberBy", 741 | "nodeType": "FunctionDefinition", 742 | "parameters": { 743 | "id": 56, 744 | "nodeType": "ParameterList", 745 | "parameters": [], 746 | "src": "665:2:0" 747 | }, 748 | "payable": false, 749 | "returnParameters": { 750 | "id": 59, 751 | "nodeType": "ParameterList", 752 | "parameters": [ 753 | { 754 | "constant": false, 755 | "id": 58, 756 | "name": "", 757 | "nodeType": "VariableDeclaration", 758 | "scope": 63, 759 | "src": "689:4:0", 760 | "stateVariable": false, 761 | "storageLocation": "default", 762 | "typeDescriptions": { 763 | "typeIdentifier": "t_uint256", 764 | "typeString": "uint256" 765 | }, 766 | "typeName": { 767 | "id": 57, 768 | "name": "uint", 769 | "nodeType": "ElementaryTypeName", 770 | "src": "689:4:0", 771 | "typeDescriptions": { 772 | "typeIdentifier": "t_uint256", 773 | "typeString": "uint256" 774 | } 775 | }, 776 | "value": null, 777 | "visibility": "internal" 778 | } 779 | ], 780 | "src": "688:6:0" 781 | }, 782 | "scope": 64, 783 | "src": "642:77:0", 784 | "stateMutability": "view", 785 | "superFunction": null, 786 | "visibility": "public" 787 | } 788 | ], 789 | "scope": 65, 790 | "src": "25:697:0" 791 | } 792 | ], 793 | "src": "0:723:0" 794 | }, 795 | "legacyAST": { 796 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/Calculator.sol", 797 | "exportedSymbols": { 798 | "Calculator": [ 799 | 64 800 | ] 801 | }, 802 | "id": 65, 803 | "nodeType": "SourceUnit", 804 | "nodes": [ 805 | { 806 | "id": 1, 807 | "literals": [ 808 | "solidity", 809 | "^", 810 | "0.4", 811 | ".6" 812 | ], 813 | "nodeType": "PragmaDirective", 814 | "src": "0:23:0" 815 | }, 816 | { 817 | "baseContracts": [], 818 | "contractDependencies": [], 819 | "contractKind": "contract", 820 | "documentation": null, 821 | "fullyImplemented": true, 822 | "id": 64, 823 | "linearizedBaseContracts": [ 824 | 64 825 | ], 826 | "name": "Calculator", 827 | "nodeType": "ContractDefinition", 828 | "nodes": [ 829 | { 830 | "constant": false, 831 | "id": 3, 832 | "name": "result", 833 | "nodeType": "VariableDeclaration", 834 | "scope": 64, 835 | "src": "50:11:0", 836 | "stateVariable": true, 837 | "storageLocation": "default", 838 | "typeDescriptions": { 839 | "typeIdentifier": "t_uint256", 840 | "typeString": "uint256" 841 | }, 842 | "typeName": { 843 | "id": 2, 844 | "name": "uint", 845 | "nodeType": "ElementaryTypeName", 846 | "src": "50:4:0", 847 | "typeDescriptions": { 848 | "typeIdentifier": "t_uint256", 849 | "typeString": "uint256" 850 | } 851 | }, 852 | "value": null, 853 | "visibility": "internal" 854 | }, 855 | { 856 | "body": { 857 | "id": 10, 858 | "nodeType": "Block", 859 | "src": "95:39:0", 860 | "statements": [ 861 | { 862 | "expression": { 863 | "argumentTypes": null, 864 | "id": 8, 865 | "isConstant": false, 866 | "isLValue": false, 867 | "isPure": false, 868 | "lValueRequested": false, 869 | "leftHandSide": { 870 | "argumentTypes": null, 871 | "id": 6, 872 | "name": "result", 873 | "nodeType": "Identifier", 874 | "overloadedDeclarations": [], 875 | "referencedDeclaration": 3, 876 | "src": "120:6:0", 877 | "typeDescriptions": { 878 | "typeIdentifier": "t_uint256", 879 | "typeString": "uint256" 880 | } 881 | }, 882 | "nodeType": "Assignment", 883 | "operator": "=", 884 | "rightHandSide": { 885 | "argumentTypes": null, 886 | "hexValue": "3130", 887 | "id": 7, 888 | "isConstant": false, 889 | "isLValue": false, 890 | "isPure": true, 891 | "kind": "number", 892 | "lValueRequested": false, 893 | "nodeType": "Literal", 894 | "src": "127:2:0", 895 | "subdenomination": null, 896 | "typeDescriptions": { 897 | "typeIdentifier": "t_rational_10_by_1", 898 | "typeString": "int_const 10" 899 | }, 900 | "value": "10" 901 | }, 902 | "src": "120:9:0", 903 | "typeDescriptions": { 904 | "typeIdentifier": "t_uint256", 905 | "typeString": "uint256" 906 | } 907 | }, 908 | "id": 9, 909 | "nodeType": "ExpressionStatement", 910 | "src": "120:9:0" 911 | } 912 | ] 913 | }, 914 | "id": 11, 915 | "implemented": true, 916 | "isConstructor": true, 917 | "isDeclaredConst": false, 918 | "modifiers": [], 919 | "name": "Calculator", 920 | "nodeType": "FunctionDefinition", 921 | "parameters": { 922 | "id": 4, 923 | "nodeType": "ParameterList", 924 | "parameters": [], 925 | "src": "85:2:0" 926 | }, 927 | "payable": false, 928 | "returnParameters": { 929 | "id": 5, 930 | "nodeType": "ParameterList", 931 | "parameters": [], 932 | "src": "95:0:0" 933 | }, 934 | "scope": 64, 935 | "src": "66:68:0", 936 | "stateMutability": "nonpayable", 937 | "superFunction": null, 938 | "visibility": "public" 939 | }, 940 | { 941 | "body": { 942 | "id": 18, 943 | "nodeType": "Block", 944 | "src": "213:24:0", 945 | "statements": [ 946 | { 947 | "expression": { 948 | "argumentTypes": null, 949 | "id": 16, 950 | "name": "result", 951 | "nodeType": "Identifier", 952 | "overloadedDeclarations": [], 953 | "referencedDeclaration": 3, 954 | "src": "226:6:0", 955 | "typeDescriptions": { 956 | "typeIdentifier": "t_uint256", 957 | "typeString": "uint256" 958 | } 959 | }, 960 | "functionReturnParameters": 15, 961 | "id": 17, 962 | "nodeType": "Return", 963 | "src": "219:13:0" 964 | } 965 | ] 966 | }, 967 | "id": 19, 968 | "implemented": true, 969 | "isConstructor": false, 970 | "isDeclaredConst": true, 971 | "modifiers": [], 972 | "name": "getResult", 973 | "nodeType": "FunctionDefinition", 974 | "parameters": { 975 | "id": 12, 976 | "nodeType": "ParameterList", 977 | "parameters": [], 978 | "src": "180:2:0" 979 | }, 980 | "payable": false, 981 | "returnParameters": { 982 | "id": 15, 983 | "nodeType": "ParameterList", 984 | "parameters": [ 985 | { 986 | "constant": false, 987 | "id": 14, 988 | "name": "", 989 | "nodeType": "VariableDeclaration", 990 | "scope": 19, 991 | "src": "208:4:0", 992 | "stateVariable": false, 993 | "storageLocation": "default", 994 | "typeDescriptions": { 995 | "typeIdentifier": "t_uint256", 996 | "typeString": "uint256" 997 | }, 998 | "typeName": { 999 | "id": 13, 1000 | "name": "uint", 1001 | "nodeType": "ElementaryTypeName", 1002 | "src": "208:4:0", 1003 | "typeDescriptions": { 1004 | "typeIdentifier": "t_uint256", 1005 | "typeString": "uint256" 1006 | } 1007 | }, 1008 | "value": null, 1009 | "visibility": "internal" 1010 | } 1011 | ], 1012 | "src": "207:6:0" 1013 | }, 1014 | "scope": 64, 1015 | "src": "162:75:0", 1016 | "stateMutability": "view", 1017 | "superFunction": null, 1018 | "visibility": "public" 1019 | }, 1020 | { 1021 | "body": { 1022 | "id": 32, 1023 | "nodeType": "Block", 1024 | "src": "321:43:0", 1025 | "statements": [ 1026 | { 1027 | "expression": { 1028 | "argumentTypes": null, 1029 | "id": 28, 1030 | "isConstant": false, 1031 | "isLValue": false, 1032 | "isPure": false, 1033 | "lValueRequested": false, 1034 | "leftHandSide": { 1035 | "argumentTypes": null, 1036 | "id": 26, 1037 | "name": "result", 1038 | "nodeType": "Identifier", 1039 | "overloadedDeclarations": [], 1040 | "referencedDeclaration": 3, 1041 | "src": "327:6:0", 1042 | "typeDescriptions": { 1043 | "typeIdentifier": "t_uint256", 1044 | "typeString": "uint256" 1045 | } 1046 | }, 1047 | "nodeType": "Assignment", 1048 | "operator": "+=", 1049 | "rightHandSide": { 1050 | "argumentTypes": null, 1051 | "id": 27, 1052 | "name": "num", 1053 | "nodeType": "Identifier", 1054 | "overloadedDeclarations": [], 1055 | "referencedDeclaration": 21, 1056 | "src": "337:3:0", 1057 | "typeDescriptions": { 1058 | "typeIdentifier": "t_uint256", 1059 | "typeString": "uint256" 1060 | } 1061 | }, 1062 | "src": "327:13:0", 1063 | "typeDescriptions": { 1064 | "typeIdentifier": "t_uint256", 1065 | "typeString": "uint256" 1066 | } 1067 | }, 1068 | "id": 29, 1069 | "nodeType": "ExpressionStatement", 1070 | "src": "327:13:0" 1071 | }, 1072 | { 1073 | "expression": { 1074 | "argumentTypes": null, 1075 | "id": 30, 1076 | "name": "result", 1077 | "nodeType": "Identifier", 1078 | "overloadedDeclarations": [], 1079 | "referencedDeclaration": 3, 1080 | "src": "353:6:0", 1081 | "typeDescriptions": { 1082 | "typeIdentifier": "t_uint256", 1083 | "typeString": "uint256" 1084 | } 1085 | }, 1086 | "functionReturnParameters": 25, 1087 | "id": 31, 1088 | "nodeType": "Return", 1089 | "src": "346:13:0" 1090 | } 1091 | ] 1092 | }, 1093 | "id": 33, 1094 | "implemented": true, 1095 | "isConstructor": false, 1096 | "isDeclaredConst": false, 1097 | "modifiers": [], 1098 | "name": "addToNumber", 1099 | "nodeType": "FunctionDefinition", 1100 | "parameters": { 1101 | "id": 22, 1102 | "nodeType": "ParameterList", 1103 | "parameters": [ 1104 | { 1105 | "constant": false, 1106 | "id": 21, 1107 | "name": "num", 1108 | "nodeType": "VariableDeclaration", 1109 | "scope": 33, 1110 | "src": "289:8:0", 1111 | "stateVariable": false, 1112 | "storageLocation": "default", 1113 | "typeDescriptions": { 1114 | "typeIdentifier": "t_uint256", 1115 | "typeString": "uint256" 1116 | }, 1117 | "typeName": { 1118 | "id": 20, 1119 | "name": "uint", 1120 | "nodeType": "ElementaryTypeName", 1121 | "src": "289:4:0", 1122 | "typeDescriptions": { 1123 | "typeIdentifier": "t_uint256", 1124 | "typeString": "uint256" 1125 | } 1126 | }, 1127 | "value": null, 1128 | "visibility": "internal" 1129 | } 1130 | ], 1131 | "src": "288:10:0" 1132 | }, 1133 | "payable": false, 1134 | "returnParameters": { 1135 | "id": 25, 1136 | "nodeType": "ParameterList", 1137 | "parameters": [ 1138 | { 1139 | "constant": false, 1140 | "id": 24, 1141 | "name": "", 1142 | "nodeType": "VariableDeclaration", 1143 | "scope": 33, 1144 | "src": "315:4:0", 1145 | "stateVariable": false, 1146 | "storageLocation": "default", 1147 | "typeDescriptions": { 1148 | "typeIdentifier": "t_uint256", 1149 | "typeString": "uint256" 1150 | }, 1151 | "typeName": { 1152 | "id": 23, 1153 | "name": "uint", 1154 | "nodeType": "ElementaryTypeName", 1155 | "src": "315:4:0", 1156 | "typeDescriptions": { 1157 | "typeIdentifier": "t_uint256", 1158 | "typeString": "uint256" 1159 | } 1160 | }, 1161 | "value": null, 1162 | "visibility": "internal" 1163 | } 1164 | ], 1165 | "src": "314:6:0" 1166 | }, 1167 | "scope": 64, 1168 | "src": "268:96:0", 1169 | "stateMutability": "nonpayable", 1170 | "superFunction": null, 1171 | "visibility": "public" 1172 | }, 1173 | { 1174 | "body": { 1175 | "id": 46, 1176 | "nodeType": "Block", 1177 | "src": "456:43:0", 1178 | "statements": [ 1179 | { 1180 | "expression": { 1181 | "argumentTypes": null, 1182 | "id": 42, 1183 | "isConstant": false, 1184 | "isLValue": false, 1185 | "isPure": false, 1186 | "lValueRequested": false, 1187 | "leftHandSide": { 1188 | "argumentTypes": null, 1189 | "id": 40, 1190 | "name": "result", 1191 | "nodeType": "Identifier", 1192 | "overloadedDeclarations": [], 1193 | "referencedDeclaration": 3, 1194 | "src": "462:6:0", 1195 | "typeDescriptions": { 1196 | "typeIdentifier": "t_uint256", 1197 | "typeString": "uint256" 1198 | } 1199 | }, 1200 | "nodeType": "Assignment", 1201 | "operator": "-=", 1202 | "rightHandSide": { 1203 | "argumentTypes": null, 1204 | "id": 41, 1205 | "name": "num", 1206 | "nodeType": "Identifier", 1207 | "overloadedDeclarations": [], 1208 | "referencedDeclaration": 35, 1209 | "src": "472:3:0", 1210 | "typeDescriptions": { 1211 | "typeIdentifier": "t_uint256", 1212 | "typeString": "uint256" 1213 | } 1214 | }, 1215 | "src": "462:13:0", 1216 | "typeDescriptions": { 1217 | "typeIdentifier": "t_uint256", 1218 | "typeString": "uint256" 1219 | } 1220 | }, 1221 | "id": 43, 1222 | "nodeType": "ExpressionStatement", 1223 | "src": "462:13:0" 1224 | }, 1225 | { 1226 | "expression": { 1227 | "argumentTypes": null, 1228 | "id": 44, 1229 | "name": "result", 1230 | "nodeType": "Identifier", 1231 | "overloadedDeclarations": [], 1232 | "referencedDeclaration": 3, 1233 | "src": "488:6:0", 1234 | "typeDescriptions": { 1235 | "typeIdentifier": "t_uint256", 1236 | "typeString": "uint256" 1237 | } 1238 | }, 1239 | "functionReturnParameters": 39, 1240 | "id": 45, 1241 | "nodeType": "Return", 1242 | "src": "481:13:0" 1243 | } 1244 | ] 1245 | }, 1246 | "id": 47, 1247 | "implemented": true, 1248 | "isConstructor": false, 1249 | "isDeclaredConst": false, 1250 | "modifiers": [], 1251 | "name": "substractFromNumber", 1252 | "nodeType": "FunctionDefinition", 1253 | "parameters": { 1254 | "id": 36, 1255 | "nodeType": "ParameterList", 1256 | "parameters": [ 1257 | { 1258 | "constant": false, 1259 | "id": 35, 1260 | "name": "num", 1261 | "nodeType": "VariableDeclaration", 1262 | "scope": 47, 1263 | "src": "424:8:0", 1264 | "stateVariable": false, 1265 | "storageLocation": "default", 1266 | "typeDescriptions": { 1267 | "typeIdentifier": "t_uint256", 1268 | "typeString": "uint256" 1269 | }, 1270 | "typeName": { 1271 | "id": 34, 1272 | "name": "uint", 1273 | "nodeType": "ElementaryTypeName", 1274 | "src": "424:4:0", 1275 | "typeDescriptions": { 1276 | "typeIdentifier": "t_uint256", 1277 | "typeString": "uint256" 1278 | } 1279 | }, 1280 | "value": null, 1281 | "visibility": "internal" 1282 | } 1283 | ], 1284 | "src": "423:10:0" 1285 | }, 1286 | "payable": false, 1287 | "returnParameters": { 1288 | "id": 39, 1289 | "nodeType": "ParameterList", 1290 | "parameters": [ 1291 | { 1292 | "constant": false, 1293 | "id": 38, 1294 | "name": "", 1295 | "nodeType": "VariableDeclaration", 1296 | "scope": 47, 1297 | "src": "450:4:0", 1298 | "stateVariable": false, 1299 | "storageLocation": "default", 1300 | "typeDescriptions": { 1301 | "typeIdentifier": "t_uint256", 1302 | "typeString": "uint256" 1303 | }, 1304 | "typeName": { 1305 | "id": 37, 1306 | "name": "uint", 1307 | "nodeType": "ElementaryTypeName", 1308 | "src": "450:4:0", 1309 | "typeDescriptions": { 1310 | "typeIdentifier": "t_uint256", 1311 | "typeString": "uint256" 1312 | } 1313 | }, 1314 | "value": null, 1315 | "visibility": "internal" 1316 | } 1317 | ], 1318 | "src": "449:6:0" 1319 | }, 1320 | "scope": 64, 1321 | "src": "395:104:0", 1322 | "stateMutability": "nonpayable", 1323 | "superFunction": null, 1324 | "visibility": "public" 1325 | }, 1326 | { 1327 | "body": { 1328 | "id": 54, 1329 | "nodeType": "Block", 1330 | "src": "587:24:0", 1331 | "statements": [ 1332 | { 1333 | "expression": { 1334 | "argumentTypes": null, 1335 | "id": 52, 1336 | "name": "result", 1337 | "nodeType": "Identifier", 1338 | "overloadedDeclarations": [], 1339 | "referencedDeclaration": 3, 1340 | "src": "600:6:0", 1341 | "typeDescriptions": { 1342 | "typeIdentifier": "t_uint256", 1343 | "typeString": "uint256" 1344 | } 1345 | }, 1346 | "functionReturnParameters": 51, 1347 | "id": 53, 1348 | "nodeType": "Return", 1349 | "src": "593:13:0" 1350 | } 1351 | ] 1352 | }, 1353 | "id": 55, 1354 | "implemented": true, 1355 | "isConstructor": false, 1356 | "isDeclaredConst": true, 1357 | "modifiers": [], 1358 | "name": "multiplyWithNumber", 1359 | "nodeType": "FunctionDefinition", 1360 | "parameters": { 1361 | "id": 48, 1362 | "nodeType": "ParameterList", 1363 | "parameters": [], 1364 | "src": "557:2:0" 1365 | }, 1366 | "payable": false, 1367 | "returnParameters": { 1368 | "id": 51, 1369 | "nodeType": "ParameterList", 1370 | "parameters": [ 1371 | { 1372 | "constant": false, 1373 | "id": 50, 1374 | "name": "", 1375 | "nodeType": "VariableDeclaration", 1376 | "scope": 55, 1377 | "src": "581:4:0", 1378 | "stateVariable": false, 1379 | "storageLocation": "default", 1380 | "typeDescriptions": { 1381 | "typeIdentifier": "t_uint256", 1382 | "typeString": "uint256" 1383 | }, 1384 | "typeName": { 1385 | "id": 49, 1386 | "name": "uint", 1387 | "nodeType": "ElementaryTypeName", 1388 | "src": "581:4:0", 1389 | "typeDescriptions": { 1390 | "typeIdentifier": "t_uint256", 1391 | "typeString": "uint256" 1392 | } 1393 | }, 1394 | "value": null, 1395 | "visibility": "internal" 1396 | } 1397 | ], 1398 | "src": "580:6:0" 1399 | }, 1400 | "scope": 64, 1401 | "src": "530:81:0", 1402 | "stateMutability": "view", 1403 | "superFunction": null, 1404 | "visibility": "public" 1405 | }, 1406 | { 1407 | "body": { 1408 | "id": 62, 1409 | "nodeType": "Block", 1410 | "src": "695:24:0", 1411 | "statements": [ 1412 | { 1413 | "expression": { 1414 | "argumentTypes": null, 1415 | "id": 60, 1416 | "name": "result", 1417 | "nodeType": "Identifier", 1418 | "overloadedDeclarations": [], 1419 | "referencedDeclaration": 3, 1420 | "src": "708:6:0", 1421 | "typeDescriptions": { 1422 | "typeIdentifier": "t_uint256", 1423 | "typeString": "uint256" 1424 | } 1425 | }, 1426 | "functionReturnParameters": 59, 1427 | "id": 61, 1428 | "nodeType": "Return", 1429 | "src": "701:13:0" 1430 | } 1431 | ] 1432 | }, 1433 | "id": 63, 1434 | "implemented": true, 1435 | "isConstructor": false, 1436 | "isDeclaredConst": true, 1437 | "modifiers": [], 1438 | "name": "divideNumberBy", 1439 | "nodeType": "FunctionDefinition", 1440 | "parameters": { 1441 | "id": 56, 1442 | "nodeType": "ParameterList", 1443 | "parameters": [], 1444 | "src": "665:2:0" 1445 | }, 1446 | "payable": false, 1447 | "returnParameters": { 1448 | "id": 59, 1449 | "nodeType": "ParameterList", 1450 | "parameters": [ 1451 | { 1452 | "constant": false, 1453 | "id": 58, 1454 | "name": "", 1455 | "nodeType": "VariableDeclaration", 1456 | "scope": 63, 1457 | "src": "689:4:0", 1458 | "stateVariable": false, 1459 | "storageLocation": "default", 1460 | "typeDescriptions": { 1461 | "typeIdentifier": "t_uint256", 1462 | "typeString": "uint256" 1463 | }, 1464 | "typeName": { 1465 | "id": 57, 1466 | "name": "uint", 1467 | "nodeType": "ElementaryTypeName", 1468 | "src": "689:4:0", 1469 | "typeDescriptions": { 1470 | "typeIdentifier": "t_uint256", 1471 | "typeString": "uint256" 1472 | } 1473 | }, 1474 | "value": null, 1475 | "visibility": "internal" 1476 | } 1477 | ], 1478 | "src": "688:6:0" 1479 | }, 1480 | "scope": 64, 1481 | "src": "642:77:0", 1482 | "stateMutability": "view", 1483 | "superFunction": null, 1484 | "visibility": "public" 1485 | } 1486 | ], 1487 | "scope": 65, 1488 | "src": "25:697:0" 1489 | } 1490 | ], 1491 | "src": "0:723:0" 1492 | }, 1493 | "compiler": { 1494 | "name": "solc", 1495 | "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" 1496 | }, 1497 | "networks": { 1498 | "5777": { 1499 | "events": {}, 1500 | "links": {}, 1501 | "address": "0x345ca3e014aaf5dca488057592ee47305d9b3e10", 1502 | "transactionHash": "0x928e583f5050d723d3e53c73f23b7e420c5a9d976af6d30dacf051a28cdd2043" 1503 | }, 1504 | "1494545119391": { 1505 | "events": {}, 1506 | "links": {}, 1507 | "address": "0xb4c292e07875d7ba98c95610cba3668a8567ad14", 1508 | "updated_at": 1494545632687 1509 | } 1510 | }, 1511 | "schemaVersion": "2.0.0", 1512 | "updatedAt": "2018-03-19T01:27:49.839Z" 1513 | } -------------------------------------------------------------------------------- /build/contracts/HelloEthereumString-ABI.json: -------------------------------------------------------------------------------- 1 | [{"constant":false,"inputs":[{"name":"name","type":"string"}],"name":"hello","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getNames","outputs":[{"name":"lastCaller","type":"string"},{"name":"callerName","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastCallerName","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"string"}],"name":"HelloInvoked","type":"event"}] 2 | -------------------------------------------------------------------------------- /build/contracts/HelloEthereumString.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "HelloEthereumString", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "lastCallerName", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "string" 12 | } 13 | ], 14 | "payable": false, 15 | "stateMutability": "view", 16 | "type": "function" 17 | }, 18 | { 19 | "inputs": [], 20 | "payable": false, 21 | "stateMutability": "nonpayable", 22 | "type": "constructor" 23 | }, 24 | { 25 | "anonymous": false, 26 | "inputs": [ 27 | { 28 | "indexed": true, 29 | "name": "name", 30 | "type": "string" 31 | } 32 | ], 33 | "name": "HelloInvoked", 34 | "type": "event" 35 | }, 36 | { 37 | "constant": false, 38 | "inputs": [ 39 | { 40 | "name": "name", 41 | "type": "string" 42 | } 43 | ], 44 | "name": "hello", 45 | "outputs": [], 46 | "payable": false, 47 | "stateMutability": "nonpayable", 48 | "type": "function" 49 | }, 50 | { 51 | "constant": true, 52 | "inputs": [], 53 | "name": "getNames", 54 | "outputs": [ 55 | { 56 | "name": "lastCaller", 57 | "type": "string" 58 | }, 59 | { 60 | "name": "callerName", 61 | "type": "string" 62 | } 63 | ], 64 | "payable": false, 65 | "stateMutability": "view", 66 | "type": "function" 67 | } 68 | ], 69 | "bytecode": "0x6060604052341561000f57600080fd5b6040805190810160405280600781526020017f6e6f742d736574000000000000000000000000000000000000000000000000008152506000908051906020019061005a929190610060565b50610105565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a157805160ff19168380011785556100cf565b828001600101855582156100cf579182015b828111156100ce5782518255916020019190600101906100b3565b5b5090506100dc91906100e0565b5090565b61010291905b808211156100fe5760008160009055506001016100e6565b5090565b90565b61064c806101146000396000f300606060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063a777d0dc1461005c578063cd838f0f146100b9578063e841737a146101b3575b600080fd5b341561006757600080fd5b6100b7600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610241565b005b34156100c457600080fd5b6100cc61033e565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156101105780820151818401526020810190506100f5565b50505050905090810190601f16801561013d5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101be57600080fd5b6101c66104c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102065780820151818401526020810190506101eb565b50505050905090810190601f1680156102335780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806040518082805190602001908083835b6020831015156102775780518252602082019150602081019050602083039250610252565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f84c1a0d0efe2d968c80240d80e524822f1e7a941a4e9426bb2896c023344092560405160405180910390a280600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190610323929190610567565b50806000908051906020019061033a929190610567565b5050565b6103466105e7565b61034e6105e7565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e45780601f106103b9576101008083540402835291602001916103e4565b820191906000526020600020905b8154815290600101906020018083116103c757829003601f168201915b50505050509150600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104be5780601f10610493576101008083540402835291602001916104be565b820191906000526020600020905b8154815290600101906020018083116104a157829003601f168201915b505050505090509091565b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055f5780601f106105345761010080835404028352916020019161055f565b820191906000526020600020905b81548152906001019060200180831161054257829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105a857805160ff19168380011785556105d6565b828001600101855582156105d6579182015b828111156105d55782518255916020019190600101906105ba565b5b5090506105e391906105fb565b5090565b602060405190810160405280600081525090565b61061d91905b80821115610619576000816000905550600101610601565b5090565b905600a165627a7a723058209640a99d165545db34d5bc60ef6433fb2daadbf990b482f9acca71de2f1eaf7e0029", 70 | "deployedBytecode": "0x606060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063a777d0dc1461005c578063cd838f0f146100b9578063e841737a146101b3575b600080fd5b341561006757600080fd5b6100b7600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610241565b005b34156100c457600080fd5b6100cc61033e565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156101105780820151818401526020810190506100f5565b50505050905090810190601f16801561013d5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101be57600080fd5b6101c66104c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102065780820151818401526020810190506101eb565b50505050905090810190601f1680156102335780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806040518082805190602001908083835b6020831015156102775780518252602082019150602081019050602083039250610252565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f84c1a0d0efe2d968c80240d80e524822f1e7a941a4e9426bb2896c023344092560405160405180910390a280600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190610323929190610567565b50806000908051906020019061033a929190610567565b5050565b6103466105e7565b61034e6105e7565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103e45780601f106103b9576101008083540402835291602001916103e4565b820191906000526020600020905b8154815290600101906020018083116103c757829003601f168201915b50505050509150600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104be5780601f10610493576101008083540402835291602001916104be565b820191906000526020600020905b8154815290600101906020018083116104a157829003601f168201915b505050505090509091565b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055f5780601f106105345761010080835404028352916020019161055f565b820191906000526020600020905b81548152906001019060200180831161054257829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106105a857805160ff19168380011785556105d6565b828001600101855582156105d6579182015b828111156105d55782518255916020019190600101906105ba565b5b5090506105e391906105fb565b5090565b602060405190810160405280600081525090565b61061d91905b80821115610619576000816000905550600101610601565b5090565b905600a165627a7a723058209640a99d165545db34d5bc60ef6433fb2daadbf990b482f9acca71de2f1eaf7e0029", 71 | "sourceMap": "25:1159:2:-;;;437:94;;;;;;;;500:26;;;;;;;;;;;;;;;;;;:14;:26;;;;;;;;;;;;:::i;:::-;;25:1159;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", 72 | "deployedSourceMap": "25:1159:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;689:209;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1013:169;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;208:29:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;689:209:2;768:4;755:18;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:2;51:6;36:153;;;182:3;176:5;171:3;164:6;98:2;93:3;89;82:19;;123:2;118:3;114;107:19;;148:2;143:3;139;132:19;;36:153;;;274:1;267:3;263:2;259:3;254;250;246;315:4;311:3;305;299:5;295:3;356:4;350:3;344:5;340:3;389:7;380;377:2;372:3;365:6;3:399;;;;;;;;;;;;;;;;;;;;;;;;;;;;;829:4:2;802:12;:24;815:10;802:24;;;;;;;;;;;;;;;:31;;;;;;;;;;;;:::i;:::-;;889:4;872:14;:21;;;;;;;;;;;;:::i;:::-;;689:209;:::o;1013:169::-;1059:17;;:::i;:::-;1078;;:::i;:::-;1115:14;1102:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1148:12;:24;1161:10;1148:24;;;;;;;;;;;;;;;1135:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1013:169;;:::o;208:29::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;25:1159::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", 73 | "source": "pragma solidity ^0.4.4;\n\ncontract HelloEthereumString {\n\n // Storage variable for holding last caller\n // Declaring a storage variable public leads to\n // Automatic generation of getter lastCallerName()\n string public lastCallerName;\n\n // Storage variable for holding the \n mapping(address => string) addressNames;\n\n // Event gets emitted everytime someone calls the hello function\n event HelloInvoked(string indexed name);\n\n function HelloEthereumString() public {\n // constructor\n lastCallerName = 'not-set';\n }\n\n /**\n * Receives a string of 32 bytes\n * 1. Generates an event \n * 2. Adds the address-name to the mapping\n * 3. Set the last caller name\n **/\n function hello(string name) public {\n // Invoke the event\n HelloInvoked(name);\n\n // Add to mapping\n addressNames[msg.sender] = name;\n\n // Set the last caller name\n lastCallerName = name;\n }\n\n /**\n * Return 2 values\n * 1. Last Caller Name\n * 2. Caller's name if it is there in the mapping\n **/\n function getNames() public constant returns (string lastCaller, string callerName){\n lastCaller = lastCallerName;\n callerName = addressNames[msg.sender];\n \n }\n}\n", 74 | "sourcePath": "C:\\Users\\Rajeev\\Documents\\Course\\Blockchain Course\\workspace\\Blockchain-Course-Calculator\\contracts\\HelloEthereumString.sol", 75 | "ast": { 76 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/HelloEthereumString.sol", 77 | "exportedSymbols": { 78 | "HelloEthereumString": [ 79 | 236 80 | ] 81 | }, 82 | "id": 237, 83 | "nodeType": "SourceUnit", 84 | "nodes": [ 85 | { 86 | "id": 177, 87 | "literals": [ 88 | "solidity", 89 | "^", 90 | "0.4", 91 | ".4" 92 | ], 93 | "nodeType": "PragmaDirective", 94 | "src": "0:23:2" 95 | }, 96 | { 97 | "baseContracts": [], 98 | "contractDependencies": [], 99 | "contractKind": "contract", 100 | "documentation": null, 101 | "fullyImplemented": true, 102 | "id": 236, 103 | "linearizedBaseContracts": [ 104 | 236 105 | ], 106 | "name": "HelloEthereumString", 107 | "nodeType": "ContractDefinition", 108 | "nodes": [ 109 | { 110 | "constant": false, 111 | "id": 179, 112 | "name": "lastCallerName", 113 | "nodeType": "VariableDeclaration", 114 | "scope": 236, 115 | "src": "208:29:2", 116 | "stateVariable": true, 117 | "storageLocation": "default", 118 | "typeDescriptions": { 119 | "typeIdentifier": "t_string_storage", 120 | "typeString": "string storage ref" 121 | }, 122 | "typeName": { 123 | "id": 178, 124 | "name": "string", 125 | "nodeType": "ElementaryTypeName", 126 | "src": "208:6:2", 127 | "typeDescriptions": { 128 | "typeIdentifier": "t_string_storage_ptr", 129 | "typeString": "string storage pointer" 130 | } 131 | }, 132 | "value": null, 133 | "visibility": "public" 134 | }, 135 | { 136 | "constant": false, 137 | "id": 183, 138 | "name": "addressNames", 139 | "nodeType": "VariableDeclaration", 140 | "scope": 236, 141 | "src": "281:40:2", 142 | "stateVariable": true, 143 | "storageLocation": "default", 144 | "typeDescriptions": { 145 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 146 | "typeString": "mapping(address => string storage ref)" 147 | }, 148 | "typeName": { 149 | "id": 182, 150 | "keyType": { 151 | "id": 180, 152 | "name": "address", 153 | "nodeType": "ElementaryTypeName", 154 | "src": "289:7:2", 155 | "typeDescriptions": { 156 | "typeIdentifier": "t_address", 157 | "typeString": "address" 158 | } 159 | }, 160 | "nodeType": "Mapping", 161 | "src": "281:26:2", 162 | "typeDescriptions": { 163 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 164 | "typeString": "mapping(address => string storage ref)" 165 | }, 166 | "valueType": { 167 | "id": 181, 168 | "name": "string", 169 | "nodeType": "ElementaryTypeName", 170 | "src": "300:6:2", 171 | "typeDescriptions": { 172 | "typeIdentifier": "t_string_storage_ptr", 173 | "typeString": "string storage pointer" 174 | } 175 | } 176 | }, 177 | "value": null, 178 | "visibility": "internal" 179 | }, 180 | { 181 | "anonymous": false, 182 | "id": 187, 183 | "name": "HelloInvoked", 184 | "nodeType": "EventDefinition", 185 | "parameters": { 186 | "id": 186, 187 | "nodeType": "ParameterList", 188 | "parameters": [ 189 | { 190 | "constant": false, 191 | "id": 185, 192 | "indexed": true, 193 | "name": "name", 194 | "nodeType": "VariableDeclaration", 195 | "scope": 187, 196 | "src": "412:19:2", 197 | "stateVariable": false, 198 | "storageLocation": "default", 199 | "typeDescriptions": { 200 | "typeIdentifier": "t_string_memory_ptr", 201 | "typeString": "string memory" 202 | }, 203 | "typeName": { 204 | "id": 184, 205 | "name": "string", 206 | "nodeType": "ElementaryTypeName", 207 | "src": "412:6:2", 208 | "typeDescriptions": { 209 | "typeIdentifier": "t_string_storage_ptr", 210 | "typeString": "string storage pointer" 211 | } 212 | }, 213 | "value": null, 214 | "visibility": "internal" 215 | } 216 | ], 217 | "src": "411:21:2" 218 | }, 219 | "src": "393:40:2" 220 | }, 221 | { 222 | "body": { 223 | "id": 194, 224 | "nodeType": "Block", 225 | "src": "475:56:2", 226 | "statements": [ 227 | { 228 | "expression": { 229 | "argumentTypes": null, 230 | "id": 192, 231 | "isConstant": false, 232 | "isLValue": false, 233 | "isPure": false, 234 | "lValueRequested": false, 235 | "leftHandSide": { 236 | "argumentTypes": null, 237 | "id": 190, 238 | "name": "lastCallerName", 239 | "nodeType": "Identifier", 240 | "overloadedDeclarations": [], 241 | "referencedDeclaration": 179, 242 | "src": "500:14:2", 243 | "typeDescriptions": { 244 | "typeIdentifier": "t_string_storage", 245 | "typeString": "string storage ref" 246 | } 247 | }, 248 | "nodeType": "Assignment", 249 | "operator": "=", 250 | "rightHandSide": { 251 | "argumentTypes": null, 252 | "hexValue": "6e6f742d736574", 253 | "id": 191, 254 | "isConstant": false, 255 | "isLValue": false, 256 | "isPure": true, 257 | "kind": "string", 258 | "lValueRequested": false, 259 | "nodeType": "Literal", 260 | "src": "517:9:2", 261 | "subdenomination": null, 262 | "typeDescriptions": { 263 | "typeIdentifier": "t_stringliteral_d58e0eb109afb82b995f4f9e0e282b98a25339703eded407f6a5c173d891c3a7", 264 | "typeString": "literal_string \"not-set\"" 265 | }, 266 | "value": "not-set" 267 | }, 268 | "src": "500:26:2", 269 | "typeDescriptions": { 270 | "typeIdentifier": "t_string_storage", 271 | "typeString": "string storage ref" 272 | } 273 | }, 274 | "id": 193, 275 | "nodeType": "ExpressionStatement", 276 | "src": "500:26:2" 277 | } 278 | ] 279 | }, 280 | "id": 195, 281 | "implemented": true, 282 | "isConstructor": true, 283 | "isDeclaredConst": false, 284 | "modifiers": [], 285 | "name": "HelloEthereumString", 286 | "nodeType": "FunctionDefinition", 287 | "parameters": { 288 | "id": 188, 289 | "nodeType": "ParameterList", 290 | "parameters": [], 291 | "src": "465:2:2" 292 | }, 293 | "payable": false, 294 | "returnParameters": { 295 | "id": 189, 296 | "nodeType": "ParameterList", 297 | "parameters": [], 298 | "src": "475:0:2" 299 | }, 300 | "scope": 236, 301 | "src": "437:94:2", 302 | "stateMutability": "nonpayable", 303 | "superFunction": null, 304 | "visibility": "public" 305 | }, 306 | { 307 | "body": { 308 | "id": 215, 309 | "nodeType": "Block", 310 | "src": "725:173:2", 311 | "statements": [ 312 | { 313 | "expression": { 314 | "argumentTypes": null, 315 | "arguments": [ 316 | { 317 | "argumentTypes": null, 318 | "id": 201, 319 | "name": "name", 320 | "nodeType": "Identifier", 321 | "overloadedDeclarations": [], 322 | "referencedDeclaration": 197, 323 | "src": "768:4:2", 324 | "typeDescriptions": { 325 | "typeIdentifier": "t_string_memory_ptr", 326 | "typeString": "string memory" 327 | } 328 | } 329 | ], 330 | "expression": { 331 | "argumentTypes": [ 332 | { 333 | "typeIdentifier": "t_string_memory_ptr", 334 | "typeString": "string memory" 335 | } 336 | ], 337 | "id": 200, 338 | "name": "HelloInvoked", 339 | "nodeType": "Identifier", 340 | "overloadedDeclarations": [], 341 | "referencedDeclaration": 187, 342 | "src": "755:12:2", 343 | "typeDescriptions": { 344 | "typeIdentifier": "t_function_event_nonpayable$_t_string_memory_ptr_$returns$__$", 345 | "typeString": "function (string memory)" 346 | } 347 | }, 348 | "id": 202, 349 | "isConstant": false, 350 | "isLValue": false, 351 | "isPure": false, 352 | "kind": "functionCall", 353 | "lValueRequested": false, 354 | "names": [], 355 | "nodeType": "FunctionCall", 356 | "src": "755:18:2", 357 | "typeDescriptions": { 358 | "typeIdentifier": "t_tuple$__$", 359 | "typeString": "tuple()" 360 | } 361 | }, 362 | "id": 203, 363 | "nodeType": "ExpressionStatement", 364 | "src": "755:18:2" 365 | }, 366 | { 367 | "expression": { 368 | "argumentTypes": null, 369 | "id": 209, 370 | "isConstant": false, 371 | "isLValue": false, 372 | "isPure": false, 373 | "lValueRequested": false, 374 | "leftHandSide": { 375 | "argumentTypes": null, 376 | "baseExpression": { 377 | "argumentTypes": null, 378 | "id": 204, 379 | "name": "addressNames", 380 | "nodeType": "Identifier", 381 | "overloadedDeclarations": [], 382 | "referencedDeclaration": 183, 383 | "src": "802:12:2", 384 | "typeDescriptions": { 385 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 386 | "typeString": "mapping(address => string storage ref)" 387 | } 388 | }, 389 | "id": 207, 390 | "indexExpression": { 391 | "argumentTypes": null, 392 | "expression": { 393 | "argumentTypes": null, 394 | "id": 205, 395 | "name": "msg", 396 | "nodeType": "Identifier", 397 | "overloadedDeclarations": [], 398 | "referencedDeclaration": 377, 399 | "src": "815:3:2", 400 | "typeDescriptions": { 401 | "typeIdentifier": "t_magic_message", 402 | "typeString": "msg" 403 | } 404 | }, 405 | "id": 206, 406 | "isConstant": false, 407 | "isLValue": false, 408 | "isPure": false, 409 | "lValueRequested": false, 410 | "memberName": "sender", 411 | "nodeType": "MemberAccess", 412 | "referencedDeclaration": null, 413 | "src": "815:10:2", 414 | "typeDescriptions": { 415 | "typeIdentifier": "t_address", 416 | "typeString": "address" 417 | } 418 | }, 419 | "isConstant": false, 420 | "isLValue": true, 421 | "isPure": false, 422 | "lValueRequested": true, 423 | "nodeType": "IndexAccess", 424 | "src": "802:24:2", 425 | "typeDescriptions": { 426 | "typeIdentifier": "t_string_storage", 427 | "typeString": "string storage ref" 428 | } 429 | }, 430 | "nodeType": "Assignment", 431 | "operator": "=", 432 | "rightHandSide": { 433 | "argumentTypes": null, 434 | "id": 208, 435 | "name": "name", 436 | "nodeType": "Identifier", 437 | "overloadedDeclarations": [], 438 | "referencedDeclaration": 197, 439 | "src": "829:4:2", 440 | "typeDescriptions": { 441 | "typeIdentifier": "t_string_memory_ptr", 442 | "typeString": "string memory" 443 | } 444 | }, 445 | "src": "802:31:2", 446 | "typeDescriptions": { 447 | "typeIdentifier": "t_string_storage", 448 | "typeString": "string storage ref" 449 | } 450 | }, 451 | "id": 210, 452 | "nodeType": "ExpressionStatement", 453 | "src": "802:31:2" 454 | }, 455 | { 456 | "expression": { 457 | "argumentTypes": null, 458 | "id": 213, 459 | "isConstant": false, 460 | "isLValue": false, 461 | "isPure": false, 462 | "lValueRequested": false, 463 | "leftHandSide": { 464 | "argumentTypes": null, 465 | "id": 211, 466 | "name": "lastCallerName", 467 | "nodeType": "Identifier", 468 | "overloadedDeclarations": [], 469 | "referencedDeclaration": 179, 470 | "src": "872:14:2", 471 | "typeDescriptions": { 472 | "typeIdentifier": "t_string_storage", 473 | "typeString": "string storage ref" 474 | } 475 | }, 476 | "nodeType": "Assignment", 477 | "operator": "=", 478 | "rightHandSide": { 479 | "argumentTypes": null, 480 | "id": 212, 481 | "name": "name", 482 | "nodeType": "Identifier", 483 | "overloadedDeclarations": [], 484 | "referencedDeclaration": 197, 485 | "src": "889:4:2", 486 | "typeDescriptions": { 487 | "typeIdentifier": "t_string_memory_ptr", 488 | "typeString": "string memory" 489 | } 490 | }, 491 | "src": "872:21:2", 492 | "typeDescriptions": { 493 | "typeIdentifier": "t_string_storage", 494 | "typeString": "string storage ref" 495 | } 496 | }, 497 | "id": 214, 498 | "nodeType": "ExpressionStatement", 499 | "src": "872:21:2" 500 | } 501 | ] 502 | }, 503 | "id": 216, 504 | "implemented": true, 505 | "isConstructor": false, 506 | "isDeclaredConst": false, 507 | "modifiers": [], 508 | "name": "hello", 509 | "nodeType": "FunctionDefinition", 510 | "parameters": { 511 | "id": 198, 512 | "nodeType": "ParameterList", 513 | "parameters": [ 514 | { 515 | "constant": false, 516 | "id": 197, 517 | "name": "name", 518 | "nodeType": "VariableDeclaration", 519 | "scope": 216, 520 | "src": "705:11:2", 521 | "stateVariable": false, 522 | "storageLocation": "default", 523 | "typeDescriptions": { 524 | "typeIdentifier": "t_string_memory_ptr", 525 | "typeString": "string memory" 526 | }, 527 | "typeName": { 528 | "id": 196, 529 | "name": "string", 530 | "nodeType": "ElementaryTypeName", 531 | "src": "705:6:2", 532 | "typeDescriptions": { 533 | "typeIdentifier": "t_string_storage_ptr", 534 | "typeString": "string storage pointer" 535 | } 536 | }, 537 | "value": null, 538 | "visibility": "internal" 539 | } 540 | ], 541 | "src": "704:13:2" 542 | }, 543 | "payable": false, 544 | "returnParameters": { 545 | "id": 199, 546 | "nodeType": "ParameterList", 547 | "parameters": [], 548 | "src": "725:0:2" 549 | }, 550 | "scope": 236, 551 | "src": "689:209:2", 552 | "stateMutability": "nonpayable", 553 | "superFunction": null, 554 | "visibility": "public" 555 | }, 556 | { 557 | "body": { 558 | "id": 234, 559 | "nodeType": "Block", 560 | "src": "1096:86:2", 561 | "statements": [ 562 | { 563 | "expression": { 564 | "argumentTypes": null, 565 | "id": 225, 566 | "isConstant": false, 567 | "isLValue": false, 568 | "isPure": false, 569 | "lValueRequested": false, 570 | "leftHandSide": { 571 | "argumentTypes": null, 572 | "id": 223, 573 | "name": "lastCaller", 574 | "nodeType": "Identifier", 575 | "overloadedDeclarations": [], 576 | "referencedDeclaration": 219, 577 | "src": "1102:10:2", 578 | "typeDescriptions": { 579 | "typeIdentifier": "t_string_memory_ptr", 580 | "typeString": "string memory" 581 | } 582 | }, 583 | "nodeType": "Assignment", 584 | "operator": "=", 585 | "rightHandSide": { 586 | "argumentTypes": null, 587 | "id": 224, 588 | "name": "lastCallerName", 589 | "nodeType": "Identifier", 590 | "overloadedDeclarations": [], 591 | "referencedDeclaration": 179, 592 | "src": "1115:14:2", 593 | "typeDescriptions": { 594 | "typeIdentifier": "t_string_storage", 595 | "typeString": "string storage ref" 596 | } 597 | }, 598 | "src": "1102:27:2", 599 | "typeDescriptions": { 600 | "typeIdentifier": "t_string_memory_ptr", 601 | "typeString": "string memory" 602 | } 603 | }, 604 | "id": 226, 605 | "nodeType": "ExpressionStatement", 606 | "src": "1102:27:2" 607 | }, 608 | { 609 | "expression": { 610 | "argumentTypes": null, 611 | "id": 232, 612 | "isConstant": false, 613 | "isLValue": false, 614 | "isPure": false, 615 | "lValueRequested": false, 616 | "leftHandSide": { 617 | "argumentTypes": null, 618 | "id": 227, 619 | "name": "callerName", 620 | "nodeType": "Identifier", 621 | "overloadedDeclarations": [], 622 | "referencedDeclaration": 221, 623 | "src": "1135:10:2", 624 | "typeDescriptions": { 625 | "typeIdentifier": "t_string_memory_ptr", 626 | "typeString": "string memory" 627 | } 628 | }, 629 | "nodeType": "Assignment", 630 | "operator": "=", 631 | "rightHandSide": { 632 | "argumentTypes": null, 633 | "baseExpression": { 634 | "argumentTypes": null, 635 | "id": 228, 636 | "name": "addressNames", 637 | "nodeType": "Identifier", 638 | "overloadedDeclarations": [], 639 | "referencedDeclaration": 183, 640 | "src": "1148:12:2", 641 | "typeDescriptions": { 642 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 643 | "typeString": "mapping(address => string storage ref)" 644 | } 645 | }, 646 | "id": 231, 647 | "indexExpression": { 648 | "argumentTypes": null, 649 | "expression": { 650 | "argumentTypes": null, 651 | "id": 229, 652 | "name": "msg", 653 | "nodeType": "Identifier", 654 | "overloadedDeclarations": [], 655 | "referencedDeclaration": 377, 656 | "src": "1161:3:2", 657 | "typeDescriptions": { 658 | "typeIdentifier": "t_magic_message", 659 | "typeString": "msg" 660 | } 661 | }, 662 | "id": 230, 663 | "isConstant": false, 664 | "isLValue": false, 665 | "isPure": false, 666 | "lValueRequested": false, 667 | "memberName": "sender", 668 | "nodeType": "MemberAccess", 669 | "referencedDeclaration": null, 670 | "src": "1161:10:2", 671 | "typeDescriptions": { 672 | "typeIdentifier": "t_address", 673 | "typeString": "address" 674 | } 675 | }, 676 | "isConstant": false, 677 | "isLValue": true, 678 | "isPure": false, 679 | "lValueRequested": false, 680 | "nodeType": "IndexAccess", 681 | "src": "1148:24:2", 682 | "typeDescriptions": { 683 | "typeIdentifier": "t_string_storage", 684 | "typeString": "string storage ref" 685 | } 686 | }, 687 | "src": "1135:37:2", 688 | "typeDescriptions": { 689 | "typeIdentifier": "t_string_memory_ptr", 690 | "typeString": "string memory" 691 | } 692 | }, 693 | "id": 233, 694 | "nodeType": "ExpressionStatement", 695 | "src": "1135:37:2" 696 | } 697 | ] 698 | }, 699 | "id": 235, 700 | "implemented": true, 701 | "isConstructor": false, 702 | "isDeclaredConst": true, 703 | "modifiers": [], 704 | "name": "getNames", 705 | "nodeType": "FunctionDefinition", 706 | "parameters": { 707 | "id": 217, 708 | "nodeType": "ParameterList", 709 | "parameters": [], 710 | "src": "1031:2:2" 711 | }, 712 | "payable": false, 713 | "returnParameters": { 714 | "id": 222, 715 | "nodeType": "ParameterList", 716 | "parameters": [ 717 | { 718 | "constant": false, 719 | "id": 219, 720 | "name": "lastCaller", 721 | "nodeType": "VariableDeclaration", 722 | "scope": 235, 723 | "src": "1059:17:2", 724 | "stateVariable": false, 725 | "storageLocation": "default", 726 | "typeDescriptions": { 727 | "typeIdentifier": "t_string_memory_ptr", 728 | "typeString": "string memory" 729 | }, 730 | "typeName": { 731 | "id": 218, 732 | "name": "string", 733 | "nodeType": "ElementaryTypeName", 734 | "src": "1059:6:2", 735 | "typeDescriptions": { 736 | "typeIdentifier": "t_string_storage_ptr", 737 | "typeString": "string storage pointer" 738 | } 739 | }, 740 | "value": null, 741 | "visibility": "internal" 742 | }, 743 | { 744 | "constant": false, 745 | "id": 221, 746 | "name": "callerName", 747 | "nodeType": "VariableDeclaration", 748 | "scope": 235, 749 | "src": "1078:17:2", 750 | "stateVariable": false, 751 | "storageLocation": "default", 752 | "typeDescriptions": { 753 | "typeIdentifier": "t_string_memory_ptr", 754 | "typeString": "string memory" 755 | }, 756 | "typeName": { 757 | "id": 220, 758 | "name": "string", 759 | "nodeType": "ElementaryTypeName", 760 | "src": "1078:6:2", 761 | "typeDescriptions": { 762 | "typeIdentifier": "t_string_storage_ptr", 763 | "typeString": "string storage pointer" 764 | } 765 | }, 766 | "value": null, 767 | "visibility": "internal" 768 | } 769 | ], 770 | "src": "1058:38:2" 771 | }, 772 | "scope": 236, 773 | "src": "1013:169:2", 774 | "stateMutability": "view", 775 | "superFunction": null, 776 | "visibility": "public" 777 | } 778 | ], 779 | "scope": 237, 780 | "src": "25:1159:2" 781 | } 782 | ], 783 | "src": "0:1185:2" 784 | }, 785 | "legacyAST": { 786 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/HelloEthereumString.sol", 787 | "exportedSymbols": { 788 | "HelloEthereumString": [ 789 | 236 790 | ] 791 | }, 792 | "id": 237, 793 | "nodeType": "SourceUnit", 794 | "nodes": [ 795 | { 796 | "id": 177, 797 | "literals": [ 798 | "solidity", 799 | "^", 800 | "0.4", 801 | ".4" 802 | ], 803 | "nodeType": "PragmaDirective", 804 | "src": "0:23:2" 805 | }, 806 | { 807 | "baseContracts": [], 808 | "contractDependencies": [], 809 | "contractKind": "contract", 810 | "documentation": null, 811 | "fullyImplemented": true, 812 | "id": 236, 813 | "linearizedBaseContracts": [ 814 | 236 815 | ], 816 | "name": "HelloEthereumString", 817 | "nodeType": "ContractDefinition", 818 | "nodes": [ 819 | { 820 | "constant": false, 821 | "id": 179, 822 | "name": "lastCallerName", 823 | "nodeType": "VariableDeclaration", 824 | "scope": 236, 825 | "src": "208:29:2", 826 | "stateVariable": true, 827 | "storageLocation": "default", 828 | "typeDescriptions": { 829 | "typeIdentifier": "t_string_storage", 830 | "typeString": "string storage ref" 831 | }, 832 | "typeName": { 833 | "id": 178, 834 | "name": "string", 835 | "nodeType": "ElementaryTypeName", 836 | "src": "208:6:2", 837 | "typeDescriptions": { 838 | "typeIdentifier": "t_string_storage_ptr", 839 | "typeString": "string storage pointer" 840 | } 841 | }, 842 | "value": null, 843 | "visibility": "public" 844 | }, 845 | { 846 | "constant": false, 847 | "id": 183, 848 | "name": "addressNames", 849 | "nodeType": "VariableDeclaration", 850 | "scope": 236, 851 | "src": "281:40:2", 852 | "stateVariable": true, 853 | "storageLocation": "default", 854 | "typeDescriptions": { 855 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 856 | "typeString": "mapping(address => string storage ref)" 857 | }, 858 | "typeName": { 859 | "id": 182, 860 | "keyType": { 861 | "id": 180, 862 | "name": "address", 863 | "nodeType": "ElementaryTypeName", 864 | "src": "289:7:2", 865 | "typeDescriptions": { 866 | "typeIdentifier": "t_address", 867 | "typeString": "address" 868 | } 869 | }, 870 | "nodeType": "Mapping", 871 | "src": "281:26:2", 872 | "typeDescriptions": { 873 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 874 | "typeString": "mapping(address => string storage ref)" 875 | }, 876 | "valueType": { 877 | "id": 181, 878 | "name": "string", 879 | "nodeType": "ElementaryTypeName", 880 | "src": "300:6:2", 881 | "typeDescriptions": { 882 | "typeIdentifier": "t_string_storage_ptr", 883 | "typeString": "string storage pointer" 884 | } 885 | } 886 | }, 887 | "value": null, 888 | "visibility": "internal" 889 | }, 890 | { 891 | "anonymous": false, 892 | "id": 187, 893 | "name": "HelloInvoked", 894 | "nodeType": "EventDefinition", 895 | "parameters": { 896 | "id": 186, 897 | "nodeType": "ParameterList", 898 | "parameters": [ 899 | { 900 | "constant": false, 901 | "id": 185, 902 | "indexed": true, 903 | "name": "name", 904 | "nodeType": "VariableDeclaration", 905 | "scope": 187, 906 | "src": "412:19:2", 907 | "stateVariable": false, 908 | "storageLocation": "default", 909 | "typeDescriptions": { 910 | "typeIdentifier": "t_string_memory_ptr", 911 | "typeString": "string memory" 912 | }, 913 | "typeName": { 914 | "id": 184, 915 | "name": "string", 916 | "nodeType": "ElementaryTypeName", 917 | "src": "412:6:2", 918 | "typeDescriptions": { 919 | "typeIdentifier": "t_string_storage_ptr", 920 | "typeString": "string storage pointer" 921 | } 922 | }, 923 | "value": null, 924 | "visibility": "internal" 925 | } 926 | ], 927 | "src": "411:21:2" 928 | }, 929 | "src": "393:40:2" 930 | }, 931 | { 932 | "body": { 933 | "id": 194, 934 | "nodeType": "Block", 935 | "src": "475:56:2", 936 | "statements": [ 937 | { 938 | "expression": { 939 | "argumentTypes": null, 940 | "id": 192, 941 | "isConstant": false, 942 | "isLValue": false, 943 | "isPure": false, 944 | "lValueRequested": false, 945 | "leftHandSide": { 946 | "argumentTypes": null, 947 | "id": 190, 948 | "name": "lastCallerName", 949 | "nodeType": "Identifier", 950 | "overloadedDeclarations": [], 951 | "referencedDeclaration": 179, 952 | "src": "500:14:2", 953 | "typeDescriptions": { 954 | "typeIdentifier": "t_string_storage", 955 | "typeString": "string storage ref" 956 | } 957 | }, 958 | "nodeType": "Assignment", 959 | "operator": "=", 960 | "rightHandSide": { 961 | "argumentTypes": null, 962 | "hexValue": "6e6f742d736574", 963 | "id": 191, 964 | "isConstant": false, 965 | "isLValue": false, 966 | "isPure": true, 967 | "kind": "string", 968 | "lValueRequested": false, 969 | "nodeType": "Literal", 970 | "src": "517:9:2", 971 | "subdenomination": null, 972 | "typeDescriptions": { 973 | "typeIdentifier": "t_stringliteral_d58e0eb109afb82b995f4f9e0e282b98a25339703eded407f6a5c173d891c3a7", 974 | "typeString": "literal_string \"not-set\"" 975 | }, 976 | "value": "not-set" 977 | }, 978 | "src": "500:26:2", 979 | "typeDescriptions": { 980 | "typeIdentifier": "t_string_storage", 981 | "typeString": "string storage ref" 982 | } 983 | }, 984 | "id": 193, 985 | "nodeType": "ExpressionStatement", 986 | "src": "500:26:2" 987 | } 988 | ] 989 | }, 990 | "id": 195, 991 | "implemented": true, 992 | "isConstructor": true, 993 | "isDeclaredConst": false, 994 | "modifiers": [], 995 | "name": "HelloEthereumString", 996 | "nodeType": "FunctionDefinition", 997 | "parameters": { 998 | "id": 188, 999 | "nodeType": "ParameterList", 1000 | "parameters": [], 1001 | "src": "465:2:2" 1002 | }, 1003 | "payable": false, 1004 | "returnParameters": { 1005 | "id": 189, 1006 | "nodeType": "ParameterList", 1007 | "parameters": [], 1008 | "src": "475:0:2" 1009 | }, 1010 | "scope": 236, 1011 | "src": "437:94:2", 1012 | "stateMutability": "nonpayable", 1013 | "superFunction": null, 1014 | "visibility": "public" 1015 | }, 1016 | { 1017 | "body": { 1018 | "id": 215, 1019 | "nodeType": "Block", 1020 | "src": "725:173:2", 1021 | "statements": [ 1022 | { 1023 | "expression": { 1024 | "argumentTypes": null, 1025 | "arguments": [ 1026 | { 1027 | "argumentTypes": null, 1028 | "id": 201, 1029 | "name": "name", 1030 | "nodeType": "Identifier", 1031 | "overloadedDeclarations": [], 1032 | "referencedDeclaration": 197, 1033 | "src": "768:4:2", 1034 | "typeDescriptions": { 1035 | "typeIdentifier": "t_string_memory_ptr", 1036 | "typeString": "string memory" 1037 | } 1038 | } 1039 | ], 1040 | "expression": { 1041 | "argumentTypes": [ 1042 | { 1043 | "typeIdentifier": "t_string_memory_ptr", 1044 | "typeString": "string memory" 1045 | } 1046 | ], 1047 | "id": 200, 1048 | "name": "HelloInvoked", 1049 | "nodeType": "Identifier", 1050 | "overloadedDeclarations": [], 1051 | "referencedDeclaration": 187, 1052 | "src": "755:12:2", 1053 | "typeDescriptions": { 1054 | "typeIdentifier": "t_function_event_nonpayable$_t_string_memory_ptr_$returns$__$", 1055 | "typeString": "function (string memory)" 1056 | } 1057 | }, 1058 | "id": 202, 1059 | "isConstant": false, 1060 | "isLValue": false, 1061 | "isPure": false, 1062 | "kind": "functionCall", 1063 | "lValueRequested": false, 1064 | "names": [], 1065 | "nodeType": "FunctionCall", 1066 | "src": "755:18:2", 1067 | "typeDescriptions": { 1068 | "typeIdentifier": "t_tuple$__$", 1069 | "typeString": "tuple()" 1070 | } 1071 | }, 1072 | "id": 203, 1073 | "nodeType": "ExpressionStatement", 1074 | "src": "755:18:2" 1075 | }, 1076 | { 1077 | "expression": { 1078 | "argumentTypes": null, 1079 | "id": 209, 1080 | "isConstant": false, 1081 | "isLValue": false, 1082 | "isPure": false, 1083 | "lValueRequested": false, 1084 | "leftHandSide": { 1085 | "argumentTypes": null, 1086 | "baseExpression": { 1087 | "argumentTypes": null, 1088 | "id": 204, 1089 | "name": "addressNames", 1090 | "nodeType": "Identifier", 1091 | "overloadedDeclarations": [], 1092 | "referencedDeclaration": 183, 1093 | "src": "802:12:2", 1094 | "typeDescriptions": { 1095 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 1096 | "typeString": "mapping(address => string storage ref)" 1097 | } 1098 | }, 1099 | "id": 207, 1100 | "indexExpression": { 1101 | "argumentTypes": null, 1102 | "expression": { 1103 | "argumentTypes": null, 1104 | "id": 205, 1105 | "name": "msg", 1106 | "nodeType": "Identifier", 1107 | "overloadedDeclarations": [], 1108 | "referencedDeclaration": 377, 1109 | "src": "815:3:2", 1110 | "typeDescriptions": { 1111 | "typeIdentifier": "t_magic_message", 1112 | "typeString": "msg" 1113 | } 1114 | }, 1115 | "id": 206, 1116 | "isConstant": false, 1117 | "isLValue": false, 1118 | "isPure": false, 1119 | "lValueRequested": false, 1120 | "memberName": "sender", 1121 | "nodeType": "MemberAccess", 1122 | "referencedDeclaration": null, 1123 | "src": "815:10:2", 1124 | "typeDescriptions": { 1125 | "typeIdentifier": "t_address", 1126 | "typeString": "address" 1127 | } 1128 | }, 1129 | "isConstant": false, 1130 | "isLValue": true, 1131 | "isPure": false, 1132 | "lValueRequested": true, 1133 | "nodeType": "IndexAccess", 1134 | "src": "802:24:2", 1135 | "typeDescriptions": { 1136 | "typeIdentifier": "t_string_storage", 1137 | "typeString": "string storage ref" 1138 | } 1139 | }, 1140 | "nodeType": "Assignment", 1141 | "operator": "=", 1142 | "rightHandSide": { 1143 | "argumentTypes": null, 1144 | "id": 208, 1145 | "name": "name", 1146 | "nodeType": "Identifier", 1147 | "overloadedDeclarations": [], 1148 | "referencedDeclaration": 197, 1149 | "src": "829:4:2", 1150 | "typeDescriptions": { 1151 | "typeIdentifier": "t_string_memory_ptr", 1152 | "typeString": "string memory" 1153 | } 1154 | }, 1155 | "src": "802:31:2", 1156 | "typeDescriptions": { 1157 | "typeIdentifier": "t_string_storage", 1158 | "typeString": "string storage ref" 1159 | } 1160 | }, 1161 | "id": 210, 1162 | "nodeType": "ExpressionStatement", 1163 | "src": "802:31:2" 1164 | }, 1165 | { 1166 | "expression": { 1167 | "argumentTypes": null, 1168 | "id": 213, 1169 | "isConstant": false, 1170 | "isLValue": false, 1171 | "isPure": false, 1172 | "lValueRequested": false, 1173 | "leftHandSide": { 1174 | "argumentTypes": null, 1175 | "id": 211, 1176 | "name": "lastCallerName", 1177 | "nodeType": "Identifier", 1178 | "overloadedDeclarations": [], 1179 | "referencedDeclaration": 179, 1180 | "src": "872:14:2", 1181 | "typeDescriptions": { 1182 | "typeIdentifier": "t_string_storage", 1183 | "typeString": "string storage ref" 1184 | } 1185 | }, 1186 | "nodeType": "Assignment", 1187 | "operator": "=", 1188 | "rightHandSide": { 1189 | "argumentTypes": null, 1190 | "id": 212, 1191 | "name": "name", 1192 | "nodeType": "Identifier", 1193 | "overloadedDeclarations": [], 1194 | "referencedDeclaration": 197, 1195 | "src": "889:4:2", 1196 | "typeDescriptions": { 1197 | "typeIdentifier": "t_string_memory_ptr", 1198 | "typeString": "string memory" 1199 | } 1200 | }, 1201 | "src": "872:21:2", 1202 | "typeDescriptions": { 1203 | "typeIdentifier": "t_string_storage", 1204 | "typeString": "string storage ref" 1205 | } 1206 | }, 1207 | "id": 214, 1208 | "nodeType": "ExpressionStatement", 1209 | "src": "872:21:2" 1210 | } 1211 | ] 1212 | }, 1213 | "id": 216, 1214 | "implemented": true, 1215 | "isConstructor": false, 1216 | "isDeclaredConst": false, 1217 | "modifiers": [], 1218 | "name": "hello", 1219 | "nodeType": "FunctionDefinition", 1220 | "parameters": { 1221 | "id": 198, 1222 | "nodeType": "ParameterList", 1223 | "parameters": [ 1224 | { 1225 | "constant": false, 1226 | "id": 197, 1227 | "name": "name", 1228 | "nodeType": "VariableDeclaration", 1229 | "scope": 216, 1230 | "src": "705:11:2", 1231 | "stateVariable": false, 1232 | "storageLocation": "default", 1233 | "typeDescriptions": { 1234 | "typeIdentifier": "t_string_memory_ptr", 1235 | "typeString": "string memory" 1236 | }, 1237 | "typeName": { 1238 | "id": 196, 1239 | "name": "string", 1240 | "nodeType": "ElementaryTypeName", 1241 | "src": "705:6:2", 1242 | "typeDescriptions": { 1243 | "typeIdentifier": "t_string_storage_ptr", 1244 | "typeString": "string storage pointer" 1245 | } 1246 | }, 1247 | "value": null, 1248 | "visibility": "internal" 1249 | } 1250 | ], 1251 | "src": "704:13:2" 1252 | }, 1253 | "payable": false, 1254 | "returnParameters": { 1255 | "id": 199, 1256 | "nodeType": "ParameterList", 1257 | "parameters": [], 1258 | "src": "725:0:2" 1259 | }, 1260 | "scope": 236, 1261 | "src": "689:209:2", 1262 | "stateMutability": "nonpayable", 1263 | "superFunction": null, 1264 | "visibility": "public" 1265 | }, 1266 | { 1267 | "body": { 1268 | "id": 234, 1269 | "nodeType": "Block", 1270 | "src": "1096:86:2", 1271 | "statements": [ 1272 | { 1273 | "expression": { 1274 | "argumentTypes": null, 1275 | "id": 225, 1276 | "isConstant": false, 1277 | "isLValue": false, 1278 | "isPure": false, 1279 | "lValueRequested": false, 1280 | "leftHandSide": { 1281 | "argumentTypes": null, 1282 | "id": 223, 1283 | "name": "lastCaller", 1284 | "nodeType": "Identifier", 1285 | "overloadedDeclarations": [], 1286 | "referencedDeclaration": 219, 1287 | "src": "1102:10:2", 1288 | "typeDescriptions": { 1289 | "typeIdentifier": "t_string_memory_ptr", 1290 | "typeString": "string memory" 1291 | } 1292 | }, 1293 | "nodeType": "Assignment", 1294 | "operator": "=", 1295 | "rightHandSide": { 1296 | "argumentTypes": null, 1297 | "id": 224, 1298 | "name": "lastCallerName", 1299 | "nodeType": "Identifier", 1300 | "overloadedDeclarations": [], 1301 | "referencedDeclaration": 179, 1302 | "src": "1115:14:2", 1303 | "typeDescriptions": { 1304 | "typeIdentifier": "t_string_storage", 1305 | "typeString": "string storage ref" 1306 | } 1307 | }, 1308 | "src": "1102:27:2", 1309 | "typeDescriptions": { 1310 | "typeIdentifier": "t_string_memory_ptr", 1311 | "typeString": "string memory" 1312 | } 1313 | }, 1314 | "id": 226, 1315 | "nodeType": "ExpressionStatement", 1316 | "src": "1102:27:2" 1317 | }, 1318 | { 1319 | "expression": { 1320 | "argumentTypes": null, 1321 | "id": 232, 1322 | "isConstant": false, 1323 | "isLValue": false, 1324 | "isPure": false, 1325 | "lValueRequested": false, 1326 | "leftHandSide": { 1327 | "argumentTypes": null, 1328 | "id": 227, 1329 | "name": "callerName", 1330 | "nodeType": "Identifier", 1331 | "overloadedDeclarations": [], 1332 | "referencedDeclaration": 221, 1333 | "src": "1135:10:2", 1334 | "typeDescriptions": { 1335 | "typeIdentifier": "t_string_memory_ptr", 1336 | "typeString": "string memory" 1337 | } 1338 | }, 1339 | "nodeType": "Assignment", 1340 | "operator": "=", 1341 | "rightHandSide": { 1342 | "argumentTypes": null, 1343 | "baseExpression": { 1344 | "argumentTypes": null, 1345 | "id": 228, 1346 | "name": "addressNames", 1347 | "nodeType": "Identifier", 1348 | "overloadedDeclarations": [], 1349 | "referencedDeclaration": 183, 1350 | "src": "1148:12:2", 1351 | "typeDescriptions": { 1352 | "typeIdentifier": "t_mapping$_t_address_$_t_string_storage_$", 1353 | "typeString": "mapping(address => string storage ref)" 1354 | } 1355 | }, 1356 | "id": 231, 1357 | "indexExpression": { 1358 | "argumentTypes": null, 1359 | "expression": { 1360 | "argumentTypes": null, 1361 | "id": 229, 1362 | "name": "msg", 1363 | "nodeType": "Identifier", 1364 | "overloadedDeclarations": [], 1365 | "referencedDeclaration": 377, 1366 | "src": "1161:3:2", 1367 | "typeDescriptions": { 1368 | "typeIdentifier": "t_magic_message", 1369 | "typeString": "msg" 1370 | } 1371 | }, 1372 | "id": 230, 1373 | "isConstant": false, 1374 | "isLValue": false, 1375 | "isPure": false, 1376 | "lValueRequested": false, 1377 | "memberName": "sender", 1378 | "nodeType": "MemberAccess", 1379 | "referencedDeclaration": null, 1380 | "src": "1161:10:2", 1381 | "typeDescriptions": { 1382 | "typeIdentifier": "t_address", 1383 | "typeString": "address" 1384 | } 1385 | }, 1386 | "isConstant": false, 1387 | "isLValue": true, 1388 | "isPure": false, 1389 | "lValueRequested": false, 1390 | "nodeType": "IndexAccess", 1391 | "src": "1148:24:2", 1392 | "typeDescriptions": { 1393 | "typeIdentifier": "t_string_storage", 1394 | "typeString": "string storage ref" 1395 | } 1396 | }, 1397 | "src": "1135:37:2", 1398 | "typeDescriptions": { 1399 | "typeIdentifier": "t_string_memory_ptr", 1400 | "typeString": "string memory" 1401 | } 1402 | }, 1403 | "id": 233, 1404 | "nodeType": "ExpressionStatement", 1405 | "src": "1135:37:2" 1406 | } 1407 | ] 1408 | }, 1409 | "id": 235, 1410 | "implemented": true, 1411 | "isConstructor": false, 1412 | "isDeclaredConst": true, 1413 | "modifiers": [], 1414 | "name": "getNames", 1415 | "nodeType": "FunctionDefinition", 1416 | "parameters": { 1417 | "id": 217, 1418 | "nodeType": "ParameterList", 1419 | "parameters": [], 1420 | "src": "1031:2:2" 1421 | }, 1422 | "payable": false, 1423 | "returnParameters": { 1424 | "id": 222, 1425 | "nodeType": "ParameterList", 1426 | "parameters": [ 1427 | { 1428 | "constant": false, 1429 | "id": 219, 1430 | "name": "lastCaller", 1431 | "nodeType": "VariableDeclaration", 1432 | "scope": 235, 1433 | "src": "1059:17:2", 1434 | "stateVariable": false, 1435 | "storageLocation": "default", 1436 | "typeDescriptions": { 1437 | "typeIdentifier": "t_string_memory_ptr", 1438 | "typeString": "string memory" 1439 | }, 1440 | "typeName": { 1441 | "id": 218, 1442 | "name": "string", 1443 | "nodeType": "ElementaryTypeName", 1444 | "src": "1059:6:2", 1445 | "typeDescriptions": { 1446 | "typeIdentifier": "t_string_storage_ptr", 1447 | "typeString": "string storage pointer" 1448 | } 1449 | }, 1450 | "value": null, 1451 | "visibility": "internal" 1452 | }, 1453 | { 1454 | "constant": false, 1455 | "id": 221, 1456 | "name": "callerName", 1457 | "nodeType": "VariableDeclaration", 1458 | "scope": 235, 1459 | "src": "1078:17:2", 1460 | "stateVariable": false, 1461 | "storageLocation": "default", 1462 | "typeDescriptions": { 1463 | "typeIdentifier": "t_string_memory_ptr", 1464 | "typeString": "string memory" 1465 | }, 1466 | "typeName": { 1467 | "id": 220, 1468 | "name": "string", 1469 | "nodeType": "ElementaryTypeName", 1470 | "src": "1078:6:2", 1471 | "typeDescriptions": { 1472 | "typeIdentifier": "t_string_storage_ptr", 1473 | "typeString": "string storage pointer" 1474 | } 1475 | }, 1476 | "value": null, 1477 | "visibility": "internal" 1478 | } 1479 | ], 1480 | "src": "1058:38:2" 1481 | }, 1482 | "scope": 236, 1483 | "src": "1013:169:2", 1484 | "stateMutability": "view", 1485 | "superFunction": null, 1486 | "visibility": "public" 1487 | } 1488 | ], 1489 | "scope": 237, 1490 | "src": "25:1159:2" 1491 | } 1492 | ], 1493 | "src": "0:1185:2" 1494 | }, 1495 | "compiler": { 1496 | "name": "solc", 1497 | "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" 1498 | }, 1499 | "networks": {}, 1500 | "schemaVersion": "2.0.0", 1501 | "updatedAt": "2018-03-19T01:05:02.866Z" 1502 | } -------------------------------------------------------------------------------- /build/contracts/LastInteraction.json: -------------------------------------------------------------------------------- 1 | { 2 | "contract_name": "LastInteraction", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "currentName", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "string" 12 | } 13 | ], 14 | "payable": false, 15 | "type": "function" 16 | }, 17 | { 18 | "constant": false, 19 | "inputs": [], 20 | "name": "lastUpdatedDays", 21 | "outputs": [ 22 | { 23 | "name": "", 24 | "type": "uint256" 25 | } 26 | ], 27 | "payable": false, 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [], 32 | "payable": false, 33 | "type": "constructor" 34 | }, 35 | { 36 | "anonymous": false, 37 | "inputs": [ 38 | { 39 | "indexed": false, 40 | "name": "name", 41 | "type": "string" 42 | }, 43 | { 44 | "indexed": false, 45 | "name": "timeUpdated", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Interaction", 50 | "type": "event" 51 | } 52 | ], 53 | "unlinked_binary": "0x606060405234610000575b5b5b6101b68061001b6000396000f300606060405263ffffffff60e060020a60003504166362777662811461002f578063e9f76b25146100bc575b610000565b346100005761003c6100db565b604080516020808252835181830152835191928392908301918501908083838215610082575b80518252602083111561008257601f199092019160209182019101610062565b505050905090810190601f1680156100ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34610000576100c9610178565b60408051918252519081900360200190f35b604080516020808201835260008083528054845160026001831615610100026000190190921691909104601f81018490048402820184019095528481529293909183018282801561016d5780601f106101425761010080835404028352916020019161016d565b820191906000526020600020905b81548152906001019060200180831161015057829003601f168201915b505050505090505b90565b60006001544203620151800290505b905600a165627a7a72305820907b114d6e9eac77ad6cf8d0b5c6245ebb33069ab4bbe5fdd70b308f663f5d590029", 54 | "networks": {}, 55 | "schema_version": "0.0.5", 56 | "updated_at": 1493924243412 57 | } -------------------------------------------------------------------------------- /build/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "last_completed_migration", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "uint256" 12 | } 13 | ], 14 | "payable": false, 15 | "stateMutability": "view", 16 | "type": "function" 17 | }, 18 | { 19 | "constant": true, 20 | "inputs": [], 21 | "name": "owner", 22 | "outputs": [ 23 | { 24 | "name": "", 25 | "type": "address" 26 | } 27 | ], 28 | "payable": false, 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [], 34 | "payable": false, 35 | "stateMutability": "nonpayable", 36 | "type": "constructor" 37 | }, 38 | { 39 | "constant": false, 40 | "inputs": [ 41 | { 42 | "name": "completed", 43 | "type": "uint256" 44 | } 45 | ], 46 | "name": "setCompleted", 47 | "outputs": [], 48 | "payable": false, 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | }, 52 | { 53 | "constant": false, 54 | "inputs": [ 55 | { 56 | "name": "new_address", 57 | "type": "address" 58 | } 59 | ], 60 | "name": "upgrade", 61 | "outputs": [], 62 | "payable": false, 63 | "stateMutability": "nonpayable", 64 | "type": "function" 65 | } 66 | ], 67 | "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058201077f534fc143d7c6179036eecca09016c405a062d2cfd56f0f39955127c517d0029", 68 | "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058201077f534fc143d7c6179036eecca09016c405a062d2cfd56f0f39955127c517d0029", 69 | "sourceMap": "25:467:4:-;;;177:51;;;;;;;;213:10;205:5;;:18;;;;;;;;;;;;;;;;;;25:467;;;;;;", 70 | "deployedSourceMap": "25:467:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;332:158;;;;;;;;;;;;;;;;;;;;;;;;;;;;73:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;232:96;;;;;;;;;;;;;;;;;;;;;;;;;;332:158;387:19;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;420:11;387:45;;438:8;:21;;;460:24;;438:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;142:26;332:158;;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;232:96::-;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;314:9;287:24;:36;;;;142:26;232:96;:::o", 71 | "source": "pragma solidity ^0.4.2;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", 72 | "sourcePath": "C:\\Users\\Rajeev\\Documents\\Course\\Blockchain Course\\workspace\\Blockchain-Course-Calculator\\contracts\\Migrations.sol", 73 | "ast": { 74 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/Migrations.sol", 75 | "exportedSymbols": { 76 | "Migrations": [ 77 | 365 78 | ] 79 | }, 80 | "id": 366, 81 | "nodeType": "SourceUnit", 82 | "nodes": [ 83 | { 84 | "id": 310, 85 | "literals": [ 86 | "solidity", 87 | "^", 88 | "0.4", 89 | ".2" 90 | ], 91 | "nodeType": "PragmaDirective", 92 | "src": "0:23:4" 93 | }, 94 | { 95 | "baseContracts": [], 96 | "contractDependencies": [], 97 | "contractKind": "contract", 98 | "documentation": null, 99 | "fullyImplemented": true, 100 | "id": 365, 101 | "linearizedBaseContracts": [ 102 | 365 103 | ], 104 | "name": "Migrations", 105 | "nodeType": "ContractDefinition", 106 | "nodes": [ 107 | { 108 | "constant": false, 109 | "id": 312, 110 | "name": "owner", 111 | "nodeType": "VariableDeclaration", 112 | "scope": 365, 113 | "src": "49:20:4", 114 | "stateVariable": true, 115 | "storageLocation": "default", 116 | "typeDescriptions": { 117 | "typeIdentifier": "t_address", 118 | "typeString": "address" 119 | }, 120 | "typeName": { 121 | "id": 311, 122 | "name": "address", 123 | "nodeType": "ElementaryTypeName", 124 | "src": "49:7:4", 125 | "typeDescriptions": { 126 | "typeIdentifier": "t_address", 127 | "typeString": "address" 128 | } 129 | }, 130 | "value": null, 131 | "visibility": "public" 132 | }, 133 | { 134 | "constant": false, 135 | "id": 314, 136 | "name": "last_completed_migration", 137 | "nodeType": "VariableDeclaration", 138 | "scope": 365, 139 | "src": "73:36:4", 140 | "stateVariable": true, 141 | "storageLocation": "default", 142 | "typeDescriptions": { 143 | "typeIdentifier": "t_uint256", 144 | "typeString": "uint256" 145 | }, 146 | "typeName": { 147 | "id": 313, 148 | "name": "uint", 149 | "nodeType": "ElementaryTypeName", 150 | "src": "73:4:4", 151 | "typeDescriptions": { 152 | "typeIdentifier": "t_uint256", 153 | "typeString": "uint256" 154 | } 155 | }, 156 | "value": null, 157 | "visibility": "public" 158 | }, 159 | { 160 | "body": { 161 | "id": 322, 162 | "nodeType": "Block", 163 | "src": "136:37:4", 164 | "statements": [ 165 | { 166 | "condition": { 167 | "argumentTypes": null, 168 | "commonType": { 169 | "typeIdentifier": "t_address", 170 | "typeString": "address" 171 | }, 172 | "id": 319, 173 | "isConstant": false, 174 | "isLValue": false, 175 | "isPure": false, 176 | "lValueRequested": false, 177 | "leftExpression": { 178 | "argumentTypes": null, 179 | "expression": { 180 | "argumentTypes": null, 181 | "id": 316, 182 | "name": "msg", 183 | "nodeType": "Identifier", 184 | "overloadedDeclarations": [], 185 | "referencedDeclaration": 377, 186 | "src": "146:3:4", 187 | "typeDescriptions": { 188 | "typeIdentifier": "t_magic_message", 189 | "typeString": "msg" 190 | } 191 | }, 192 | "id": 317, 193 | "isConstant": false, 194 | "isLValue": false, 195 | "isPure": false, 196 | "lValueRequested": false, 197 | "memberName": "sender", 198 | "nodeType": "MemberAccess", 199 | "referencedDeclaration": null, 200 | "src": "146:10:4", 201 | "typeDescriptions": { 202 | "typeIdentifier": "t_address", 203 | "typeString": "address" 204 | } 205 | }, 206 | "nodeType": "BinaryOperation", 207 | "operator": "==", 208 | "rightExpression": { 209 | "argumentTypes": null, 210 | "id": 318, 211 | "name": "owner", 212 | "nodeType": "Identifier", 213 | "overloadedDeclarations": [], 214 | "referencedDeclaration": 312, 215 | "src": "160:5:4", 216 | "typeDescriptions": { 217 | "typeIdentifier": "t_address", 218 | "typeString": "address" 219 | } 220 | }, 221 | "src": "146:19:4", 222 | "typeDescriptions": { 223 | "typeIdentifier": "t_bool", 224 | "typeString": "bool" 225 | } 226 | }, 227 | "falseBody": null, 228 | "id": 321, 229 | "nodeType": "IfStatement", 230 | "src": "142:26:4", 231 | "trueBody": { 232 | "id": 320, 233 | "nodeType": "PlaceholderStatement", 234 | "src": "167:1:4" 235 | } 236 | } 237 | ] 238 | }, 239 | "id": 323, 240 | "name": "restricted", 241 | "nodeType": "ModifierDefinition", 242 | "parameters": { 243 | "id": 315, 244 | "nodeType": "ParameterList", 245 | "parameters": [], 246 | "src": "133:2:4" 247 | }, 248 | "src": "114:59:4", 249 | "visibility": "internal" 250 | }, 251 | { 252 | "body": { 253 | "id": 331, 254 | "nodeType": "Block", 255 | "src": "199:29:4", 256 | "statements": [ 257 | { 258 | "expression": { 259 | "argumentTypes": null, 260 | "id": 329, 261 | "isConstant": false, 262 | "isLValue": false, 263 | "isPure": false, 264 | "lValueRequested": false, 265 | "leftHandSide": { 266 | "argumentTypes": null, 267 | "id": 326, 268 | "name": "owner", 269 | "nodeType": "Identifier", 270 | "overloadedDeclarations": [], 271 | "referencedDeclaration": 312, 272 | "src": "205:5:4", 273 | "typeDescriptions": { 274 | "typeIdentifier": "t_address", 275 | "typeString": "address" 276 | } 277 | }, 278 | "nodeType": "Assignment", 279 | "operator": "=", 280 | "rightHandSide": { 281 | "argumentTypes": null, 282 | "expression": { 283 | "argumentTypes": null, 284 | "id": 327, 285 | "name": "msg", 286 | "nodeType": "Identifier", 287 | "overloadedDeclarations": [], 288 | "referencedDeclaration": 377, 289 | "src": "213:3:4", 290 | "typeDescriptions": { 291 | "typeIdentifier": "t_magic_message", 292 | "typeString": "msg" 293 | } 294 | }, 295 | "id": 328, 296 | "isConstant": false, 297 | "isLValue": false, 298 | "isPure": false, 299 | "lValueRequested": false, 300 | "memberName": "sender", 301 | "nodeType": "MemberAccess", 302 | "referencedDeclaration": null, 303 | "src": "213:10:4", 304 | "typeDescriptions": { 305 | "typeIdentifier": "t_address", 306 | "typeString": "address" 307 | } 308 | }, 309 | "src": "205:18:4", 310 | "typeDescriptions": { 311 | "typeIdentifier": "t_address", 312 | "typeString": "address" 313 | } 314 | }, 315 | "id": 330, 316 | "nodeType": "ExpressionStatement", 317 | "src": "205:18:4" 318 | } 319 | ] 320 | }, 321 | "id": 332, 322 | "implemented": true, 323 | "isConstructor": true, 324 | "isDeclaredConst": false, 325 | "modifiers": [], 326 | "name": "Migrations", 327 | "nodeType": "FunctionDefinition", 328 | "parameters": { 329 | "id": 324, 330 | "nodeType": "ParameterList", 331 | "parameters": [], 332 | "src": "196:2:4" 333 | }, 334 | "payable": false, 335 | "returnParameters": { 336 | "id": 325, 337 | "nodeType": "ParameterList", 338 | "parameters": [], 339 | "src": "199:0:4" 340 | }, 341 | "scope": 365, 342 | "src": "177:51:4", 343 | "stateMutability": "nonpayable", 344 | "superFunction": null, 345 | "visibility": "public" 346 | }, 347 | { 348 | "body": { 349 | "id": 343, 350 | "nodeType": "Block", 351 | "src": "281:47:4", 352 | "statements": [ 353 | { 354 | "expression": { 355 | "argumentTypes": null, 356 | "id": 341, 357 | "isConstant": false, 358 | "isLValue": false, 359 | "isPure": false, 360 | "lValueRequested": false, 361 | "leftHandSide": { 362 | "argumentTypes": null, 363 | "id": 339, 364 | "name": "last_completed_migration", 365 | "nodeType": "Identifier", 366 | "overloadedDeclarations": [], 367 | "referencedDeclaration": 314, 368 | "src": "287:24:4", 369 | "typeDescriptions": { 370 | "typeIdentifier": "t_uint256", 371 | "typeString": "uint256" 372 | } 373 | }, 374 | "nodeType": "Assignment", 375 | "operator": "=", 376 | "rightHandSide": { 377 | "argumentTypes": null, 378 | "id": 340, 379 | "name": "completed", 380 | "nodeType": "Identifier", 381 | "overloadedDeclarations": [], 382 | "referencedDeclaration": 334, 383 | "src": "314:9:4", 384 | "typeDescriptions": { 385 | "typeIdentifier": "t_uint256", 386 | "typeString": "uint256" 387 | } 388 | }, 389 | "src": "287:36:4", 390 | "typeDescriptions": { 391 | "typeIdentifier": "t_uint256", 392 | "typeString": "uint256" 393 | } 394 | }, 395 | "id": 342, 396 | "nodeType": "ExpressionStatement", 397 | "src": "287:36:4" 398 | } 399 | ] 400 | }, 401 | "id": 344, 402 | "implemented": true, 403 | "isConstructor": false, 404 | "isDeclaredConst": false, 405 | "modifiers": [ 406 | { 407 | "arguments": [], 408 | "id": 337, 409 | "modifierName": { 410 | "argumentTypes": null, 411 | "id": 336, 412 | "name": "restricted", 413 | "nodeType": "Identifier", 414 | "overloadedDeclarations": [], 415 | "referencedDeclaration": 323, 416 | "src": "270:10:4", 417 | "typeDescriptions": { 418 | "typeIdentifier": "t_modifier$__$", 419 | "typeString": "modifier ()" 420 | } 421 | }, 422 | "nodeType": "ModifierInvocation", 423 | "src": "270:10:4" 424 | } 425 | ], 426 | "name": "setCompleted", 427 | "nodeType": "FunctionDefinition", 428 | "parameters": { 429 | "id": 335, 430 | "nodeType": "ParameterList", 431 | "parameters": [ 432 | { 433 | "constant": false, 434 | "id": 334, 435 | "name": "completed", 436 | "nodeType": "VariableDeclaration", 437 | "scope": 344, 438 | "src": "254:14:4", 439 | "stateVariable": false, 440 | "storageLocation": "default", 441 | "typeDescriptions": { 442 | "typeIdentifier": "t_uint256", 443 | "typeString": "uint256" 444 | }, 445 | "typeName": { 446 | "id": 333, 447 | "name": "uint", 448 | "nodeType": "ElementaryTypeName", 449 | "src": "254:4:4", 450 | "typeDescriptions": { 451 | "typeIdentifier": "t_uint256", 452 | "typeString": "uint256" 453 | } 454 | }, 455 | "value": null, 456 | "visibility": "internal" 457 | } 458 | ], 459 | "src": "253:16:4" 460 | }, 461 | "payable": false, 462 | "returnParameters": { 463 | "id": 338, 464 | "nodeType": "ParameterList", 465 | "parameters": [], 466 | "src": "281:0:4" 467 | }, 468 | "scope": 365, 469 | "src": "232:96:4", 470 | "stateMutability": "nonpayable", 471 | "superFunction": null, 472 | "visibility": "public" 473 | }, 474 | { 475 | "body": { 476 | "id": 363, 477 | "nodeType": "Block", 478 | "src": "381:109:4", 479 | "statements": [ 480 | { 481 | "assignments": [ 482 | 352 483 | ], 484 | "declarations": [ 485 | { 486 | "constant": false, 487 | "id": 352, 488 | "name": "upgraded", 489 | "nodeType": "VariableDeclaration", 490 | "scope": 364, 491 | "src": "387:19:4", 492 | "stateVariable": false, 493 | "storageLocation": "default", 494 | "typeDescriptions": { 495 | "typeIdentifier": "t_contract$_Migrations_$365", 496 | "typeString": "contract Migrations" 497 | }, 498 | "typeName": { 499 | "contractScope": null, 500 | "id": 351, 501 | "name": "Migrations", 502 | "nodeType": "UserDefinedTypeName", 503 | "referencedDeclaration": 365, 504 | "src": "387:10:4", 505 | "typeDescriptions": { 506 | "typeIdentifier": "t_contract$_Migrations_$365", 507 | "typeString": "contract Migrations" 508 | } 509 | }, 510 | "value": null, 511 | "visibility": "internal" 512 | } 513 | ], 514 | "id": 356, 515 | "initialValue": { 516 | "argumentTypes": null, 517 | "arguments": [ 518 | { 519 | "argumentTypes": null, 520 | "id": 354, 521 | "name": "new_address", 522 | "nodeType": "Identifier", 523 | "overloadedDeclarations": [], 524 | "referencedDeclaration": 346, 525 | "src": "420:11:4", 526 | "typeDescriptions": { 527 | "typeIdentifier": "t_address", 528 | "typeString": "address" 529 | } 530 | } 531 | ], 532 | "expression": { 533 | "argumentTypes": [ 534 | { 535 | "typeIdentifier": "t_address", 536 | "typeString": "address" 537 | } 538 | ], 539 | "id": 353, 540 | "name": "Migrations", 541 | "nodeType": "Identifier", 542 | "overloadedDeclarations": [], 543 | "referencedDeclaration": 365, 544 | "src": "409:10:4", 545 | "typeDescriptions": { 546 | "typeIdentifier": "t_type$_t_contract$_Migrations_$365_$", 547 | "typeString": "type(contract Migrations)" 548 | } 549 | }, 550 | "id": 355, 551 | "isConstant": false, 552 | "isLValue": false, 553 | "isPure": false, 554 | "kind": "typeConversion", 555 | "lValueRequested": false, 556 | "names": [], 557 | "nodeType": "FunctionCall", 558 | "src": "409:23:4", 559 | "typeDescriptions": { 560 | "typeIdentifier": "t_contract$_Migrations_$365", 561 | "typeString": "contract Migrations" 562 | } 563 | }, 564 | "nodeType": "VariableDeclarationStatement", 565 | "src": "387:45:4" 566 | }, 567 | { 568 | "expression": { 569 | "argumentTypes": null, 570 | "arguments": [ 571 | { 572 | "argumentTypes": null, 573 | "id": 360, 574 | "name": "last_completed_migration", 575 | "nodeType": "Identifier", 576 | "overloadedDeclarations": [], 577 | "referencedDeclaration": 314, 578 | "src": "460:24:4", 579 | "typeDescriptions": { 580 | "typeIdentifier": "t_uint256", 581 | "typeString": "uint256" 582 | } 583 | } 584 | ], 585 | "expression": { 586 | "argumentTypes": [ 587 | { 588 | "typeIdentifier": "t_uint256", 589 | "typeString": "uint256" 590 | } 591 | ], 592 | "expression": { 593 | "argumentTypes": null, 594 | "id": 357, 595 | "name": "upgraded", 596 | "nodeType": "Identifier", 597 | "overloadedDeclarations": [], 598 | "referencedDeclaration": 352, 599 | "src": "438:8:4", 600 | "typeDescriptions": { 601 | "typeIdentifier": "t_contract$_Migrations_$365", 602 | "typeString": "contract Migrations" 603 | } 604 | }, 605 | "id": 359, 606 | "isConstant": false, 607 | "isLValue": false, 608 | "isPure": false, 609 | "lValueRequested": false, 610 | "memberName": "setCompleted", 611 | "nodeType": "MemberAccess", 612 | "referencedDeclaration": 344, 613 | "src": "438:21:4", 614 | "typeDescriptions": { 615 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", 616 | "typeString": "function (uint256) external" 617 | } 618 | }, 619 | "id": 361, 620 | "isConstant": false, 621 | "isLValue": false, 622 | "isPure": false, 623 | "kind": "functionCall", 624 | "lValueRequested": false, 625 | "names": [], 626 | "nodeType": "FunctionCall", 627 | "src": "438:47:4", 628 | "typeDescriptions": { 629 | "typeIdentifier": "t_tuple$__$", 630 | "typeString": "tuple()" 631 | } 632 | }, 633 | "id": 362, 634 | "nodeType": "ExpressionStatement", 635 | "src": "438:47:4" 636 | } 637 | ] 638 | }, 639 | "id": 364, 640 | "implemented": true, 641 | "isConstructor": false, 642 | "isDeclaredConst": false, 643 | "modifiers": [ 644 | { 645 | "arguments": [], 646 | "id": 349, 647 | "modifierName": { 648 | "argumentTypes": null, 649 | "id": 348, 650 | "name": "restricted", 651 | "nodeType": "Identifier", 652 | "overloadedDeclarations": [], 653 | "referencedDeclaration": 323, 654 | "src": "370:10:4", 655 | "typeDescriptions": { 656 | "typeIdentifier": "t_modifier$__$", 657 | "typeString": "modifier ()" 658 | } 659 | }, 660 | "nodeType": "ModifierInvocation", 661 | "src": "370:10:4" 662 | } 663 | ], 664 | "name": "upgrade", 665 | "nodeType": "FunctionDefinition", 666 | "parameters": { 667 | "id": 347, 668 | "nodeType": "ParameterList", 669 | "parameters": [ 670 | { 671 | "constant": false, 672 | "id": 346, 673 | "name": "new_address", 674 | "nodeType": "VariableDeclaration", 675 | "scope": 364, 676 | "src": "349:19:4", 677 | "stateVariable": false, 678 | "storageLocation": "default", 679 | "typeDescriptions": { 680 | "typeIdentifier": "t_address", 681 | "typeString": "address" 682 | }, 683 | "typeName": { 684 | "id": 345, 685 | "name": "address", 686 | "nodeType": "ElementaryTypeName", 687 | "src": "349:7:4", 688 | "typeDescriptions": { 689 | "typeIdentifier": "t_address", 690 | "typeString": "address" 691 | } 692 | }, 693 | "value": null, 694 | "visibility": "internal" 695 | } 696 | ], 697 | "src": "348:21:4" 698 | }, 699 | "payable": false, 700 | "returnParameters": { 701 | "id": 350, 702 | "nodeType": "ParameterList", 703 | "parameters": [], 704 | "src": "381:0:4" 705 | }, 706 | "scope": 365, 707 | "src": "332:158:4", 708 | "stateMutability": "nonpayable", 709 | "superFunction": null, 710 | "visibility": "public" 711 | } 712 | ], 713 | "scope": 366, 714 | "src": "25:467:4" 715 | } 716 | ], 717 | "src": "0:493:4" 718 | }, 719 | "legacyAST": { 720 | "absolutePath": "/C/Users/Rajeev/Documents/Course/Blockchain Course/workspace/Blockchain-Course-Calculator/contracts/Migrations.sol", 721 | "exportedSymbols": { 722 | "Migrations": [ 723 | 365 724 | ] 725 | }, 726 | "id": 366, 727 | "nodeType": "SourceUnit", 728 | "nodes": [ 729 | { 730 | "id": 310, 731 | "literals": [ 732 | "solidity", 733 | "^", 734 | "0.4", 735 | ".2" 736 | ], 737 | "nodeType": "PragmaDirective", 738 | "src": "0:23:4" 739 | }, 740 | { 741 | "baseContracts": [], 742 | "contractDependencies": [], 743 | "contractKind": "contract", 744 | "documentation": null, 745 | "fullyImplemented": true, 746 | "id": 365, 747 | "linearizedBaseContracts": [ 748 | 365 749 | ], 750 | "name": "Migrations", 751 | "nodeType": "ContractDefinition", 752 | "nodes": [ 753 | { 754 | "constant": false, 755 | "id": 312, 756 | "name": "owner", 757 | "nodeType": "VariableDeclaration", 758 | "scope": 365, 759 | "src": "49:20:4", 760 | "stateVariable": true, 761 | "storageLocation": "default", 762 | "typeDescriptions": { 763 | "typeIdentifier": "t_address", 764 | "typeString": "address" 765 | }, 766 | "typeName": { 767 | "id": 311, 768 | "name": "address", 769 | "nodeType": "ElementaryTypeName", 770 | "src": "49:7:4", 771 | "typeDescriptions": { 772 | "typeIdentifier": "t_address", 773 | "typeString": "address" 774 | } 775 | }, 776 | "value": null, 777 | "visibility": "public" 778 | }, 779 | { 780 | "constant": false, 781 | "id": 314, 782 | "name": "last_completed_migration", 783 | "nodeType": "VariableDeclaration", 784 | "scope": 365, 785 | "src": "73:36:4", 786 | "stateVariable": true, 787 | "storageLocation": "default", 788 | "typeDescriptions": { 789 | "typeIdentifier": "t_uint256", 790 | "typeString": "uint256" 791 | }, 792 | "typeName": { 793 | "id": 313, 794 | "name": "uint", 795 | "nodeType": "ElementaryTypeName", 796 | "src": "73:4:4", 797 | "typeDescriptions": { 798 | "typeIdentifier": "t_uint256", 799 | "typeString": "uint256" 800 | } 801 | }, 802 | "value": null, 803 | "visibility": "public" 804 | }, 805 | { 806 | "body": { 807 | "id": 322, 808 | "nodeType": "Block", 809 | "src": "136:37:4", 810 | "statements": [ 811 | { 812 | "condition": { 813 | "argumentTypes": null, 814 | "commonType": { 815 | "typeIdentifier": "t_address", 816 | "typeString": "address" 817 | }, 818 | "id": 319, 819 | "isConstant": false, 820 | "isLValue": false, 821 | "isPure": false, 822 | "lValueRequested": false, 823 | "leftExpression": { 824 | "argumentTypes": null, 825 | "expression": { 826 | "argumentTypes": null, 827 | "id": 316, 828 | "name": "msg", 829 | "nodeType": "Identifier", 830 | "overloadedDeclarations": [], 831 | "referencedDeclaration": 377, 832 | "src": "146:3:4", 833 | "typeDescriptions": { 834 | "typeIdentifier": "t_magic_message", 835 | "typeString": "msg" 836 | } 837 | }, 838 | "id": 317, 839 | "isConstant": false, 840 | "isLValue": false, 841 | "isPure": false, 842 | "lValueRequested": false, 843 | "memberName": "sender", 844 | "nodeType": "MemberAccess", 845 | "referencedDeclaration": null, 846 | "src": "146:10:4", 847 | "typeDescriptions": { 848 | "typeIdentifier": "t_address", 849 | "typeString": "address" 850 | } 851 | }, 852 | "nodeType": "BinaryOperation", 853 | "operator": "==", 854 | "rightExpression": { 855 | "argumentTypes": null, 856 | "id": 318, 857 | "name": "owner", 858 | "nodeType": "Identifier", 859 | "overloadedDeclarations": [], 860 | "referencedDeclaration": 312, 861 | "src": "160:5:4", 862 | "typeDescriptions": { 863 | "typeIdentifier": "t_address", 864 | "typeString": "address" 865 | } 866 | }, 867 | "src": "146:19:4", 868 | "typeDescriptions": { 869 | "typeIdentifier": "t_bool", 870 | "typeString": "bool" 871 | } 872 | }, 873 | "falseBody": null, 874 | "id": 321, 875 | "nodeType": "IfStatement", 876 | "src": "142:26:4", 877 | "trueBody": { 878 | "id": 320, 879 | "nodeType": "PlaceholderStatement", 880 | "src": "167:1:4" 881 | } 882 | } 883 | ] 884 | }, 885 | "id": 323, 886 | "name": "restricted", 887 | "nodeType": "ModifierDefinition", 888 | "parameters": { 889 | "id": 315, 890 | "nodeType": "ParameterList", 891 | "parameters": [], 892 | "src": "133:2:4" 893 | }, 894 | "src": "114:59:4", 895 | "visibility": "internal" 896 | }, 897 | { 898 | "body": { 899 | "id": 331, 900 | "nodeType": "Block", 901 | "src": "199:29:4", 902 | "statements": [ 903 | { 904 | "expression": { 905 | "argumentTypes": null, 906 | "id": 329, 907 | "isConstant": false, 908 | "isLValue": false, 909 | "isPure": false, 910 | "lValueRequested": false, 911 | "leftHandSide": { 912 | "argumentTypes": null, 913 | "id": 326, 914 | "name": "owner", 915 | "nodeType": "Identifier", 916 | "overloadedDeclarations": [], 917 | "referencedDeclaration": 312, 918 | "src": "205:5:4", 919 | "typeDescriptions": { 920 | "typeIdentifier": "t_address", 921 | "typeString": "address" 922 | } 923 | }, 924 | "nodeType": "Assignment", 925 | "operator": "=", 926 | "rightHandSide": { 927 | "argumentTypes": null, 928 | "expression": { 929 | "argumentTypes": null, 930 | "id": 327, 931 | "name": "msg", 932 | "nodeType": "Identifier", 933 | "overloadedDeclarations": [], 934 | "referencedDeclaration": 377, 935 | "src": "213:3:4", 936 | "typeDescriptions": { 937 | "typeIdentifier": "t_magic_message", 938 | "typeString": "msg" 939 | } 940 | }, 941 | "id": 328, 942 | "isConstant": false, 943 | "isLValue": false, 944 | "isPure": false, 945 | "lValueRequested": false, 946 | "memberName": "sender", 947 | "nodeType": "MemberAccess", 948 | "referencedDeclaration": null, 949 | "src": "213:10:4", 950 | "typeDescriptions": { 951 | "typeIdentifier": "t_address", 952 | "typeString": "address" 953 | } 954 | }, 955 | "src": "205:18:4", 956 | "typeDescriptions": { 957 | "typeIdentifier": "t_address", 958 | "typeString": "address" 959 | } 960 | }, 961 | "id": 330, 962 | "nodeType": "ExpressionStatement", 963 | "src": "205:18:4" 964 | } 965 | ] 966 | }, 967 | "id": 332, 968 | "implemented": true, 969 | "isConstructor": true, 970 | "isDeclaredConst": false, 971 | "modifiers": [], 972 | "name": "Migrations", 973 | "nodeType": "FunctionDefinition", 974 | "parameters": { 975 | "id": 324, 976 | "nodeType": "ParameterList", 977 | "parameters": [], 978 | "src": "196:2:4" 979 | }, 980 | "payable": false, 981 | "returnParameters": { 982 | "id": 325, 983 | "nodeType": "ParameterList", 984 | "parameters": [], 985 | "src": "199:0:4" 986 | }, 987 | "scope": 365, 988 | "src": "177:51:4", 989 | "stateMutability": "nonpayable", 990 | "superFunction": null, 991 | "visibility": "public" 992 | }, 993 | { 994 | "body": { 995 | "id": 343, 996 | "nodeType": "Block", 997 | "src": "281:47:4", 998 | "statements": [ 999 | { 1000 | "expression": { 1001 | "argumentTypes": null, 1002 | "id": 341, 1003 | "isConstant": false, 1004 | "isLValue": false, 1005 | "isPure": false, 1006 | "lValueRequested": false, 1007 | "leftHandSide": { 1008 | "argumentTypes": null, 1009 | "id": 339, 1010 | "name": "last_completed_migration", 1011 | "nodeType": "Identifier", 1012 | "overloadedDeclarations": [], 1013 | "referencedDeclaration": 314, 1014 | "src": "287:24:4", 1015 | "typeDescriptions": { 1016 | "typeIdentifier": "t_uint256", 1017 | "typeString": "uint256" 1018 | } 1019 | }, 1020 | "nodeType": "Assignment", 1021 | "operator": "=", 1022 | "rightHandSide": { 1023 | "argumentTypes": null, 1024 | "id": 340, 1025 | "name": "completed", 1026 | "nodeType": "Identifier", 1027 | "overloadedDeclarations": [], 1028 | "referencedDeclaration": 334, 1029 | "src": "314:9:4", 1030 | "typeDescriptions": { 1031 | "typeIdentifier": "t_uint256", 1032 | "typeString": "uint256" 1033 | } 1034 | }, 1035 | "src": "287:36:4", 1036 | "typeDescriptions": { 1037 | "typeIdentifier": "t_uint256", 1038 | "typeString": "uint256" 1039 | } 1040 | }, 1041 | "id": 342, 1042 | "nodeType": "ExpressionStatement", 1043 | "src": "287:36:4" 1044 | } 1045 | ] 1046 | }, 1047 | "id": 344, 1048 | "implemented": true, 1049 | "isConstructor": false, 1050 | "isDeclaredConst": false, 1051 | "modifiers": [ 1052 | { 1053 | "arguments": [], 1054 | "id": 337, 1055 | "modifierName": { 1056 | "argumentTypes": null, 1057 | "id": 336, 1058 | "name": "restricted", 1059 | "nodeType": "Identifier", 1060 | "overloadedDeclarations": [], 1061 | "referencedDeclaration": 323, 1062 | "src": "270:10:4", 1063 | "typeDescriptions": { 1064 | "typeIdentifier": "t_modifier$__$", 1065 | "typeString": "modifier ()" 1066 | } 1067 | }, 1068 | "nodeType": "ModifierInvocation", 1069 | "src": "270:10:4" 1070 | } 1071 | ], 1072 | "name": "setCompleted", 1073 | "nodeType": "FunctionDefinition", 1074 | "parameters": { 1075 | "id": 335, 1076 | "nodeType": "ParameterList", 1077 | "parameters": [ 1078 | { 1079 | "constant": false, 1080 | "id": 334, 1081 | "name": "completed", 1082 | "nodeType": "VariableDeclaration", 1083 | "scope": 344, 1084 | "src": "254:14:4", 1085 | "stateVariable": false, 1086 | "storageLocation": "default", 1087 | "typeDescriptions": { 1088 | "typeIdentifier": "t_uint256", 1089 | "typeString": "uint256" 1090 | }, 1091 | "typeName": { 1092 | "id": 333, 1093 | "name": "uint", 1094 | "nodeType": "ElementaryTypeName", 1095 | "src": "254:4:4", 1096 | "typeDescriptions": { 1097 | "typeIdentifier": "t_uint256", 1098 | "typeString": "uint256" 1099 | } 1100 | }, 1101 | "value": null, 1102 | "visibility": "internal" 1103 | } 1104 | ], 1105 | "src": "253:16:4" 1106 | }, 1107 | "payable": false, 1108 | "returnParameters": { 1109 | "id": 338, 1110 | "nodeType": "ParameterList", 1111 | "parameters": [], 1112 | "src": "281:0:4" 1113 | }, 1114 | "scope": 365, 1115 | "src": "232:96:4", 1116 | "stateMutability": "nonpayable", 1117 | "superFunction": null, 1118 | "visibility": "public" 1119 | }, 1120 | { 1121 | "body": { 1122 | "id": 363, 1123 | "nodeType": "Block", 1124 | "src": "381:109:4", 1125 | "statements": [ 1126 | { 1127 | "assignments": [ 1128 | 352 1129 | ], 1130 | "declarations": [ 1131 | { 1132 | "constant": false, 1133 | "id": 352, 1134 | "name": "upgraded", 1135 | "nodeType": "VariableDeclaration", 1136 | "scope": 364, 1137 | "src": "387:19:4", 1138 | "stateVariable": false, 1139 | "storageLocation": "default", 1140 | "typeDescriptions": { 1141 | "typeIdentifier": "t_contract$_Migrations_$365", 1142 | "typeString": "contract Migrations" 1143 | }, 1144 | "typeName": { 1145 | "contractScope": null, 1146 | "id": 351, 1147 | "name": "Migrations", 1148 | "nodeType": "UserDefinedTypeName", 1149 | "referencedDeclaration": 365, 1150 | "src": "387:10:4", 1151 | "typeDescriptions": { 1152 | "typeIdentifier": "t_contract$_Migrations_$365", 1153 | "typeString": "contract Migrations" 1154 | } 1155 | }, 1156 | "value": null, 1157 | "visibility": "internal" 1158 | } 1159 | ], 1160 | "id": 356, 1161 | "initialValue": { 1162 | "argumentTypes": null, 1163 | "arguments": [ 1164 | { 1165 | "argumentTypes": null, 1166 | "id": 354, 1167 | "name": "new_address", 1168 | "nodeType": "Identifier", 1169 | "overloadedDeclarations": [], 1170 | "referencedDeclaration": 346, 1171 | "src": "420:11:4", 1172 | "typeDescriptions": { 1173 | "typeIdentifier": "t_address", 1174 | "typeString": "address" 1175 | } 1176 | } 1177 | ], 1178 | "expression": { 1179 | "argumentTypes": [ 1180 | { 1181 | "typeIdentifier": "t_address", 1182 | "typeString": "address" 1183 | } 1184 | ], 1185 | "id": 353, 1186 | "name": "Migrations", 1187 | "nodeType": "Identifier", 1188 | "overloadedDeclarations": [], 1189 | "referencedDeclaration": 365, 1190 | "src": "409:10:4", 1191 | "typeDescriptions": { 1192 | "typeIdentifier": "t_type$_t_contract$_Migrations_$365_$", 1193 | "typeString": "type(contract Migrations)" 1194 | } 1195 | }, 1196 | "id": 355, 1197 | "isConstant": false, 1198 | "isLValue": false, 1199 | "isPure": false, 1200 | "kind": "typeConversion", 1201 | "lValueRequested": false, 1202 | "names": [], 1203 | "nodeType": "FunctionCall", 1204 | "src": "409:23:4", 1205 | "typeDescriptions": { 1206 | "typeIdentifier": "t_contract$_Migrations_$365", 1207 | "typeString": "contract Migrations" 1208 | } 1209 | }, 1210 | "nodeType": "VariableDeclarationStatement", 1211 | "src": "387:45:4" 1212 | }, 1213 | { 1214 | "expression": { 1215 | "argumentTypes": null, 1216 | "arguments": [ 1217 | { 1218 | "argumentTypes": null, 1219 | "id": 360, 1220 | "name": "last_completed_migration", 1221 | "nodeType": "Identifier", 1222 | "overloadedDeclarations": [], 1223 | "referencedDeclaration": 314, 1224 | "src": "460:24:4", 1225 | "typeDescriptions": { 1226 | "typeIdentifier": "t_uint256", 1227 | "typeString": "uint256" 1228 | } 1229 | } 1230 | ], 1231 | "expression": { 1232 | "argumentTypes": [ 1233 | { 1234 | "typeIdentifier": "t_uint256", 1235 | "typeString": "uint256" 1236 | } 1237 | ], 1238 | "expression": { 1239 | "argumentTypes": null, 1240 | "id": 357, 1241 | "name": "upgraded", 1242 | "nodeType": "Identifier", 1243 | "overloadedDeclarations": [], 1244 | "referencedDeclaration": 352, 1245 | "src": "438:8:4", 1246 | "typeDescriptions": { 1247 | "typeIdentifier": "t_contract$_Migrations_$365", 1248 | "typeString": "contract Migrations" 1249 | } 1250 | }, 1251 | "id": 359, 1252 | "isConstant": false, 1253 | "isLValue": false, 1254 | "isPure": false, 1255 | "lValueRequested": false, 1256 | "memberName": "setCompleted", 1257 | "nodeType": "MemberAccess", 1258 | "referencedDeclaration": 344, 1259 | "src": "438:21:4", 1260 | "typeDescriptions": { 1261 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", 1262 | "typeString": "function (uint256) external" 1263 | } 1264 | }, 1265 | "id": 361, 1266 | "isConstant": false, 1267 | "isLValue": false, 1268 | "isPure": false, 1269 | "kind": "functionCall", 1270 | "lValueRequested": false, 1271 | "names": [], 1272 | "nodeType": "FunctionCall", 1273 | "src": "438:47:4", 1274 | "typeDescriptions": { 1275 | "typeIdentifier": "t_tuple$__$", 1276 | "typeString": "tuple()" 1277 | } 1278 | }, 1279 | "id": 362, 1280 | "nodeType": "ExpressionStatement", 1281 | "src": "438:47:4" 1282 | } 1283 | ] 1284 | }, 1285 | "id": 364, 1286 | "implemented": true, 1287 | "isConstructor": false, 1288 | "isDeclaredConst": false, 1289 | "modifiers": [ 1290 | { 1291 | "arguments": [], 1292 | "id": 349, 1293 | "modifierName": { 1294 | "argumentTypes": null, 1295 | "id": 348, 1296 | "name": "restricted", 1297 | "nodeType": "Identifier", 1298 | "overloadedDeclarations": [], 1299 | "referencedDeclaration": 323, 1300 | "src": "370:10:4", 1301 | "typeDescriptions": { 1302 | "typeIdentifier": "t_modifier$__$", 1303 | "typeString": "modifier ()" 1304 | } 1305 | }, 1306 | "nodeType": "ModifierInvocation", 1307 | "src": "370:10:4" 1308 | } 1309 | ], 1310 | "name": "upgrade", 1311 | "nodeType": "FunctionDefinition", 1312 | "parameters": { 1313 | "id": 347, 1314 | "nodeType": "ParameterList", 1315 | "parameters": [ 1316 | { 1317 | "constant": false, 1318 | "id": 346, 1319 | "name": "new_address", 1320 | "nodeType": "VariableDeclaration", 1321 | "scope": 364, 1322 | "src": "349:19:4", 1323 | "stateVariable": false, 1324 | "storageLocation": "default", 1325 | "typeDescriptions": { 1326 | "typeIdentifier": "t_address", 1327 | "typeString": "address" 1328 | }, 1329 | "typeName": { 1330 | "id": 345, 1331 | "name": "address", 1332 | "nodeType": "ElementaryTypeName", 1333 | "src": "349:7:4", 1334 | "typeDescriptions": { 1335 | "typeIdentifier": "t_address", 1336 | "typeString": "address" 1337 | } 1338 | }, 1339 | "value": null, 1340 | "visibility": "internal" 1341 | } 1342 | ], 1343 | "src": "348:21:4" 1344 | }, 1345 | "payable": false, 1346 | "returnParameters": { 1347 | "id": 350, 1348 | "nodeType": "ParameterList", 1349 | "parameters": [], 1350 | "src": "381:0:4" 1351 | }, 1352 | "scope": 365, 1353 | "src": "332:158:4", 1354 | "stateMutability": "nonpayable", 1355 | "superFunction": null, 1356 | "visibility": "public" 1357 | } 1358 | ], 1359 | "scope": 366, 1360 | "src": "25:467:4" 1361 | } 1362 | ], 1363 | "src": "0:493:4" 1364 | }, 1365 | "compiler": { 1366 | "name": "solc", 1367 | "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" 1368 | }, 1369 | "networks": { 1370 | "5777": { 1371 | "events": {}, 1372 | "links": {}, 1373 | "address": "0x8cdaf0cd259887258bc13a92c0a6da92698644c0", 1374 | "transactionHash": "0xfbdb92bc9b1e3b504ffa11efa976ad5670deb6ce5a10523f67770dcba8538e6d" 1375 | }, 1376 | "1494545119391": { 1377 | "events": {}, 1378 | "links": {}, 1379 | "address": "0xe3135bd91c6f0ef0d2848c7bb789c66a69d79bd9", 1380 | "updated_at": 1494545632688 1381 | } 1382 | }, 1383 | "schemaVersion": "2.0.0", 1384 | "updatedAt": "2018-03-19T01:27:49.844Z" 1385 | } -------------------------------------------------------------------------------- /contracts/Calculator.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Calculator { 4 | 5 | uint result; 6 | 7 | constructor() public { 8 | // constructor 9 | result=10; 10 | } 11 | 12 | // returns the result 13 | function getResult() public view returns (uint){ 14 | return result; 15 | } 16 | 17 | // result = result + num 18 | function addToNumber(uint num) public returns (uint) { 19 | result += num; 20 | return result; 21 | } 22 | 23 | // result = result - num 24 | function substractFromNumber(uint num) public returns (uint) { 25 | result -= num; 26 | return result; 27 | } 28 | 29 | // result = result * num 30 | function multiplyWithNumber() public view returns (uint) { 31 | return result; 32 | } 33 | 34 | // result = result / num 35 | function divideNumberBy() public view returns (uint) { 36 | return result; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /contracts/CalculatorV2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract CalculatorV2 { 4 | 5 | uint result; 6 | 7 | event NumberAdded(uint n); 8 | event NumberSubtracted(uint n); 9 | event NumberMultiplied(uint n); 10 | event NumberDivided(uint n); 11 | 12 | constructor(uint num) public { 13 | // constructor 14 | result=num; 15 | } 16 | 17 | // returns the result 18 | function getResult() public view returns (uint){ 19 | return result; 20 | } 21 | 22 | // result = result + num 23 | function addToNumber(uint num) public returns (uint) { 24 | result += num; 25 | emit NumberAdded(num); 26 | return result; 27 | } 28 | 29 | // result = result - num 30 | function substractNumber(uint num) public returns (uint) { 31 | result -= num; 32 | emit NumberSubtracted(num); 33 | return result; 34 | } 35 | 36 | // result = result * num 37 | function multiplyWithNumber(uint num) public returns (uint) { 38 | result *= num; 39 | emit NumberMultiplied(num); 40 | return result; 41 | } 42 | 43 | // result = result / num 44 | function divideByNumber(uint num) public returns (uint) { 45 | result /= num; 46 | emit NumberDivided(num); 47 | return result; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /contracts/HelloEthereumString.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | contract HelloEthereumString { 4 | 5 | // Storage variable for holding last caller 6 | // Declaring a storage variable public leads to 7 | // Automatic generation of getter lastCallerName() 8 | string public lastCallerName; 9 | 10 | // Storage variable for holding the 11 | mapping(address => string) addressNames; 12 | 13 | // Event gets emitted everytime someone calls the hello function 14 | event HelloInvoked(string indexed name); 15 | 16 | function HelloEthereumString() public { 17 | // constructor 18 | lastCallerName = 'not-set'; 19 | } 20 | 21 | /** 22 | * Receives a string of 32 bytes 23 | * 1. Generates an event 24 | * 2. Adds the address-name to the mapping 25 | * 3. Set the last caller name 26 | **/ 27 | function hello(string name) public { 28 | // Invoke the event 29 | HelloInvoked(name); 30 | 31 | // Add to mapping 32 | addressNames[msg.sender] = name; 33 | 34 | // Set the last caller name 35 | lastCallerName = name; 36 | } 37 | 38 | /** 39 | * Return 2 values 40 | * 1. Last Caller Name 41 | * 2. Caller's name if it is there in the mapping 42 | **/ 43 | function getNames() public constant returns (string lastCaller, string callerName){ 44 | lastCaller = lastCallerName; 45 | callerName = addressNames[msg.sender]; 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /contracts/InteractionChannel.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | /** 4 | * Part of a course on Blockchain 5 | **/ 6 | contract InteractionChannel { 7 | 8 | bytes32 name; 9 | uint lastUpdate; 10 | address lastAddress; 11 | 12 | event Interaction(bytes32 indexed name, address indexed addr, uint indexed timeUpdated); 13 | 14 | 15 | function currentName() public constant returns(bytes32){ 16 | return name; 17 | } 18 | 19 | function lastUpdatedMinutes() public constant returns(uint){ 20 | return ((now - lastUpdate)/60); 21 | } 22 | 23 | function fromAddres() public constant returns(address){ 24 | return lastAddress; 25 | } 26 | 27 | function interact(bytes32 yourName) public { 28 | name = yourName; 29 | lastAddress = msg.sender; 30 | lastUpdate = now; 31 | emit Interaction(name,lastAddress,lastUpdate); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /contracts/InteractionChannelV2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | /** 4 | * Part of a course on Blockchain 5 | **/ 6 | contract InteractionChannel { 7 | 8 | string name; 9 | uint lastUpdate; 10 | address lastAddress; 11 | 12 | event Interaction(string indexed name, address indexed addr, uint indexed timeUpdated); 13 | 14 | 15 | function currentName() public constant returns(string){ 16 | return name; 17 | } 18 | 19 | function lastUpdatedMinutes() public constant returns(uint){ 20 | return ((now - lastUpdate)/60); 21 | } 22 | 23 | function fromAddres() public constant returns(address){ 24 | return lastAddress; 25 | } 26 | 27 | function interact(string yourName) public { 28 | name = yourName; 29 | lastAddress = msg.sender; 30 | lastUpdate = now; 31 | emit Interaction(name,lastAddress,lastUpdate); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.2; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | function Migrations() { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | // #1 Get an instance of the contract to be deployed/migrated 2 | var Calculator = artifacts.require("./Calculator.sol"); 3 | var CalculatorV2 = artifacts.require("./CalculatorV2.sol"); 4 | 5 | module.exports = function(deployer) { 6 | // #2 Deploy the instance of the contract 7 | deployer.deploy(Calculator);//, 10); 8 | deployer.deploy(CalculatorV2, 10); 9 | }; 10 | 11 | 12 | -------------------------------------------------------------------------------- /template/Calculator.sol: -------------------------------------------------------------------------------- 1 | /** 2 | * Skeleton code for Calculator 3 | * This contract is for demonstrating the use of Truffle framework. 4 | **/ 5 | 6 | pragma solidity ^0.4.6; 7 | 8 | contract Calculator { 9 | 10 | // Result of the operation are always stored in this variable 11 | uint result=10; 12 | 13 | function Calculator() { 14 | // constructor 15 | } 16 | 17 | // returns the result 18 | function getResult() returns (uint){ 19 | return result; 20 | } 21 | 22 | // result = result + num 23 | function addToNumber(uint num) returns (uint) { 24 | return result; 25 | } 26 | 27 | // result = result - num 28 | function substractNumber(uint num) returns (uint) { 29 | return result; 30 | } 31 | 32 | // result = result * num 33 | function multiplyWithNumber(uint num) returns (uint) { 34 | return result; 35 | } 36 | 37 | // result = result / num 38 | function divideByNumber(uint num) returns (uint) { 39 | return result; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /template/calculator.case3.js: -------------------------------------------------------------------------------- 1 | // SOLUTION to the exercise 2 | // Please copy/paste the code in /test/calculator.js 3 | 4 | // Test case#3 Checks if calls to multiply/divide for ((Initial_Value * 10) / 5) = 20 5 | it("should multiply by 10 and then diide by 5 to get a result=20", function () { 6 | // Transaction 7 | var calculator = null; 8 | // Create a new dployment of contract so that result=10 9 | return Calculator.new().then(function (instance) { 10 | calculator = instance 11 | // Multiply by 10 12 | return calculator.multiplyWithNumber(10, from) 13 | }).then(function () { 14 | return calculator.getResult.call(); 15 | }).then(function (result) { 16 | // Check if the result = 100 17 | assert.equal(result.toNumber(), 100, "Result after multiplying with 10 should be 100"); 18 | // Now divide by 5 19 | return calculator.divideByNumber(5, from); 20 | }).then(function () { 21 | return calculator.getResult.call(); 22 | }).then(function (result) { 23 | assert.equal(result.toNumber(), 20, "Result after dividing with 5 should be 20"); 24 | }); 25 | }); -------------------------------------------------------------------------------- /test/calculator.js: -------------------------------------------------------------------------------- 1 | var Calculator = artifacts.require("./Calculator.sol"); 2 | 3 | contract('Calculator', function(accounts) { 4 | 5 | // Expected behavior - result is initialized to 10 6 | // Test Case#1 7 | it("should assert true", function() { 8 | var calculator; 9 | return Calculator.deployed().then(function(instance){ 10 | calculator = instance; 11 | return calculator.getResult.call(); 12 | }).then(function (result) { 13 | assert.equal(result.valueOf(), 10, "Contract initialized with value NOT equal to 10!!!"); 14 | }); 15 | }); 16 | 17 | // Test case#2 Checks if calls to add/subtract for ((Initial_Value + 10) - 5) = 15 18 | it("should add 10 and then substract 5 to get a result=15", function () { 19 | // Get the deployed instance 20 | var calculator; 21 | 22 | return Calculator.deployed().then(function(instance){ 23 | calculator = instance; 24 | return calculator.addToNumber(10) 25 | }).then(function () { 26 | return calculator.getResult.call(); 27 | }).then(function (result) { 28 | 29 | assert.equal(result.toNumber(), 20, "Result after adding 10 should be 20"); 30 | // Now substract 10 31 | return calculator.substractNumber(5) 32 | }).then(function () { 33 | return calculator.getResult.call(); 34 | }).then(function (result) { 35 | assert.equal(result.toNumber(), 15, "Result after subtracting 5 should be 15"); 36 | }); 37 | }); 38 | 39 | // Add Test Case#3 here 40 | 41 | // Add Test Case#4 here 42 | }); 43 | -------------------------------------------------------------------------------- /test/calculatorV2.js: -------------------------------------------------------------------------------- 1 | var Calculator = artifacts.require("./CalculatorV2.sol"); 2 | 3 | contract('Calculator', function(accounts) { 4 | 5 | // Expected behavior - result is initialized to 10 6 | // Test Case#1 7 | it("should assert true", function() { 8 | var calculator; 9 | return Calculator.deployed().then(function(instance){ 10 | calculator = instance; 11 | return calculator.getResult.call(); 12 | }).then(function (result) { 13 | assert.equal(result.valueOf(), 10, "Contract initialized with value NOT equal to 10!!!"); 14 | }); 15 | }); 16 | 17 | // Test case#2 Checks if calls to add/subtract for ((Initial_Value + 10) - 5) = 15 18 | it("should add 10 and then substract 5 to get a result=15", function () { 19 | // Get the deployed instance 20 | var calculator; 21 | 22 | return Calculator.deployed().then(function(instance){ 23 | calculator = instance; 24 | return calculator.addToNumber(10) 25 | }).then(function () { 26 | return calculator.getResult.call(); 27 | }).then(function (result) { 28 | 29 | assert.equal(result.toNumber(), 20, "Result after adding 10 should be 20"); 30 | // Now substract 10 31 | return calculator.substractNumber(5) 32 | }).then(function () { 33 | return calculator.getResult.call(); 34 | }).then(function (result) { 35 | assert.equal(result.toNumber(), 15, "Result after subtracting 5 should be 15"); 36 | }); 37 | }); 38 | 39 | // Add Test Case#3 here 40 | 41 | // Add Test Case#4 here 42 | }); 43 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | networks: { 3 | development: { 4 | host: "localhost", 5 | port: 8545, 6 | network_id: "*" // Match any network id 7 | }, 8 | 9 | QA: { 10 | host: "localhost", 11 | port: 8545, 12 | network_id: "3" , // ROPSTEN 13 | // Options - gas, gasPrice, from 14 | }, 15 | 16 | PRODUCTION: { 17 | host: "localhost", 18 | port: 8545, 19 | network_id: "1" // LIVE 20 | // Options - gas, gasPrice, from 21 | } 22 | } 23 | }; 24 | 25 | --------------------------------------------------------------------------------