diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cbaeb9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Build and Release Folders +bin-debug/ +bin-release/ +[Oo]bj/ +[Bb]in/ + +# Other files and folders +.settings/ +node_modules/ +build/ +package-lock.json +__pycache__/ +# Executables +*.swf +*.air +*.ipa +*.apk +.env +*.env diff --git a/README.md b/README.md index 4602430..86eabbe 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,26 @@ -# IoT-and-Blockchain +## IoT-and-Blockchain -follow this medium article for in instructions https://link.medium.com/TcNvHHZoY1 +- [Demonstration Article](https://link.medium.com/TcNvHHZoY1) - © Salman Dabbakuti +##### Quick Demo +``` +git clone https://github.com/Salmandabbakuti/IoT-and-Blockchain.git +cd IoT-and-Blockchain +npm install +ganache-cli # local testnet for deployments +truffle compile +pip install -r requirements.txt +python app.py # Headover to your Computer IP on browser for UI + +python appRemote.py # Needs to add your private key inorder to work. +``` +##### UI: + + + + + ##### Author + +##### :wave: [Salman Dabbakuti](https://salmandabbakuti.github.io) + +Buy Me A Coffee diff --git a/Screenshot (79).png b/Screenshot (79).png deleted file mode 100644 index 59b29e5..0000000 Binary files a/Screenshot (79).png and /dev/null differ diff --git a/__pycache__/EmulatorGUI.cpython-37.pyc b/__pycache__/EmulatorGUI.cpython-37.pyc deleted file mode 100644 index 7d74830..0000000 Binary files a/__pycache__/EmulatorGUI.cpython-37.pyc and /dev/null differ diff --git a/__pycache__/PIN.cpython-37.pyc b/__pycache__/PIN.cpython-37.pyc deleted file mode 100644 index 68c2b34..0000000 Binary files a/__pycache__/PIN.cpython-37.pyc and /dev/null differ diff --git a/__pycache__/TypeChecker.cpython-37.pyc b/__pycache__/TypeChecker.cpython-37.pyc deleted file mode 100644 index fc5ce8b..0000000 Binary files a/__pycache__/TypeChecker.cpython-37.pyc and /dev/null differ diff --git a/appRemote.py b/appRemote.py new file mode 100644 index 0000000..165239b --- /dev/null +++ b/appRemote.py @@ -0,0 +1,127 @@ +import json +from web3 import Web3, HTTPProvider +from web3.contract import ConciseContract +from EmulatorGUI import GPIO +from flask import Flask, render_template, request +#from RPiSim import GPIO +# GPIO setup +GPIO.setmode(GPIO.BCM) +GPIO.setwarnings(False) +pinList = [14, 15, 18, 23, 24, 25, 8,7, 12, 16, 20, 21, 2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26] +for i in pinList: + GPIO.setup(i, GPIO.OUT) +w3 = Web3(HTTPProvider("https://testnet-rpc.gochain.io/")) +# compile your smart contract with truffle first +truffleFile = json.load(open('./build/contracts/homeAutomation.json')) +abi = truffleFile['abi'] +bytecode = truffleFile['bytecode'] +key="" +acct = w3.eth.account.privateKeyToAccount(key) +account_address= acct.address +# web3.py instance + + + +# Instantiate and deploy contract +contract = w3.eth.contract(abi=abi, bytecode=bytecode) + +# Get tx receipt to get contract address +contract_address = Web3.toChecksumAddress("0xf30bd40783da0c35819b61d4b6a4e1aaa604e9af") # deployed ata testnet gochain + +# Contract instance in concise mode +contract_instance = w3.eth.contract(abi=abi, address=contract_address) + +#Contro Interface +for i in pinList: + print(i, 'Status: {}' .format(contract_instance.functions.pinStatus(i).call())) + +app = Flask(__name__) +@app.route("/") +def index(): + templateData = { + 'title' : 'GPIO output Status!' + } + return render_template('index.html', **templateData) + +@app.route("//") +def control(pin, action): + contract_instance = w3.eth.contract(abi=abi, address=contract_address) + + if pin=='fourteen': + actuator=14 + if pin=='fifteen': + actuator=15 + if pin=='eighteen': + actuator=18 + if pin=='twentythree': + actuator=23 + if pin=='twentyfour': + actuator=24 + if pin=='twentyfive': + actuator=25 + if pin=='eight': + actuator=8 + if pin=='seven': + actuator=7 + if pin=='twelve': + actuator=12 + if pin=='sixteen': + actuator=16 + if pin=='twenty': + actuator=20 + if pin=='twentyone': + actuator=21 + if pin=='two': + actuator=2 + if pin=='three': + actuator=3 + if pin=='four': + actuator=4 + if pin=='seventeen': + actuator=17 + if pin=='twentyseven': + actuator=27 + if pin=='twentytwo': + actuator=22 + if pin=='ten': + actuator=10 + if pin=='nine': + actuator=9 + if pin=='eleven': + actuator=11 + if pin=='five': + actuator=5 + if pin=='six': + actuator=6 + if pin=='thirteen': + actuator=13 + if pin=='nineteen': + actuator=19 + if pin=='twentysix': + actuator=26 + + + if action=='on': + config=1 + if action=='off': + config=0 + tx = contract_instance.functions.control(actuator,config).buildTransaction({'nonce': w3.eth.getTransactionCount(account_address),'gas': 1728712, 'gasPrice': w3.toWei('10', 'gwei')}) + signed_tx = w3.eth.account.signTransaction(tx, key) + tx_hash= w3.eth.sendRawTransaction(signed_tx.rawTransaction) + w3.eth.waitForTransactionReceipt(tx_hash) + print("Transaction its Way..") + y=format(contract_instance.functions.pinStatus(actuator).call()) + print(y) + if y=="1": + GPIO.output(actuator,GPIO.HIGH) + else: + GPIO.output(actuator,GPIO.LOW) + templateData = { + 'title': "GPIO Control" + } + return render_template('index.html', **templateData) +if __name__ == '__main__': + app.run(debug=True, port=80, host='0.0.0.0') + + +#Developed by Salman Dabbakuti diff --git a/assets/README.md b/assets/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/assets/README.md @@ -0,0 +1 @@ + diff --git a/Screenshot (81).png b/assets/screen.png similarity index 100% rename from Screenshot (81).png rename to assets/screen.png diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json deleted file mode 100644 index 05e1eaa..0000000 --- a/build/contracts/Migrations.json +++ /dev/null @@ -1,1384 +0,0 @@ -{ - "contractName": "Migrations", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "last_completed_migration", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": false, - "inputs": [ - { - "name": "completed", - "type": "uint256" - } - ], - "name": "setCompleted", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "new_address", - "type": "address" - } - ], - "name": "upgrade", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610314806100606000396000f3fe608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a723058207794189b5c995d3905becebd2810fa0493eca4d0f5ae3c53ebdc83ccbfbf4c3b0029", - "deployedBytecode": "0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100b85780638da5cb5b146100e3578063fdacd5761461013a575b600080fd5b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610175565b005b3480156100c457600080fd5b506100cd61025d565b6040518082815260200191505060405180910390f35b3480156100ef57600080fd5b506100f8610263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014657600080fd5b506101736004803603602081101561015d57600080fd5b8101908080359060200190929190505050610288565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025a5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561024057600080fd5b505af1158015610254573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102e557806001819055505b5056fea165627a7a723058207794189b5c995d3905becebd2810fa0493eca4d0f5ae3c53ebdc83ccbfbf4c3b0029", - "sourceMap": "34:480:0:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:0;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;", - "deployedSourceMap": "34:480:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;8:9:-1;5:2;;;30:1;27;20:12;5:2;347:165:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:0;;;;;;;;;;;;;;;;;;;;;;82:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;82:36:0;;;;;;;;;;;;;;;;;;;;;;;58:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;58:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;8:9:-1;5:2;;;30:1;27;20:12;5:2;240:103:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;240:103:0;;;;;;;;;;;;;;;;;;;;347:165;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;409:19;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:0;;;;230:1;205:26;347:165;:::o;82:36::-;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o", - "source": "pragma solidity >=0.4.21 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", - "sourcePath": "C:/Users/Salman Dabbakuti/Desktop/rpipin/contracts/Migrations.sol", - "ast": { - "absolutePath": "/C/Users/Salman Dabbakuti/Desktop/rpipin/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 56 - ] - }, - "id": 57, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:32:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 56, - "linearizedBaseContracts": [ - 56 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 3, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 56, - "src": "58:20:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "58:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 5, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 56, - "src": "82:36:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 4, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "82:4:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 13, - "nodeType": "Block", - "src": "144:29:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 11, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 8, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "150:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 9, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 114, - "src": "158:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 10, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "158:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "150:18:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 12, - "nodeType": "ExpressionStatement", - "src": "150:18:0" - } - ] - }, - "documentation": null, - "id": 14, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 6, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:0" - }, - "returnParameters": { - "id": 7, - "nodeType": "ParameterList", - "parameters": [], - "src": "144:0:0" - }, - "scope": 56, - "src": "123:50:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 22, - "nodeType": "Block", - "src": "199:37:0", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 19, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 16, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 114, - "src": "209:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 17, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "209:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 18, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "223:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "209:19:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 21, - "nodeType": "IfStatement", - "src": "205:26:0", - "trueBody": { - "id": 20, - "nodeType": "PlaceholderStatement", - "src": "230:1:0" - } - } - ] - }, - "documentation": null, - "id": 23, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 15, - "nodeType": "ParameterList", - "parameters": [], - "src": "196:2:0" - }, - "src": "177:59:0", - "visibility": "internal" - }, - { - "body": { - "id": 34, - "nodeType": "Block", - "src": "296:47:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 32, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 30, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "302:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 31, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 25, - "src": "329:9:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "302:36:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 33, - "nodeType": "ExpressionStatement", - "src": "302:36:0" - } - ] - }, - "documentation": null, - "id": 35, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 28, - "modifierName": { - "argumentTypes": null, - "id": 27, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 23, - "src": "285:10:0", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "285:10:0" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 26, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 25, - "name": "completed", - "nodeType": "VariableDeclaration", - "scope": 35, - "src": "262:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 24, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "262:4:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "261:16:0" - }, - "returnParameters": { - "id": 29, - "nodeType": "ParameterList", - "parameters": [], - "src": "296:0:0" - }, - "scope": 56, - "src": "240:103:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 54, - "nodeType": "Block", - "src": "403:109:0", - "statements": [ - { - "assignments": [ - 43 - ], - "declarations": [ - { - "constant": false, - "id": 43, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 54, - "src": "409:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 42, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 56, - "src": "409:10:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 47, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 45, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 37, - "src": "442:11:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 44, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 56, - "src": "431:10:0", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$56_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 46, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "431:23:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "409:45:0" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 51, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "482:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 48, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 43, - "src": "460:8:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "id": 50, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 35, - "src": "460:21:0", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 52, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "460:47:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 53, - "nodeType": "ExpressionStatement", - "src": "460:47:0" - } - ] - }, - "documentation": null, - "id": 55, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 40, - "modifierName": { - "argumentTypes": null, - "id": 39, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 23, - "src": "392:10:0", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "392:10:0" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 38, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 37, - "name": "new_address", - "nodeType": "VariableDeclaration", - "scope": 55, - "src": "364:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 36, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "364:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "363:21:0" - }, - "returnParameters": { - "id": 41, - "nodeType": "ParameterList", - "parameters": [], - "src": "403:0:0" - }, - "scope": 56, - "src": "347:165:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 57, - "src": "34:480:0" - } - ], - "src": "0:515:0" - }, - "legacyAST": { - "absolutePath": "/C/Users/Salman Dabbakuti/Desktop/rpipin/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 56 - ] - }, - "id": 57, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - ">=", - "0.4", - ".21", - "<", - "0.6", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:32:0" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 56, - "linearizedBaseContracts": [ - 56 - ], - "name": "Migrations", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 3, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 56, - "src": "58:20:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 2, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "58:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "public" - }, - { - "constant": false, - "id": 5, - "name": "last_completed_migration", - "nodeType": "VariableDeclaration", - "scope": 56, - "src": "82:36:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 4, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "82:4:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 13, - "nodeType": "Block", - "src": "144:29:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 11, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 8, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "150:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 9, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 114, - "src": "158:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 10, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "158:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "150:18:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 12, - "nodeType": "ExpressionStatement", - "src": "150:18:0" - } - ] - }, - "documentation": null, - "id": 14, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 6, - "nodeType": "ParameterList", - "parameters": [], - "src": "134:2:0" - }, - "returnParameters": { - "id": 7, - "nodeType": "ParameterList", - "parameters": [], - "src": "144:0:0" - }, - "scope": 56, - "src": "123:50:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 22, - "nodeType": "Block", - "src": "199:37:0", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 19, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 16, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 114, - "src": "209:3:0", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 17, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "209:10:0", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 18, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "223:5:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "209:19:0", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 21, - "nodeType": "IfStatement", - "src": "205:26:0", - "trueBody": { - "id": 20, - "nodeType": "PlaceholderStatement", - "src": "230:1:0" - } - } - ] - }, - "documentation": null, - "id": 23, - "name": "restricted", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 15, - "nodeType": "ParameterList", - "parameters": [], - "src": "196:2:0" - }, - "src": "177:59:0", - "visibility": "internal" - }, - { - "body": { - "id": 34, - "nodeType": "Block", - "src": "296:47:0", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 32, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 30, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "302:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 31, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 25, - "src": "329:9:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "302:36:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 33, - "nodeType": "ExpressionStatement", - "src": "302:36:0" - } - ] - }, - "documentation": null, - "id": 35, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 28, - "modifierName": { - "argumentTypes": null, - "id": 27, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 23, - "src": "285:10:0", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "285:10:0" - } - ], - "name": "setCompleted", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 26, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 25, - "name": "completed", - "nodeType": "VariableDeclaration", - "scope": 35, - "src": "262:14:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 24, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "262:4:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "261:16:0" - }, - "returnParameters": { - "id": 29, - "nodeType": "ParameterList", - "parameters": [], - "src": "296:0:0" - }, - "scope": 56, - "src": "240:103:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 54, - "nodeType": "Block", - "src": "403:109:0", - "statements": [ - { - "assignments": [ - 43 - ], - "declarations": [ - { - "constant": false, - "id": 43, - "name": "upgraded", - "nodeType": "VariableDeclaration", - "scope": 54, - "src": "409:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - }, - "typeName": { - "contractScope": null, - "id": 42, - "name": "Migrations", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 56, - "src": "409:10:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 47, - "initialValue": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 45, - "name": "new_address", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 37, - "src": "442:11:0", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 44, - "name": "Migrations", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 56, - "src": "431:10:0", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_Migrations_$56_$", - "typeString": "type(contract Migrations)" - } - }, - "id": 46, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "typeConversion", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "431:23:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "409:45:0" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 51, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 5, - "src": "482:24:0", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 48, - "name": "upgraded", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 43, - "src": "460:8:0", - "typeDescriptions": { - "typeIdentifier": "t_contract$_Migrations_$56", - "typeString": "contract Migrations" - } - }, - "id": 50, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "setCompleted", - "nodeType": "MemberAccess", - "referencedDeclaration": 35, - "src": "460:21:0", - "typeDescriptions": { - "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256) external" - } - }, - "id": 52, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "460:47:0", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 53, - "nodeType": "ExpressionStatement", - "src": "460:47:0" - } - ] - }, - "documentation": null, - "id": 55, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "arguments": null, - "id": 40, - "modifierName": { - "argumentTypes": null, - "id": 39, - "name": "restricted", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 23, - "src": "392:10:0", - "typeDescriptions": { - "typeIdentifier": "t_modifier$__$", - "typeString": "modifier ()" - } - }, - "nodeType": "ModifierInvocation", - "src": "392:10:0" - } - ], - "name": "upgrade", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 38, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 37, - "name": "new_address", - "nodeType": "VariableDeclaration", - "scope": 55, - "src": "364:19:0", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 36, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "364:7:0", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "363:21:0" - }, - "returnParameters": { - "id": 41, - "nodeType": "ParameterList", - "parameters": [], - "src": "403:0:0" - }, - "scope": 56, - "src": "347:165:0", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 57, - "src": "34:480:0" - } - ], - "src": "0:515:0" - }, - "compiler": { - "name": "solc", - "version": "0.5.0+commit.1d4f565a.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "3.0.2", - "updatedAt": "2019-03-22T17:34:33.307Z", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/build/contracts/homeAutomation.json b/build/contracts/homeAutomation.json deleted file mode 100644 index a07fe83..0000000 --- a/build/contracts/homeAutomation.json +++ /dev/null @@ -1,1319 +0,0 @@ -{ - "contractName": "homeAutomation", - "abi": [ - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "pinStatus", - "outputs": [ - { - "name": "status", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": false, - "inputs": [ - { - "name": "_pin", - "type": "uint256" - }, - { - "name": "_status", - "type": "uint256" - } - ], - "name": "control", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600180600060048152602001908152602001600020600001819055506101a98061007c6000396000f3fe60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cf3d014610051578063438ea768146100a0575b600080fd5b34801561005d57600080fd5b5061008a6004803603602081101561007457600080fd5b81019080803590602001909291905050506100e5565b6040518082815260200191505060405180910390f35b3480156100ac57600080fd5b506100e3600480360360408110156100c357600080fd5b810190808035906020019092919080359060200190929190505050610103565b005b60016020528060005260406000206000915090508060000154905081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015e57600080fd5b806001600084815260200190815260200160002060000181905550505056fea165627a7a72305820568b92567572a72866a6824f8bf5eb8e6b1360f76227d25bc9f39ca1b36d68c30029", - "deployedBytecode": "0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cf3d014610051578063438ea768146100a0575b600080fd5b34801561005d57600080fd5b5061008a6004803603602081101561007457600080fd5b81019080803590602001909291905050506100e5565b6040518082815260200191505060405180910390f35b3480156100ac57600080fd5b506100e3600480360360408110156100c357600080fd5b810190808035906020019092919080359060200190929190505050610103565b005b60016020528060005260406000206000915090508060000154905081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015e57600080fd5b806001600084815260200190815260200160002060000181905550505056fea165627a7a72305820568b92567572a72866a6824f8bf5eb8e6b1360f76227d25bc9f39ca1b36d68c30029", - "sourceMap": "27:375:1:-;;;81:92;8:9:-1;5:2;;;30:1;27;20:12;5:2;81:92:1;118:10;112:5;;:16;;;;;;;;;;;;;;;;;;158:1;138:9;:12;148:1;138:12;;;;;;;;;;;:19;;:21;;;;27:375;;;;;;", - "deployedSourceMap": "27:375:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;220:35;;8:9:-1;5:2;;;30:1;27;20:12;5:2;220:35:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;220:35:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;265:132;;8:9:-1;5:2;;;30:1;27;20:12;5:2;265:132:1;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;265:132:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;220:35;;;;;;;;;;;;;;;;;;;;;;:::o;265:132::-;343:5;;;;;;;;;;;331:17;;:10;:17;;;323:26;;;;;;;;382:7;359:9;:15;369:4;359:15;;;;;;;;;;;:22;;:30;;;;265:132;;:::o", - "source": "pragma solidity ^0.5.0;\r\n\r\ncontract homeAutomation{\r\n \r\n address owner;\r\n constructor() public {\r\n owner=msg.sender;\r\n pinStatus[4].status=1;\r\n }\r\n struct pin{\r\n uint status;\r\n }\r\n mapping(uint=>pin) public pinStatus;\r\n \r\n function control(uint _pin, uint _status)public {\r\n require(msg.sender==owner);\r\n pinStatus[_pin].status=_status;\r\n }\r\n\r\n}\r\n \r\n", - "sourcePath": "C:/Users/Salman Dabbakuti/Desktop/rpipin/contracts/pinControl.sol", - "ast": { - "absolutePath": "/C/Users/Salman Dabbakuti/Desktop/rpipin/contracts/pinControl.sol", - "exportedSymbols": { - "homeAutomation": [ - 106 - ] - }, - "id": 107, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 58, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:1" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 106, - "linearizedBaseContracts": [ - 106 - ], - "name": "homeAutomation", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 60, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 106, - "src": "62:13:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 59, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "62:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "body": { - "id": 75, - "nodeType": "Block", - "src": "102:71:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 66, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 63, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 60, - "src": "112:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 64, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "118:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 65, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "118:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "112:16:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 67, - "nodeType": "ExpressionStatement", - "src": "112:16:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 73, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 68, - "name": "pinStatus", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 83, - "src": "138:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin storage ref)" - } - }, - "id": 70, - "indexExpression": { - "argumentTypes": null, - "hexValue": "34", - "id": 69, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "148:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_4_by_1", - "typeString": "int_const 4" - }, - "value": "4" - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "138:12:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage", - "typeString": "struct homeAutomation.pin storage ref" - } - }, - "id": 71, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "status", - "nodeType": "MemberAccess", - "referencedDeclaration": 78, - "src": "138:19:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "31", - "id": 72, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "158:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "138:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 74, - "nodeType": "ExpressionStatement", - "src": "138:21:1" - } - ] - }, - "documentation": null, - "id": 76, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 61, - "nodeType": "ParameterList", - "parameters": [], - "src": "92:2:1" - }, - "returnParameters": { - "id": 62, - "nodeType": "ParameterList", - "parameters": [], - "src": "102:0:1" - }, - "scope": 106, - "src": "81:92:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "canonicalName": "homeAutomation.pin", - "id": 79, - "members": [ - { - "constant": false, - "id": 78, - "name": "status", - "nodeType": "VariableDeclaration", - "scope": 79, - "src": "197:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 77, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "197:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "name": "pin", - "nodeType": "StructDefinition", - "scope": 106, - "src": "178:37:1", - "visibility": "public" - }, - { - "constant": false, - "id": 83, - "name": "pinStatus", - "nodeType": "VariableDeclaration", - "scope": 106, - "src": "220:35:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin)" - }, - "typeName": { - "id": 82, - "keyType": { - "id": 80, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "228:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Mapping", - "src": "220:18:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin)" - }, - "valueType": { - "contractScope": null, - "id": 81, - "name": "pin", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 79, - "src": "234:3:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage_ptr", - "typeString": "struct homeAutomation.pin" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 104, - "nodeType": "Block", - "src": "313:84:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 94, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 91, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "331:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 92, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "331:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 93, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 60, - "src": "343:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "331:17:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 90, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 124, - 125 - ], - "referencedDeclaration": 124, - "src": "323:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 95, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "323:26:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 96, - "nodeType": "ExpressionStatement", - "src": "323:26:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 102, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 97, - "name": "pinStatus", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 83, - "src": "359:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin storage ref)" - } - }, - "id": 99, - "indexExpression": { - "argumentTypes": null, - "id": 98, - "name": "_pin", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 85, - "src": "369:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "359:15:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage", - "typeString": "struct homeAutomation.pin storage ref" - } - }, - "id": 100, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "status", - "nodeType": "MemberAccess", - "referencedDeclaration": 78, - "src": "359:22:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 101, - "name": "_status", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "382:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "359:30:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 103, - "nodeType": "ExpressionStatement", - "src": "359:30:1" - } - ] - }, - "documentation": null, - "id": 105, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "control", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 88, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 85, - "name": "_pin", - "nodeType": "VariableDeclaration", - "scope": 105, - "src": "282:9:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 84, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "282:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 87, - "name": "_status", - "nodeType": "VariableDeclaration", - "scope": 105, - "src": "293:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 86, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "293:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "281:25:1" - }, - "returnParameters": { - "id": 89, - "nodeType": "ParameterList", - "parameters": [], - "src": "313:0:1" - }, - "scope": 106, - "src": "265:132:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 107, - "src": "27:375:1" - } - ], - "src": "0:410:1" - }, - "legacyAST": { - "absolutePath": "/C/Users/Salman Dabbakuti/Desktop/rpipin/contracts/pinControl.sol", - "exportedSymbols": { - "homeAutomation": [ - 106 - ] - }, - "id": 107, - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 58, - "literals": [ - "solidity", - "^", - "0.5", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "0:23:1" - }, - { - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "documentation": null, - "fullyImplemented": true, - "id": 106, - "linearizedBaseContracts": [ - 106 - ], - "name": "homeAutomation", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "id": 60, - "name": "owner", - "nodeType": "VariableDeclaration", - "scope": 106, - "src": "62:13:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 59, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "62:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": null, - "visibility": "internal" - }, - { - "body": { - "id": 75, - "nodeType": "Block", - "src": "102:71:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 66, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 63, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 60, - "src": "112:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 64, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "118:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 65, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "118:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "src": "112:16:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 67, - "nodeType": "ExpressionStatement", - "src": "112:16:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 73, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 68, - "name": "pinStatus", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 83, - "src": "138:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin storage ref)" - } - }, - "id": 70, - "indexExpression": { - "argumentTypes": null, - "hexValue": "34", - "id": 69, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "148:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_4_by_1", - "typeString": "int_const 4" - }, - "value": "4" - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "138:12:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage", - "typeString": "struct homeAutomation.pin storage ref" - } - }, - "id": 71, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "status", - "nodeType": "MemberAccess", - "referencedDeclaration": 78, - "src": "138:19:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "31", - "id": 72, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "158:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_1_by_1", - "typeString": "int_const 1" - }, - "value": "1" - }, - "src": "138:21:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 74, - "nodeType": "ExpressionStatement", - "src": "138:21:1" - } - ] - }, - "documentation": null, - "id": 76, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 61, - "nodeType": "ParameterList", - "parameters": [], - "src": "92:2:1" - }, - "returnParameters": { - "id": 62, - "nodeType": "ParameterList", - "parameters": [], - "src": "102:0:1" - }, - "scope": 106, - "src": "81:92:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - }, - { - "canonicalName": "homeAutomation.pin", - "id": 79, - "members": [ - { - "constant": false, - "id": 78, - "name": "status", - "nodeType": "VariableDeclaration", - "scope": 79, - "src": "197:11:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 77, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "197:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "name": "pin", - "nodeType": "StructDefinition", - "scope": 106, - "src": "178:37:1", - "visibility": "public" - }, - { - "constant": false, - "id": 83, - "name": "pinStatus", - "nodeType": "VariableDeclaration", - "scope": 106, - "src": "220:35:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin)" - }, - "typeName": { - "id": 82, - "keyType": { - "id": 80, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "228:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Mapping", - "src": "220:18:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin)" - }, - "valueType": { - "contractScope": null, - "id": 81, - "name": "pin", - "nodeType": "UserDefinedTypeName", - "referencedDeclaration": 79, - "src": "234:3:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage_ptr", - "typeString": "struct homeAutomation.pin" - } - } - }, - "value": null, - "visibility": "public" - }, - { - "body": { - "id": 104, - "nodeType": "Block", - "src": "313:84:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 94, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 91, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 121, - "src": "331:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 92, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "331:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address_payable", - "typeString": "address payable" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "argumentTypes": null, - "id": 93, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 60, - "src": "343:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "331:17:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - ], - "id": 90, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 124, - 125 - ], - "referencedDeclaration": 124, - "src": "323:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", - "typeString": "function (bool) pure" - } - }, - "id": 95, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "323:26:1", - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 96, - "nodeType": "ExpressionStatement", - "src": "323:26:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 102, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 97, - "name": "pinStatus", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 83, - "src": "359:9:1", - "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_pin_$79_storage_$", - "typeString": "mapping(uint256 => struct homeAutomation.pin storage ref)" - } - }, - "id": 99, - "indexExpression": { - "argumentTypes": null, - "id": 98, - "name": "_pin", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 85, - "src": "369:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "359:15:1", - "typeDescriptions": { - "typeIdentifier": "t_struct$_pin_$79_storage", - "typeString": "struct homeAutomation.pin storage ref" - } - }, - "id": 100, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": true, - "memberName": "status", - "nodeType": "MemberAccess", - "referencedDeclaration": 78, - "src": "359:22:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "id": 101, - "name": "_status", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 87, - "src": "382:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "359:30:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 103, - "nodeType": "ExpressionStatement", - "src": "359:30:1" - } - ] - }, - "documentation": null, - "id": 105, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "control", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 88, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 85, - "name": "_pin", - "nodeType": "VariableDeclaration", - "scope": 105, - "src": "282:9:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 84, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "282:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - }, - { - "constant": false, - "id": 87, - "name": "_status", - "nodeType": "VariableDeclaration", - "scope": 105, - "src": "293:12:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 86, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "293:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "src": "281:25:1" - }, - "returnParameters": { - "id": 89, - "nodeType": "ParameterList", - "parameters": [], - "src": "313:0:1" - }, - "scope": 106, - "src": "265:132:1", - "stateMutability": "nonpayable", - "superFunction": null, - "visibility": "public" - } - ], - "scope": 107, - "src": "27:375:1" - } - ], - "src": "0:410:1" - }, - "compiler": { - "name": "solc", - "version": "0.5.0+commit.1d4f565a.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "3.0.2", - "updatedAt": "2019-03-22T17:57:10.062Z", - "devdoc": { - "methods": {} - }, - "userdoc": { - "methods": {} - } -} \ No newline at end of file diff --git a/demo.mp4 b/demo.mp4 deleted file mode 100644 index fd45af7..0000000 Binary files a/demo.mp4 and /dev/null differ diff --git a/demo1.mp4 b/demo1.mp4 deleted file mode 100644 index 5696859..0000000 Binary files a/demo1.mp4 and /dev/null differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..1e3ebfe --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "iot-blockchain-demo", + "version": "1.0.0", + "description": "First implementation of enhanced security in IoT using Blockchain", + "main": "", + "scripts": { + "build": "npm install", + "test": "echo \"Error: no test specified\" && exit 1", + "complie": "truffle compile", + "start": "ganche-cli" + }, + "author": "Salman Dabbakuti", + "license": "ISC", + "dependencies": { + "ganache-cli": "^6.9.1", + "pip": "0.0.1", + "truffle": "^4.1.17" + } +} diff --git a/test.py b/test.py deleted file mode 100644 index c15d454..0000000 --- a/test.py +++ /dev/null @@ -1,80 +0,0 @@ -import json -from web3 import Web3, HTTPProvider -from web3.contract import ConciseContract -from EmulatorGUI import GPIO -from flask import Flask -#from RPiSim import GPIO -# GPIO setup -GPIO.setmode(GPIO.BCM) -GPIO.setwarnings(False) -pinList = [14, 15, 18, 23, 24, 25, 8,7, 12, 16, 20, 21, 2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26] - - -for i in pinList: - GPIO.setup(i, GPIO.OUT) - -app = Flask(__name__) -@app.route("//") -def control(pin, action): - if pin=='fourteen': - actuator=14 - if pin=='fifteen': - actuator=15 - if pin=='eighteen': - actuator=18 - if pin=='twentythree': - actuator=23 - if pin=='twentyfour': - actuator=24 - if pin=='twentyfive': - actuator=25 - if pin=='eight': - actuator=8 - if pin=='seven': - actuator=7 - if pin=='twelve': - actuator=12 - if pin=='sixteen': - actuator=16 - if pin=='twenty': - actuator=20 - if pin=='twentyone': - actuator=21 - if pin=='two': - actuator=2 - if pin=='three': - actuator=3 - if pin=='four': - actuator=4 - if pin=='seventeen': - actuator=17 - if pin=='twentyseven': - actuator=27 - if pin=='twentytwo': - actuator=22 - if pin=='ten': - actuator=10 - if pin=='nine': - actuator=9 - if pin=='eleven': - actuator=11 - if pin=='five': - actuator=5 - if pin=='six': - actuator=6 - if pin=='thirteen': - actuator=13 - if pin=='nineteen': - actuator=19 - if pin=='twentysix': - actuator=26 - - - if action=='on': - GPIO.output(actuator,GPIO.HIGH) - if action=='off': - GPIO.output(actuator,GPIO.LOW) -if __name__ == '__main__': - app.run(debug=True, port=80, host='0.0.0.0') - - diff --git a/tester2.py b/tester2.py deleted file mode 100644 index 420196e..0000000 --- a/tester2.py +++ /dev/null @@ -1,67 +0,0 @@ -from EmulatorGUI import GPIO -#import RPi.GPIO as GPIO -import time -import traceback - - - -def Main(): - try: - GPIO.setmode(GPIO.BCM) - - GPIO.setwarnings(False) - - GPIO.setup(4, GPIO.OUT) - GPIO.setup(17, GPIO.OUT, initial = GPIO.LOW) - GPIO.setup(18, GPIO.OUT, initial = GPIO.LOW) - GPIO.setup(21, GPIO.OUT, initial = GPIO.LOW) - GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP) - GPIO.setup(15, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) - GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) - GPIO.setup(26, GPIO.IN) - - - while(True): - if (GPIO.input(23) == False): - GPIO.output(4,GPIO.HIGH) - GPIO.output(17,GPIO.HIGH) - time.sleep(1) - - if (GPIO.input(15) == True): - GPIO.output(18,GPIO.HIGH) - GPIO.output(21,GPIO.HIGH) - time.sleep(1) - - if (GPIO.input(24) == True): - GPIO.output(18,GPIO.LOW) - GPIO.output(21,GPIO.LOW) - time.sleep(1) - - if (GPIO.input(26) == True): - GPIO.output(4,GPIO.LOW) - GPIO.output(17,GPIO.LOW) - time.sleep(1) - - - - except Exception as ex: - traceback.print_exc() - finally: - GPIO.cleanup() #this ensures a clean exit - - - -Main() - - - - - - - - - - - - -