├── .gitattributes ├── LICENSE ├── Readme.md ├── client ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── contracts │ │ ├── Migrations.json │ │ └── Todo.json │ ├── getWeb3.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── serviceWorker.js └── yarn.lock ├── contracts ├── Migrations.sol ├── SimpleStorage.sol └── Todo.sol ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js ├── test ├── TestSimpleStorage.sol └── simplestorage.js └── truffle-config.js /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Truffle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Todo list dapp: 2 | 3 | - Truffle 4 | - Solidity 5 | - React.js 6 | - Node.js 7 | - Web3.js 8 | 9 | # Slides : 10 | 11 | https://docs.google.com/presentation/d/1eDRLDhY0_EL7oV9dzF-ekINnhVC8ejNAAczspHdb-Sk/edit?usp=sharing 12 | 13 | # Run 14 | 15 | First terminal: 16 | 17 | ```sh 18 | cd client && npm install 19 | 20 | npm run start 21 | ``` 22 | 23 | Second terminal: 24 | 25 | ```sh 26 | truffle develop 27 | 28 | truffle(develop)> migrate 29 | 30 | ``` 31 | -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `yarn build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "16.11.0", 7 | "react-dom": "16.11.0", 8 | "react-scripts": "3.2.0", 9 | "web3": "1.2.2" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build", 14 | "test": "react-scripts test", 15 | "eject": "react-scripts eject" 16 | }, 17 | "eslintConfig": { 18 | "extends": "react-app" 19 | }, 20 | "browserslist": { 21 | "production": [ 22 | ">0.2%", 23 | "not dead", 24 | "not op_mini all" 25 | ], 26 | "development": [ 27 | "last 1 chrome version", 28 | "last 1 firefox version", 29 | "last 1 safari version" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soub4i/dapp-todo-list-react/28393c6e0bec05314f94ffb1bb22a5a0ac3846d8/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soub4i/dapp-todo-list-react/28393c6e0bec05314f94ffb1bb22a5a0ac3846d8/client/public/logo192.png -------------------------------------------------------------------------------- /client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soub4i/dapp-todo-list-react/28393c6e0bec05314f94ffb1bb22a5a0ac3846d8/client/public/logo512.png -------------------------------------------------------------------------------- /client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | } 8 | 9 | .App-header { 10 | background-color: #282c34; 11 | min-height: 100vh; 12 | display: flex; 13 | flex-direction: column; 14 | align-items: center; 15 | justify-content: center; 16 | font-size: calc(10px + 2vmin); 17 | color: white; 18 | } 19 | 20 | .App-link { 21 | color: #09d3ac; 22 | } 23 | -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import Todo from "./contracts/Todo.json"; 3 | import getWeb3 from "./getWeb3"; 4 | 5 | export default function App() { 6 | const [state, setState] = useState({}); 7 | const [content, setContent] = useState(""); 8 | const [greeting, setGreeting] = useState(""); 9 | const [tasks, setTasks] = useState([]); 10 | const [loading, setLoading] = useState(false); 11 | 12 | const addTask = async (e) => { 13 | e.preventDefault(); 14 | await state.contract.methods.createTask(content).send({ 15 | from: state.accounts[0], 16 | }); 17 | getTasks(); 18 | }; 19 | 20 | const getTasks = async () => { 21 | if (state.contract) { 22 | const count = await state.contract.methods.getCountTasks().call(); 23 | const tasks = []; 24 | for (let index = 1; index <= count; index++) { 25 | const element = await state.contract.methods.tasks(index).call(); 26 | tasks.push(element); 27 | } 28 | setTasks(tasks); 29 | } 30 | }; 31 | 32 | useEffect(() => { 33 | const init = async () => { 34 | const web3 = await getWeb3(); 35 | const accounts = await web3.eth.getAccounts(); 36 | const networkId = await web3.eth.net.getId(); 37 | const network = Todo.networks[networkId]; 38 | const contract = new web3.eth.Contract( 39 | Todo.abi, 40 | network && network.address 41 | ); 42 | 43 | setState({ 44 | accounts, 45 | contract, 46 | }); 47 | 48 | const greeting = await contract.methods.getGreeting().call(); 49 | setGreeting(greeting); 50 | setLoading(true); 51 | }; 52 | 53 | init(); 54 | }, []); 55 | 56 | useEffect(() => { 57 | getTasks(); 58 | }, [loading]); 59 | 60 | return ( 61 |
62 |

Hello from react

63 | 64 |

{greeting}

65 | 66 |
addTask(e)}> 67 | setContent(e.target.value)} /> 68 | 69 |
70 | 71 | 74 |
75 | ); 76 | } 77 | -------------------------------------------------------------------------------- /client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /client/src/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "inputs": [], 6 | "payable": false, 7 | "stateMutability": "nonpayable", 8 | "type": "constructor" 9 | }, 10 | { 11 | "constant": true, 12 | "inputs": [], 13 | "name": "last_completed_migration", 14 | "outputs": [ 15 | { 16 | "internalType": "uint256", 17 | "name": "", 18 | "type": "uint256" 19 | } 20 | ], 21 | "payable": false, 22 | "stateMutability": "view", 23 | "type": "function" 24 | }, 25 | { 26 | "constant": true, 27 | "inputs": [], 28 | "name": "owner", 29 | "outputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "", 33 | "type": "address" 34 | } 35 | ], 36 | "payable": false, 37 | "stateMutability": "view", 38 | "type": "function" 39 | }, 40 | { 41 | "constant": false, 42 | "inputs": [ 43 | { 44 | "internalType": "uint256", 45 | "name": "completed", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "setCompleted", 50 | "outputs": [], 51 | "payable": false, 52 | "stateMutability": "nonpayable", 53 | "type": "function" 54 | } 55 | ], 56 | "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Migrations.sol\":{\"keccak256\":\"0xc93c4d9040d6d696f1b41346888ce18568d4d652b651ced80d64bfe2ea64614a\",\"urls\":[\"bzz-raw://f13bdf3af9e36d7ad6c019690ee2e9b6b3f0e1aa048a409150e56f494dca63ce\",\"dweb:/ipfs/QmQUCHmbgBqt6xPwsUrspeRTBcoFtKe8x5b3ZSyUiq6Kp1\"]}},\"version\":1}", 57 | "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061019c806100606000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd576146100ae575b600080fd5b61004e6100dc565b6040518082815260200191505060405180910390f35b61006c6100e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610107565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561016457806001819055505b5056fea265627a7a723158201efa5b5b48d0d1aebcc4c2f28846cfec4908ceeeedb59171ce8c74a42de42e7f64736f6c63430005100032", 58 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd576146100ae575b600080fd5b61004e6100dc565b6040518082815260200191505060405180910390f35b61006c6100e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610107565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561016457806001819055505b5056fea265627a7a723158201efa5b5b48d0d1aebcc4c2f28846cfec4908ceeeedb59171ce8c74a42de42e7f64736f6c63430005100032", 59 | "sourceMap": "66:311:0:-;;;218:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;218:50:0;253:10;245:5;;:18;;;;;;;;;;;;;;;;;;66:311;;;;;;", 60 | "deployedSourceMap": "66:311:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;66:311:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;114:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;90:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;272:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;272:103:0;;;;;;;;;;;;;;;;;:::i;:::-;;114:36;;;;:::o;90:20::-;;;;;;;;;;;;;:::o;272:103::-;201:5;;;;;;;;;;;187:19;;:10;:19;;;183:26;;;361:9;334:24;:36;;;;183:26;272:103;:::o", 61 | "source": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.21 <0.7.0;\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 constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n}\n", 62 | "sourcePath": "/home/soubai/Desktop/talks/dapp-todo-list-react/contracts/Migrations.sol", 63 | "ast": { 64 | "absolutePath": "project:/contracts/Migrations.sol", 65 | "exportedSymbols": { 66 | "Migrations": [ 67 | 36 68 | ] 69 | }, 70 | "id": 37, 71 | "nodeType": "SourceUnit", 72 | "nodes": [ 73 | { 74 | "id": 1, 75 | "literals": [ 76 | "solidity", 77 | ">=", 78 | "0.4", 79 | ".21", 80 | "<", 81 | "0.7", 82 | ".0" 83 | ], 84 | "nodeType": "PragmaDirective", 85 | "src": "32:32:0" 86 | }, 87 | { 88 | "baseContracts": [], 89 | "contractDependencies": [], 90 | "contractKind": "contract", 91 | "documentation": null, 92 | "fullyImplemented": true, 93 | "id": 36, 94 | "linearizedBaseContracts": [ 95 | 36 96 | ], 97 | "name": "Migrations", 98 | "nodeType": "ContractDefinition", 99 | "nodes": [ 100 | { 101 | "constant": false, 102 | "id": 3, 103 | "name": "owner", 104 | "nodeType": "VariableDeclaration", 105 | "scope": 36, 106 | "src": "90:20:0", 107 | "stateVariable": true, 108 | "storageLocation": "default", 109 | "typeDescriptions": { 110 | "typeIdentifier": "t_address", 111 | "typeString": "address" 112 | }, 113 | "typeName": { 114 | "id": 2, 115 | "name": "address", 116 | "nodeType": "ElementaryTypeName", 117 | "src": "90:7:0", 118 | "stateMutability": "nonpayable", 119 | "typeDescriptions": { 120 | "typeIdentifier": "t_address", 121 | "typeString": "address" 122 | } 123 | }, 124 | "value": null, 125 | "visibility": "public" 126 | }, 127 | { 128 | "constant": false, 129 | "id": 5, 130 | "name": "last_completed_migration", 131 | "nodeType": "VariableDeclaration", 132 | "scope": 36, 133 | "src": "114:36:0", 134 | "stateVariable": true, 135 | "storageLocation": "default", 136 | "typeDescriptions": { 137 | "typeIdentifier": "t_uint256", 138 | "typeString": "uint256" 139 | }, 140 | "typeName": { 141 | "id": 4, 142 | "name": "uint", 143 | "nodeType": "ElementaryTypeName", 144 | "src": "114:4:0", 145 | "typeDescriptions": { 146 | "typeIdentifier": "t_uint256", 147 | "typeString": "uint256" 148 | } 149 | }, 150 | "value": null, 151 | "visibility": "public" 152 | }, 153 | { 154 | "body": { 155 | "id": 13, 156 | "nodeType": "Block", 157 | "src": "177:37:0", 158 | "statements": [ 159 | { 160 | "condition": { 161 | "argumentTypes": null, 162 | "commonType": { 163 | "typeIdentifier": "t_address", 164 | "typeString": "address" 165 | }, 166 | "id": 10, 167 | "isConstant": false, 168 | "isLValue": false, 169 | "isPure": false, 170 | "lValueRequested": false, 171 | "leftExpression": { 172 | "argumentTypes": null, 173 | "expression": { 174 | "argumentTypes": null, 175 | "id": 7, 176 | "name": "msg", 177 | "nodeType": "Identifier", 178 | "overloadedDeclarations": [], 179 | "referencedDeclaration": 129, 180 | "src": "187:3:0", 181 | "typeDescriptions": { 182 | "typeIdentifier": "t_magic_message", 183 | "typeString": "msg" 184 | } 185 | }, 186 | "id": 8, 187 | "isConstant": false, 188 | "isLValue": false, 189 | "isPure": false, 190 | "lValueRequested": false, 191 | "memberName": "sender", 192 | "nodeType": "MemberAccess", 193 | "referencedDeclaration": null, 194 | "src": "187:10:0", 195 | "typeDescriptions": { 196 | "typeIdentifier": "t_address_payable", 197 | "typeString": "address payable" 198 | } 199 | }, 200 | "nodeType": "BinaryOperation", 201 | "operator": "==", 202 | "rightExpression": { 203 | "argumentTypes": null, 204 | "id": 9, 205 | "name": "owner", 206 | "nodeType": "Identifier", 207 | "overloadedDeclarations": [], 208 | "referencedDeclaration": 3, 209 | "src": "201:5:0", 210 | "typeDescriptions": { 211 | "typeIdentifier": "t_address", 212 | "typeString": "address" 213 | } 214 | }, 215 | "src": "187:19:0", 216 | "typeDescriptions": { 217 | "typeIdentifier": "t_bool", 218 | "typeString": "bool" 219 | } 220 | }, 221 | "falseBody": null, 222 | "id": 12, 223 | "nodeType": "IfStatement", 224 | "src": "183:26:0", 225 | "trueBody": { 226 | "id": 11, 227 | "nodeType": "PlaceholderStatement", 228 | "src": "208:1:0" 229 | } 230 | } 231 | ] 232 | }, 233 | "documentation": null, 234 | "id": 14, 235 | "name": "restricted", 236 | "nodeType": "ModifierDefinition", 237 | "parameters": { 238 | "id": 6, 239 | "nodeType": "ParameterList", 240 | "parameters": [], 241 | "src": "174:2:0" 242 | }, 243 | "src": "155:59:0", 244 | "visibility": "internal" 245 | }, 246 | { 247 | "body": { 248 | "id": 22, 249 | "nodeType": "Block", 250 | "src": "239:29:0", 251 | "statements": [ 252 | { 253 | "expression": { 254 | "argumentTypes": null, 255 | "id": 20, 256 | "isConstant": false, 257 | "isLValue": false, 258 | "isPure": false, 259 | "lValueRequested": false, 260 | "leftHandSide": { 261 | "argumentTypes": null, 262 | "id": 17, 263 | "name": "owner", 264 | "nodeType": "Identifier", 265 | "overloadedDeclarations": [], 266 | "referencedDeclaration": 3, 267 | "src": "245:5:0", 268 | "typeDescriptions": { 269 | "typeIdentifier": "t_address", 270 | "typeString": "address" 271 | } 272 | }, 273 | "nodeType": "Assignment", 274 | "operator": "=", 275 | "rightHandSide": { 276 | "argumentTypes": null, 277 | "expression": { 278 | "argumentTypes": null, 279 | "id": 18, 280 | "name": "msg", 281 | "nodeType": "Identifier", 282 | "overloadedDeclarations": [], 283 | "referencedDeclaration": 129, 284 | "src": "253:3:0", 285 | "typeDescriptions": { 286 | "typeIdentifier": "t_magic_message", 287 | "typeString": "msg" 288 | } 289 | }, 290 | "id": 19, 291 | "isConstant": false, 292 | "isLValue": false, 293 | "isPure": false, 294 | "lValueRequested": false, 295 | "memberName": "sender", 296 | "nodeType": "MemberAccess", 297 | "referencedDeclaration": null, 298 | "src": "253:10:0", 299 | "typeDescriptions": { 300 | "typeIdentifier": "t_address_payable", 301 | "typeString": "address payable" 302 | } 303 | }, 304 | "src": "245:18:0", 305 | "typeDescriptions": { 306 | "typeIdentifier": "t_address", 307 | "typeString": "address" 308 | } 309 | }, 310 | "id": 21, 311 | "nodeType": "ExpressionStatement", 312 | "src": "245:18:0" 313 | } 314 | ] 315 | }, 316 | "documentation": null, 317 | "id": 23, 318 | "implemented": true, 319 | "kind": "constructor", 320 | "modifiers": [], 321 | "name": "", 322 | "nodeType": "FunctionDefinition", 323 | "parameters": { 324 | "id": 15, 325 | "nodeType": "ParameterList", 326 | "parameters": [], 327 | "src": "229:2:0" 328 | }, 329 | "returnParameters": { 330 | "id": 16, 331 | "nodeType": "ParameterList", 332 | "parameters": [], 333 | "src": "239:0:0" 334 | }, 335 | "scope": 36, 336 | "src": "218:50:0", 337 | "stateMutability": "nonpayable", 338 | "superFunction": null, 339 | "visibility": "public" 340 | }, 341 | { 342 | "body": { 343 | "id": 34, 344 | "nodeType": "Block", 345 | "src": "328:47:0", 346 | "statements": [ 347 | { 348 | "expression": { 349 | "argumentTypes": null, 350 | "id": 32, 351 | "isConstant": false, 352 | "isLValue": false, 353 | "isPure": false, 354 | "lValueRequested": false, 355 | "leftHandSide": { 356 | "argumentTypes": null, 357 | "id": 30, 358 | "name": "last_completed_migration", 359 | "nodeType": "Identifier", 360 | "overloadedDeclarations": [], 361 | "referencedDeclaration": 5, 362 | "src": "334:24:0", 363 | "typeDescriptions": { 364 | "typeIdentifier": "t_uint256", 365 | "typeString": "uint256" 366 | } 367 | }, 368 | "nodeType": "Assignment", 369 | "operator": "=", 370 | "rightHandSide": { 371 | "argumentTypes": null, 372 | "id": 31, 373 | "name": "completed", 374 | "nodeType": "Identifier", 375 | "overloadedDeclarations": [], 376 | "referencedDeclaration": 25, 377 | "src": "361:9:0", 378 | "typeDescriptions": { 379 | "typeIdentifier": "t_uint256", 380 | "typeString": "uint256" 381 | } 382 | }, 383 | "src": "334:36:0", 384 | "typeDescriptions": { 385 | "typeIdentifier": "t_uint256", 386 | "typeString": "uint256" 387 | } 388 | }, 389 | "id": 33, 390 | "nodeType": "ExpressionStatement", 391 | "src": "334:36:0" 392 | } 393 | ] 394 | }, 395 | "documentation": null, 396 | "id": 35, 397 | "implemented": true, 398 | "kind": "function", 399 | "modifiers": [ 400 | { 401 | "arguments": null, 402 | "id": 28, 403 | "modifierName": { 404 | "argumentTypes": null, 405 | "id": 27, 406 | "name": "restricted", 407 | "nodeType": "Identifier", 408 | "overloadedDeclarations": [], 409 | "referencedDeclaration": 14, 410 | "src": "317:10:0", 411 | "typeDescriptions": { 412 | "typeIdentifier": "t_modifier$__$", 413 | "typeString": "modifier ()" 414 | } 415 | }, 416 | "nodeType": "ModifierInvocation", 417 | "src": "317:10:0" 418 | } 419 | ], 420 | "name": "setCompleted", 421 | "nodeType": "FunctionDefinition", 422 | "parameters": { 423 | "id": 26, 424 | "nodeType": "ParameterList", 425 | "parameters": [ 426 | { 427 | "constant": false, 428 | "id": 25, 429 | "name": "completed", 430 | "nodeType": "VariableDeclaration", 431 | "scope": 35, 432 | "src": "294:14:0", 433 | "stateVariable": false, 434 | "storageLocation": "default", 435 | "typeDescriptions": { 436 | "typeIdentifier": "t_uint256", 437 | "typeString": "uint256" 438 | }, 439 | "typeName": { 440 | "id": 24, 441 | "name": "uint", 442 | "nodeType": "ElementaryTypeName", 443 | "src": "294:4:0", 444 | "typeDescriptions": { 445 | "typeIdentifier": "t_uint256", 446 | "typeString": "uint256" 447 | } 448 | }, 449 | "value": null, 450 | "visibility": "internal" 451 | } 452 | ], 453 | "src": "293:16:0" 454 | }, 455 | "returnParameters": { 456 | "id": 29, 457 | "nodeType": "ParameterList", 458 | "parameters": [], 459 | "src": "328:0:0" 460 | }, 461 | "scope": 36, 462 | "src": "272:103:0", 463 | "stateMutability": "nonpayable", 464 | "superFunction": null, 465 | "visibility": "public" 466 | } 467 | ], 468 | "scope": 37, 469 | "src": "66:311:0" 470 | } 471 | ], 472 | "src": "32:346:0" 473 | }, 474 | "legacyAST": { 475 | "attributes": { 476 | "absolutePath": "project:/contracts/Migrations.sol", 477 | "exportedSymbols": { 478 | "Migrations": [ 479 | 36 480 | ] 481 | } 482 | }, 483 | "children": [ 484 | { 485 | "attributes": { 486 | "literals": [ 487 | "solidity", 488 | ">=", 489 | "0.4", 490 | ".21", 491 | "<", 492 | "0.7", 493 | ".0" 494 | ] 495 | }, 496 | "id": 1, 497 | "name": "PragmaDirective", 498 | "src": "32:32:0" 499 | }, 500 | { 501 | "attributes": { 502 | "baseContracts": [ 503 | null 504 | ], 505 | "contractDependencies": [ 506 | null 507 | ], 508 | "contractKind": "contract", 509 | "documentation": null, 510 | "fullyImplemented": true, 511 | "linearizedBaseContracts": [ 512 | 36 513 | ], 514 | "name": "Migrations", 515 | "scope": 37 516 | }, 517 | "children": [ 518 | { 519 | "attributes": { 520 | "constant": false, 521 | "name": "owner", 522 | "scope": 36, 523 | "stateVariable": true, 524 | "storageLocation": "default", 525 | "type": "address", 526 | "value": null, 527 | "visibility": "public" 528 | }, 529 | "children": [ 530 | { 531 | "attributes": { 532 | "name": "address", 533 | "stateMutability": "nonpayable", 534 | "type": "address" 535 | }, 536 | "id": 2, 537 | "name": "ElementaryTypeName", 538 | "src": "90:7:0" 539 | } 540 | ], 541 | "id": 3, 542 | "name": "VariableDeclaration", 543 | "src": "90:20:0" 544 | }, 545 | { 546 | "attributes": { 547 | "constant": false, 548 | "name": "last_completed_migration", 549 | "scope": 36, 550 | "stateVariable": true, 551 | "storageLocation": "default", 552 | "type": "uint256", 553 | "value": null, 554 | "visibility": "public" 555 | }, 556 | "children": [ 557 | { 558 | "attributes": { 559 | "name": "uint", 560 | "type": "uint256" 561 | }, 562 | "id": 4, 563 | "name": "ElementaryTypeName", 564 | "src": "114:4:0" 565 | } 566 | ], 567 | "id": 5, 568 | "name": "VariableDeclaration", 569 | "src": "114:36:0" 570 | }, 571 | { 572 | "attributes": { 573 | "documentation": null, 574 | "name": "restricted", 575 | "visibility": "internal" 576 | }, 577 | "children": [ 578 | { 579 | "attributes": { 580 | "parameters": [ 581 | null 582 | ] 583 | }, 584 | "children": [], 585 | "id": 6, 586 | "name": "ParameterList", 587 | "src": "174:2:0" 588 | }, 589 | { 590 | "children": [ 591 | { 592 | "attributes": { 593 | "falseBody": null 594 | }, 595 | "children": [ 596 | { 597 | "attributes": { 598 | "argumentTypes": null, 599 | "commonType": { 600 | "typeIdentifier": "t_address", 601 | "typeString": "address" 602 | }, 603 | "isConstant": false, 604 | "isLValue": false, 605 | "isPure": false, 606 | "lValueRequested": false, 607 | "operator": "==", 608 | "type": "bool" 609 | }, 610 | "children": [ 611 | { 612 | "attributes": { 613 | "argumentTypes": null, 614 | "isConstant": false, 615 | "isLValue": false, 616 | "isPure": false, 617 | "lValueRequested": false, 618 | "member_name": "sender", 619 | "referencedDeclaration": null, 620 | "type": "address payable" 621 | }, 622 | "children": [ 623 | { 624 | "attributes": { 625 | "argumentTypes": null, 626 | "overloadedDeclarations": [ 627 | null 628 | ], 629 | "referencedDeclaration": 129, 630 | "type": "msg", 631 | "value": "msg" 632 | }, 633 | "id": 7, 634 | "name": "Identifier", 635 | "src": "187:3:0" 636 | } 637 | ], 638 | "id": 8, 639 | "name": "MemberAccess", 640 | "src": "187:10:0" 641 | }, 642 | { 643 | "attributes": { 644 | "argumentTypes": null, 645 | "overloadedDeclarations": [ 646 | null 647 | ], 648 | "referencedDeclaration": 3, 649 | "type": "address", 650 | "value": "owner" 651 | }, 652 | "id": 9, 653 | "name": "Identifier", 654 | "src": "201:5:0" 655 | } 656 | ], 657 | "id": 10, 658 | "name": "BinaryOperation", 659 | "src": "187:19:0" 660 | }, 661 | { 662 | "id": 11, 663 | "name": "PlaceholderStatement", 664 | "src": "208:1:0" 665 | } 666 | ], 667 | "id": 12, 668 | "name": "IfStatement", 669 | "src": "183:26:0" 670 | } 671 | ], 672 | "id": 13, 673 | "name": "Block", 674 | "src": "177:37:0" 675 | } 676 | ], 677 | "id": 14, 678 | "name": "ModifierDefinition", 679 | "src": "155:59:0" 680 | }, 681 | { 682 | "attributes": { 683 | "documentation": null, 684 | "implemented": true, 685 | "isConstructor": true, 686 | "kind": "constructor", 687 | "modifiers": [ 688 | null 689 | ], 690 | "name": "", 691 | "scope": 36, 692 | "stateMutability": "nonpayable", 693 | "superFunction": null, 694 | "visibility": "public" 695 | }, 696 | "children": [ 697 | { 698 | "attributes": { 699 | "parameters": [ 700 | null 701 | ] 702 | }, 703 | "children": [], 704 | "id": 15, 705 | "name": "ParameterList", 706 | "src": "229:2:0" 707 | }, 708 | { 709 | "attributes": { 710 | "parameters": [ 711 | null 712 | ] 713 | }, 714 | "children": [], 715 | "id": 16, 716 | "name": "ParameterList", 717 | "src": "239:0:0" 718 | }, 719 | { 720 | "children": [ 721 | { 722 | "children": [ 723 | { 724 | "attributes": { 725 | "argumentTypes": null, 726 | "isConstant": false, 727 | "isLValue": false, 728 | "isPure": false, 729 | "lValueRequested": false, 730 | "operator": "=", 731 | "type": "address" 732 | }, 733 | "children": [ 734 | { 735 | "attributes": { 736 | "argumentTypes": null, 737 | "overloadedDeclarations": [ 738 | null 739 | ], 740 | "referencedDeclaration": 3, 741 | "type": "address", 742 | "value": "owner" 743 | }, 744 | "id": 17, 745 | "name": "Identifier", 746 | "src": "245:5:0" 747 | }, 748 | { 749 | "attributes": { 750 | "argumentTypes": null, 751 | "isConstant": false, 752 | "isLValue": false, 753 | "isPure": false, 754 | "lValueRequested": false, 755 | "member_name": "sender", 756 | "referencedDeclaration": null, 757 | "type": "address payable" 758 | }, 759 | "children": [ 760 | { 761 | "attributes": { 762 | "argumentTypes": null, 763 | "overloadedDeclarations": [ 764 | null 765 | ], 766 | "referencedDeclaration": 129, 767 | "type": "msg", 768 | "value": "msg" 769 | }, 770 | "id": 18, 771 | "name": "Identifier", 772 | "src": "253:3:0" 773 | } 774 | ], 775 | "id": 19, 776 | "name": "MemberAccess", 777 | "src": "253:10:0" 778 | } 779 | ], 780 | "id": 20, 781 | "name": "Assignment", 782 | "src": "245:18:0" 783 | } 784 | ], 785 | "id": 21, 786 | "name": "ExpressionStatement", 787 | "src": "245:18:0" 788 | } 789 | ], 790 | "id": 22, 791 | "name": "Block", 792 | "src": "239:29:0" 793 | } 794 | ], 795 | "id": 23, 796 | "name": "FunctionDefinition", 797 | "src": "218:50:0" 798 | }, 799 | { 800 | "attributes": { 801 | "documentation": null, 802 | "implemented": true, 803 | "isConstructor": false, 804 | "kind": "function", 805 | "name": "setCompleted", 806 | "scope": 36, 807 | "stateMutability": "nonpayable", 808 | "superFunction": null, 809 | "visibility": "public" 810 | }, 811 | "children": [ 812 | { 813 | "children": [ 814 | { 815 | "attributes": { 816 | "constant": false, 817 | "name": "completed", 818 | "scope": 35, 819 | "stateVariable": false, 820 | "storageLocation": "default", 821 | "type": "uint256", 822 | "value": null, 823 | "visibility": "internal" 824 | }, 825 | "children": [ 826 | { 827 | "attributes": { 828 | "name": "uint", 829 | "type": "uint256" 830 | }, 831 | "id": 24, 832 | "name": "ElementaryTypeName", 833 | "src": "294:4:0" 834 | } 835 | ], 836 | "id": 25, 837 | "name": "VariableDeclaration", 838 | "src": "294:14:0" 839 | } 840 | ], 841 | "id": 26, 842 | "name": "ParameterList", 843 | "src": "293:16:0" 844 | }, 845 | { 846 | "attributes": { 847 | "parameters": [ 848 | null 849 | ] 850 | }, 851 | "children": [], 852 | "id": 29, 853 | "name": "ParameterList", 854 | "src": "328:0:0" 855 | }, 856 | { 857 | "attributes": { 858 | "arguments": null 859 | }, 860 | "children": [ 861 | { 862 | "attributes": { 863 | "argumentTypes": null, 864 | "overloadedDeclarations": [ 865 | null 866 | ], 867 | "referencedDeclaration": 14, 868 | "type": "modifier ()", 869 | "value": "restricted" 870 | }, 871 | "id": 27, 872 | "name": "Identifier", 873 | "src": "317:10:0" 874 | } 875 | ], 876 | "id": 28, 877 | "name": "ModifierInvocation", 878 | "src": "317:10:0" 879 | }, 880 | { 881 | "children": [ 882 | { 883 | "children": [ 884 | { 885 | "attributes": { 886 | "argumentTypes": null, 887 | "isConstant": false, 888 | "isLValue": false, 889 | "isPure": false, 890 | "lValueRequested": false, 891 | "operator": "=", 892 | "type": "uint256" 893 | }, 894 | "children": [ 895 | { 896 | "attributes": { 897 | "argumentTypes": null, 898 | "overloadedDeclarations": [ 899 | null 900 | ], 901 | "referencedDeclaration": 5, 902 | "type": "uint256", 903 | "value": "last_completed_migration" 904 | }, 905 | "id": 30, 906 | "name": "Identifier", 907 | "src": "334:24:0" 908 | }, 909 | { 910 | "attributes": { 911 | "argumentTypes": null, 912 | "overloadedDeclarations": [ 913 | null 914 | ], 915 | "referencedDeclaration": 25, 916 | "type": "uint256", 917 | "value": "completed" 918 | }, 919 | "id": 31, 920 | "name": "Identifier", 921 | "src": "361:9:0" 922 | } 923 | ], 924 | "id": 32, 925 | "name": "Assignment", 926 | "src": "334:36:0" 927 | } 928 | ], 929 | "id": 33, 930 | "name": "ExpressionStatement", 931 | "src": "334:36:0" 932 | } 933 | ], 934 | "id": 34, 935 | "name": "Block", 936 | "src": "328:47:0" 937 | } 938 | ], 939 | "id": 35, 940 | "name": "FunctionDefinition", 941 | "src": "272:103:0" 942 | } 943 | ], 944 | "id": 36, 945 | "name": "ContractDefinition", 946 | "src": "66:311:0" 947 | } 948 | ], 949 | "id": 37, 950 | "name": "SourceUnit", 951 | "src": "32:346:0" 952 | }, 953 | "compiler": { 954 | "name": "solc", 955 | "version": "0.5.16+commit.9c3226ce.Emscripten.clang" 956 | }, 957 | "networks": { 958 | "5777": { 959 | "events": {}, 960 | "links": {}, 961 | "address": "0xC4eB7AE88BDC24fC63588952381Adbc936dBd627", 962 | "transactionHash": "0x58b1f22e4c679f4b9c34afa775763ba2869d53b7ad7f6f74264ff2d0588649e0" 963 | } 964 | }, 965 | "schemaVersion": "3.4.3", 966 | "updatedAt": "2021-12-17T17:35:15.759Z", 967 | "networkType": "ethereum", 968 | "devdoc": { 969 | "methods": {} 970 | }, 971 | "userdoc": { 972 | "methods": {} 973 | } 974 | } -------------------------------------------------------------------------------- /client/src/contracts/Todo.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Todo", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [ 7 | { 8 | "internalType": "uint256", 9 | "name": "", 10 | "type": "uint256" 11 | } 12 | ], 13 | "name": "tasks", 14 | "outputs": [ 15 | { 16 | "internalType": "uint256", 17 | "name": "id", 18 | "type": "uint256" 19 | }, 20 | { 21 | "internalType": "string", 22 | "name": "content", 23 | "type": "string" 24 | }, 25 | { 26 | "internalType": "bool", 27 | "name": "complete", 28 | "type": "bool" 29 | } 30 | ], 31 | "payable": false, 32 | "stateMutability": "view", 33 | "type": "function" 34 | }, 35 | { 36 | "constant": true, 37 | "inputs": [], 38 | "name": "getCountTasks", 39 | "outputs": [ 40 | { 41 | "internalType": "uint256", 42 | "name": "", 43 | "type": "uint256" 44 | } 45 | ], 46 | "payable": false, 47 | "stateMutability": "view", 48 | "type": "function" 49 | }, 50 | { 51 | "constant": true, 52 | "inputs": [], 53 | "name": "getGreeting", 54 | "outputs": [ 55 | { 56 | "internalType": "string", 57 | "name": "", 58 | "type": "string" 59 | } 60 | ], 61 | "payable": false, 62 | "stateMutability": "view", 63 | "type": "function" 64 | }, 65 | { 66 | "constant": false, 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_content", 71 | "type": "string" 72 | } 73 | ], 74 | "name": "createTask", 75 | "outputs": [], 76 | "payable": false, 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | } 80 | ], 81 | "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"string\",\"name\":\"_content\",\"type\":\"string\"}],\"name\":\"createTask\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getCountTasks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getGreeting\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tasks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"content\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"complete\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Todo.sol\":\"Todo\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Todo.sol\":{\"keccak256\":\"0x2a62454bfcf5490077d942998c5e02ec75a980b46e73fb87bdfeefe356acb3c4\",\"urls\":[\"bzz-raw://b345f4888c33680a80fa6a652bd99a2aacf134bef5540a1e41a211c8b1f52573\",\"dweb:/ipfs/QmQ7gdmkm4Hbzj6WvqeVWVtcYpicMckr13e4eGqaeo221s\"]}},\"version\":1}", 82 | "bytecode": "0x6080604052600080556040518060400160405280601381526020017f48656c6c6f2066726f6d20457468657265756d0000000000000000000000000081525060019080519060200190610053929190610066565b5034801561006057600080fd5b5061010b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a757805160ff19168380011785556100d5565b828001600101855582156100d5579182015b828111156100d45782518255916020019190600101906100b9565b5b5090506100e291906100e6565b5090565b61010891905b808211156101045760008160009055506001016100ec565b5090565b90565b61054c8061011a6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063111002aa146100515780638d9776721461010c578063ac0c5732146101c5578063fe50cc72146101e3575b600080fd5b61010a6004803603602081101561006757600080fd5b810190808035906020019064010000000081111561008457600080fd5b82018360208201111561009657600080fd5b803590602001918460018302840111640100000000831117156100b857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610266565b005b6101386004803603602081101561012257600080fd5b81019080803590602001909291905050506102f8565b604051808481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561018857808201518184015260208101905061016d565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b6101cd6103c7565b6040518082815260200191505060405180910390f35b6101eb6103d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561022b578082015181840152602081019050610210565b50505050905090810190601f1680156102585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000808154809291906001019190505550604051806060016040528060005481526020018281526020016000151581525060026000805481526020019081526020016000206000820151816000015560208201518160010190805190602001906102d1929190610472565b5060408201518160020160006101000a81548160ff02191690831515021790555090505050565b6002602052806000526040600020600091509050806000015490806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050908060020160009054906101000a900460ff16905083565b60008054905090565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104685780601f1061043d57610100808354040283529160200191610468565b820191906000526020600020905b81548152906001019060200180831161044b57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b357805160ff19168380011785556104e1565b828001600101855582156104e1579182015b828111156104e05782518255916020019190600101906104c5565b5b5090506104ee91906104f2565b5090565b61051491905b808211156105105760008160009055506001016104f8565b5090565b9056fea265627a7a72315820632181e87813f98d44c7d7033f26b92defe5d299eb37ff65b3f8a828f21fb3cd64736f6c63430005100032", 83 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063111002aa146100515780638d9776721461010c578063ac0c5732146101c5578063fe50cc72146101e3575b600080fd5b61010a6004803603602081101561006757600080fd5b810190808035906020019064010000000081111561008457600080fd5b82018360208201111561009657600080fd5b803590602001918460018302840111640100000000831117156100b857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610266565b005b6101386004803603602081101561012257600080fd5b81019080803590602001909291905050506102f8565b604051808481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561018857808201518184015260208101905061016d565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b6101cd6103c7565b6040518082815260200191505060405180910390f35b6101eb6103d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561022b578082015181840152602081019050610210565b50505050905090810190601f1680156102585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000808154809291906001019190505550604051806060016040528060005481526020018281526020016000151581525060026000805481526020019081526020016000206000820151816000015560208201518160010190805190602001906102d1929190610472565b5060408201518160020160006101000a81548160ff02191690831515021790555090505050565b6002602052806000526040600020600091509050806000015490806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050908060020160009054906101000a900460ff16905083565b60008054905090565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104685780601f1061043d57610100808354040283529160200191610468565b820191906000526020600020905b81548152906001019060200180831161044b57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b357805160ff19168380011785556104e1565b828001600101855582156104e1579182015b828111156104e05782518255916020019190600101906104c5565b5b5090506104ee91906104f2565b5090565b61051491905b808211156105105760008160009055506001016104f8565b5090565b9056fea265627a7a72315820632181e87813f98d44c7d7033f26b92defe5d299eb37ff65b3f8a828f21fb3cd64736f6c63430005100032", 84 | "sourceMap": "34:556:2:-;;;75:1;54:22;;82:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;34:556;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:556:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", 85 | "deployedSourceMap": "34:556:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:556:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;445:143;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;445:143:2;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;445:143:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;445:143:2;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;445:143:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;445:143:2;;;;;;;;;;;;;;;:::i;:::-;;214:37;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;214:37:2;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;214:37:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;258:89;;;:::i;:::-;;;;;;;;;;;;;;;;;;;353:86;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;353:86:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;445:143;506:10;;:12;;;;;;;;;;;;;548:33;;;;;;;;553:10;;548:33;;;;565:8;548:33;;;;575:5;548:33;;;;;528:5;:17;534:10;;528:17;;;;;;;;;;;:53;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;445:143;:::o;214:37::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;258:89::-;304:7;330:10;;323:17;;258:89;:::o;353:86::-;397:13;429:3;422:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;353:86;:::o;34:556::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", 86 | "source": "pragma solidity >=0.4.21 <0.7.0;\n\ncontract Todo {\n uint256 countTasks = 0;\n string msg = \"Hello from Ethereum\";\n struct Task {\n uint256 id;\n string content;\n bool complete;\n }\n\n mapping(uint256 => Task) public tasks;\n\n function getCountTasks() public view returns (uint256) {\n return countTasks;\n }\n\n function getGreeting() public view returns (string memory) {\n return msg;\n }\n\n function createTask(string memory _content) public {\n countTasks++;\n tasks[countTasks] = Task(countTasks, _content, false);\n }\n}\n", 87 | "sourcePath": "/home/soubai/Desktop/talks/dapp-todo-list-react/contracts/Todo.sol", 88 | "ast": { 89 | "absolutePath": "project:/contracts/Todo.sol", 90 | "exportedSymbols": { 91 | "Todo": [ 92 | 114 93 | ] 94 | }, 95 | "id": 115, 96 | "nodeType": "SourceUnit", 97 | "nodes": [ 98 | { 99 | "id": 61, 100 | "literals": [ 101 | "solidity", 102 | ">=", 103 | "0.4", 104 | ".21", 105 | "<", 106 | "0.7", 107 | ".0" 108 | ], 109 | "nodeType": "PragmaDirective", 110 | "src": "0:32:2" 111 | }, 112 | { 113 | "baseContracts": [], 114 | "contractDependencies": [], 115 | "contractKind": "contract", 116 | "documentation": null, 117 | "fullyImplemented": true, 118 | "id": 114, 119 | "linearizedBaseContracts": [ 120 | 114 121 | ], 122 | "name": "Todo", 123 | "nodeType": "ContractDefinition", 124 | "nodes": [ 125 | { 126 | "constant": false, 127 | "id": 64, 128 | "name": "countTasks", 129 | "nodeType": "VariableDeclaration", 130 | "scope": 114, 131 | "src": "54:22:2", 132 | "stateVariable": true, 133 | "storageLocation": "default", 134 | "typeDescriptions": { 135 | "typeIdentifier": "t_uint256", 136 | "typeString": "uint256" 137 | }, 138 | "typeName": { 139 | "id": 62, 140 | "name": "uint256", 141 | "nodeType": "ElementaryTypeName", 142 | "src": "54:7:2", 143 | "typeDescriptions": { 144 | "typeIdentifier": "t_uint256", 145 | "typeString": "uint256" 146 | } 147 | }, 148 | "value": { 149 | "argumentTypes": null, 150 | "hexValue": "30", 151 | "id": 63, 152 | "isConstant": false, 153 | "isLValue": false, 154 | "isPure": true, 155 | "kind": "number", 156 | "lValueRequested": false, 157 | "nodeType": "Literal", 158 | "src": "75:1:2", 159 | "subdenomination": null, 160 | "typeDescriptions": { 161 | "typeIdentifier": "t_rational_0_by_1", 162 | "typeString": "int_const 0" 163 | }, 164 | "value": "0" 165 | }, 166 | "visibility": "internal" 167 | }, 168 | { 169 | "constant": false, 170 | "id": 67, 171 | "name": "msg", 172 | "nodeType": "VariableDeclaration", 173 | "scope": 114, 174 | "src": "82:34:2", 175 | "stateVariable": true, 176 | "storageLocation": "default", 177 | "typeDescriptions": { 178 | "typeIdentifier": "t_string_storage", 179 | "typeString": "string" 180 | }, 181 | "typeName": { 182 | "id": 65, 183 | "name": "string", 184 | "nodeType": "ElementaryTypeName", 185 | "src": "82:6:2", 186 | "typeDescriptions": { 187 | "typeIdentifier": "t_string_storage_ptr", 188 | "typeString": "string" 189 | } 190 | }, 191 | "value": { 192 | "argumentTypes": null, 193 | "hexValue": "48656c6c6f2066726f6d20457468657265756d", 194 | "id": 66, 195 | "isConstant": false, 196 | "isLValue": false, 197 | "isPure": true, 198 | "kind": "string", 199 | "lValueRequested": false, 200 | "nodeType": "Literal", 201 | "src": "95:21:2", 202 | "subdenomination": null, 203 | "typeDescriptions": { 204 | "typeIdentifier": "t_stringliteral_67e75f67d8951f33b2d9f20bdffdac65cd0c022044bdd97d883d9d5be202c70d", 205 | "typeString": "literal_string \"Hello from Ethereum\"" 206 | }, 207 | "value": "Hello from Ethereum" 208 | }, 209 | "visibility": "internal" 210 | }, 211 | { 212 | "canonicalName": "Todo.Task", 213 | "id": 74, 214 | "members": [ 215 | { 216 | "constant": false, 217 | "id": 69, 218 | "name": "id", 219 | "nodeType": "VariableDeclaration", 220 | "scope": 74, 221 | "src": "144:10:2", 222 | "stateVariable": false, 223 | "storageLocation": "default", 224 | "typeDescriptions": { 225 | "typeIdentifier": "t_uint256", 226 | "typeString": "uint256" 227 | }, 228 | "typeName": { 229 | "id": 68, 230 | "name": "uint256", 231 | "nodeType": "ElementaryTypeName", 232 | "src": "144:7:2", 233 | "typeDescriptions": { 234 | "typeIdentifier": "t_uint256", 235 | "typeString": "uint256" 236 | } 237 | }, 238 | "value": null, 239 | "visibility": "internal" 240 | }, 241 | { 242 | "constant": false, 243 | "id": 71, 244 | "name": "content", 245 | "nodeType": "VariableDeclaration", 246 | "scope": 74, 247 | "src": "164:14:2", 248 | "stateVariable": false, 249 | "storageLocation": "default", 250 | "typeDescriptions": { 251 | "typeIdentifier": "t_string_storage_ptr", 252 | "typeString": "string" 253 | }, 254 | "typeName": { 255 | "id": 70, 256 | "name": "string", 257 | "nodeType": "ElementaryTypeName", 258 | "src": "164:6:2", 259 | "typeDescriptions": { 260 | "typeIdentifier": "t_string_storage_ptr", 261 | "typeString": "string" 262 | } 263 | }, 264 | "value": null, 265 | "visibility": "internal" 266 | }, 267 | { 268 | "constant": false, 269 | "id": 73, 270 | "name": "complete", 271 | "nodeType": "VariableDeclaration", 272 | "scope": 74, 273 | "src": "188:13:2", 274 | "stateVariable": false, 275 | "storageLocation": "default", 276 | "typeDescriptions": { 277 | "typeIdentifier": "t_bool", 278 | "typeString": "bool" 279 | }, 280 | "typeName": { 281 | "id": 72, 282 | "name": "bool", 283 | "nodeType": "ElementaryTypeName", 284 | "src": "188:4:2", 285 | "typeDescriptions": { 286 | "typeIdentifier": "t_bool", 287 | "typeString": "bool" 288 | } 289 | }, 290 | "value": null, 291 | "visibility": "internal" 292 | } 293 | ], 294 | "name": "Task", 295 | "nodeType": "StructDefinition", 296 | "scope": 114, 297 | "src": "122:86:2", 298 | "visibility": "public" 299 | }, 300 | { 301 | "constant": false, 302 | "id": 78, 303 | "name": "tasks", 304 | "nodeType": "VariableDeclaration", 305 | "scope": 114, 306 | "src": "214:37:2", 307 | "stateVariable": true, 308 | "storageLocation": "default", 309 | "typeDescriptions": { 310 | "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Task_$74_storage_$", 311 | "typeString": "mapping(uint256 => struct Todo.Task)" 312 | }, 313 | "typeName": { 314 | "id": 77, 315 | "keyType": { 316 | "id": 75, 317 | "name": "uint256", 318 | "nodeType": "ElementaryTypeName", 319 | "src": "222:7:2", 320 | "typeDescriptions": { 321 | "typeIdentifier": "t_uint256", 322 | "typeString": "uint256" 323 | } 324 | }, 325 | "nodeType": "Mapping", 326 | "src": "214:24:2", 327 | "typeDescriptions": { 328 | "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Task_$74_storage_$", 329 | "typeString": "mapping(uint256 => struct Todo.Task)" 330 | }, 331 | "valueType": { 332 | "contractScope": null, 333 | "id": 76, 334 | "name": "Task", 335 | "nodeType": "UserDefinedTypeName", 336 | "referencedDeclaration": 74, 337 | "src": "233:4:2", 338 | "typeDescriptions": { 339 | "typeIdentifier": "t_struct$_Task_$74_storage_ptr", 340 | "typeString": "struct Todo.Task" 341 | } 342 | } 343 | }, 344 | "value": null, 345 | "visibility": "public" 346 | }, 347 | { 348 | "body": { 349 | "id": 85, 350 | "nodeType": "Block", 351 | "src": "313:34:2", 352 | "statements": [ 353 | { 354 | "expression": { 355 | "argumentTypes": null, 356 | "id": 83, 357 | "name": "countTasks", 358 | "nodeType": "Identifier", 359 | "overloadedDeclarations": [], 360 | "referencedDeclaration": 64, 361 | "src": "330:10:2", 362 | "typeDescriptions": { 363 | "typeIdentifier": "t_uint256", 364 | "typeString": "uint256" 365 | } 366 | }, 367 | "functionReturnParameters": 82, 368 | "id": 84, 369 | "nodeType": "Return", 370 | "src": "323:17:2" 371 | } 372 | ] 373 | }, 374 | "documentation": null, 375 | "id": 86, 376 | "implemented": true, 377 | "kind": "function", 378 | "modifiers": [], 379 | "name": "getCountTasks", 380 | "nodeType": "FunctionDefinition", 381 | "parameters": { 382 | "id": 79, 383 | "nodeType": "ParameterList", 384 | "parameters": [], 385 | "src": "280:2:2" 386 | }, 387 | "returnParameters": { 388 | "id": 82, 389 | "nodeType": "ParameterList", 390 | "parameters": [ 391 | { 392 | "constant": false, 393 | "id": 81, 394 | "name": "", 395 | "nodeType": "VariableDeclaration", 396 | "scope": 86, 397 | "src": "304:7:2", 398 | "stateVariable": false, 399 | "storageLocation": "default", 400 | "typeDescriptions": { 401 | "typeIdentifier": "t_uint256", 402 | "typeString": "uint256" 403 | }, 404 | "typeName": { 405 | "id": 80, 406 | "name": "uint256", 407 | "nodeType": "ElementaryTypeName", 408 | "src": "304:7:2", 409 | "typeDescriptions": { 410 | "typeIdentifier": "t_uint256", 411 | "typeString": "uint256" 412 | } 413 | }, 414 | "value": null, 415 | "visibility": "internal" 416 | } 417 | ], 418 | "src": "303:9:2" 419 | }, 420 | "scope": 114, 421 | "src": "258:89:2", 422 | "stateMutability": "view", 423 | "superFunction": null, 424 | "visibility": "public" 425 | }, 426 | { 427 | "body": { 428 | "id": 93, 429 | "nodeType": "Block", 430 | "src": "412:27:2", 431 | "statements": [ 432 | { 433 | "expression": { 434 | "argumentTypes": null, 435 | "id": 91, 436 | "name": "msg", 437 | "nodeType": "Identifier", 438 | "overloadedDeclarations": [], 439 | "referencedDeclaration": 67, 440 | "src": "429:3:2", 441 | "typeDescriptions": { 442 | "typeIdentifier": "t_string_storage", 443 | "typeString": "string storage ref" 444 | } 445 | }, 446 | "functionReturnParameters": 90, 447 | "id": 92, 448 | "nodeType": "Return", 449 | "src": "422:10:2" 450 | } 451 | ] 452 | }, 453 | "documentation": null, 454 | "id": 94, 455 | "implemented": true, 456 | "kind": "function", 457 | "modifiers": [], 458 | "name": "getGreeting", 459 | "nodeType": "FunctionDefinition", 460 | "parameters": { 461 | "id": 87, 462 | "nodeType": "ParameterList", 463 | "parameters": [], 464 | "src": "373:2:2" 465 | }, 466 | "returnParameters": { 467 | "id": 90, 468 | "nodeType": "ParameterList", 469 | "parameters": [ 470 | { 471 | "constant": false, 472 | "id": 89, 473 | "name": "", 474 | "nodeType": "VariableDeclaration", 475 | "scope": 94, 476 | "src": "397:13:2", 477 | "stateVariable": false, 478 | "storageLocation": "memory", 479 | "typeDescriptions": { 480 | "typeIdentifier": "t_string_memory_ptr", 481 | "typeString": "string" 482 | }, 483 | "typeName": { 484 | "id": 88, 485 | "name": "string", 486 | "nodeType": "ElementaryTypeName", 487 | "src": "397:6:2", 488 | "typeDescriptions": { 489 | "typeIdentifier": "t_string_storage_ptr", 490 | "typeString": "string" 491 | } 492 | }, 493 | "value": null, 494 | "visibility": "internal" 495 | } 496 | ], 497 | "src": "396:15:2" 498 | }, 499 | "scope": 114, 500 | "src": "353:86:2", 501 | "stateMutability": "view", 502 | "superFunction": null, 503 | "visibility": "public" 504 | }, 505 | { 506 | "body": { 507 | "id": 112, 508 | "nodeType": "Block", 509 | "src": "496:92:2", 510 | "statements": [ 511 | { 512 | "expression": { 513 | "argumentTypes": null, 514 | "id": 100, 515 | "isConstant": false, 516 | "isLValue": false, 517 | "isPure": false, 518 | "lValueRequested": false, 519 | "nodeType": "UnaryOperation", 520 | "operator": "++", 521 | "prefix": false, 522 | "src": "506:12:2", 523 | "subExpression": { 524 | "argumentTypes": null, 525 | "id": 99, 526 | "name": "countTasks", 527 | "nodeType": "Identifier", 528 | "overloadedDeclarations": [], 529 | "referencedDeclaration": 64, 530 | "src": "506:10:2", 531 | "typeDescriptions": { 532 | "typeIdentifier": "t_uint256", 533 | "typeString": "uint256" 534 | } 535 | }, 536 | "typeDescriptions": { 537 | "typeIdentifier": "t_uint256", 538 | "typeString": "uint256" 539 | } 540 | }, 541 | "id": 101, 542 | "nodeType": "ExpressionStatement", 543 | "src": "506:12:2" 544 | }, 545 | { 546 | "expression": { 547 | "argumentTypes": null, 548 | "id": 110, 549 | "isConstant": false, 550 | "isLValue": false, 551 | "isPure": false, 552 | "lValueRequested": false, 553 | "leftHandSide": { 554 | "argumentTypes": null, 555 | "baseExpression": { 556 | "argumentTypes": null, 557 | "id": 102, 558 | "name": "tasks", 559 | "nodeType": "Identifier", 560 | "overloadedDeclarations": [], 561 | "referencedDeclaration": 78, 562 | "src": "528:5:2", 563 | "typeDescriptions": { 564 | "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_Task_$74_storage_$", 565 | "typeString": "mapping(uint256 => struct Todo.Task storage ref)" 566 | } 567 | }, 568 | "id": 104, 569 | "indexExpression": { 570 | "argumentTypes": null, 571 | "id": 103, 572 | "name": "countTasks", 573 | "nodeType": "Identifier", 574 | "overloadedDeclarations": [], 575 | "referencedDeclaration": 64, 576 | "src": "534:10:2", 577 | "typeDescriptions": { 578 | "typeIdentifier": "t_uint256", 579 | "typeString": "uint256" 580 | } 581 | }, 582 | "isConstant": false, 583 | "isLValue": true, 584 | "isPure": false, 585 | "lValueRequested": true, 586 | "nodeType": "IndexAccess", 587 | "src": "528:17:2", 588 | "typeDescriptions": { 589 | "typeIdentifier": "t_struct$_Task_$74_storage", 590 | "typeString": "struct Todo.Task storage ref" 591 | } 592 | }, 593 | "nodeType": "Assignment", 594 | "operator": "=", 595 | "rightHandSide": { 596 | "argumentTypes": null, 597 | "arguments": [ 598 | { 599 | "argumentTypes": null, 600 | "id": 106, 601 | "name": "countTasks", 602 | "nodeType": "Identifier", 603 | "overloadedDeclarations": [], 604 | "referencedDeclaration": 64, 605 | "src": "553:10:2", 606 | "typeDescriptions": { 607 | "typeIdentifier": "t_uint256", 608 | "typeString": "uint256" 609 | } 610 | }, 611 | { 612 | "argumentTypes": null, 613 | "id": 107, 614 | "name": "_content", 615 | "nodeType": "Identifier", 616 | "overloadedDeclarations": [], 617 | "referencedDeclaration": 96, 618 | "src": "565:8:2", 619 | "typeDescriptions": { 620 | "typeIdentifier": "t_string_memory_ptr", 621 | "typeString": "string memory" 622 | } 623 | }, 624 | { 625 | "argumentTypes": null, 626 | "hexValue": "66616c7365", 627 | "id": 108, 628 | "isConstant": false, 629 | "isLValue": false, 630 | "isPure": true, 631 | "kind": "bool", 632 | "lValueRequested": false, 633 | "nodeType": "Literal", 634 | "src": "575:5:2", 635 | "subdenomination": null, 636 | "typeDescriptions": { 637 | "typeIdentifier": "t_bool", 638 | "typeString": "bool" 639 | }, 640 | "value": "false" 641 | } 642 | ], 643 | "expression": { 644 | "argumentTypes": [ 645 | { 646 | "typeIdentifier": "t_uint256", 647 | "typeString": "uint256" 648 | }, 649 | { 650 | "typeIdentifier": "t_string_memory_ptr", 651 | "typeString": "string memory" 652 | }, 653 | { 654 | "typeIdentifier": "t_bool", 655 | "typeString": "bool" 656 | } 657 | ], 658 | "id": 105, 659 | "name": "Task", 660 | "nodeType": "Identifier", 661 | "overloadedDeclarations": [], 662 | "referencedDeclaration": 74, 663 | "src": "548:4:2", 664 | "typeDescriptions": { 665 | "typeIdentifier": "t_type$_t_struct$_Task_$74_storage_ptr_$", 666 | "typeString": "type(struct Todo.Task storage pointer)" 667 | } 668 | }, 669 | "id": 109, 670 | "isConstant": false, 671 | "isLValue": false, 672 | "isPure": false, 673 | "kind": "structConstructorCall", 674 | "lValueRequested": false, 675 | "names": [], 676 | "nodeType": "FunctionCall", 677 | "src": "548:33:2", 678 | "typeDescriptions": { 679 | "typeIdentifier": "t_struct$_Task_$74_memory", 680 | "typeString": "struct Todo.Task memory" 681 | } 682 | }, 683 | "src": "528:53:2", 684 | "typeDescriptions": { 685 | "typeIdentifier": "t_struct$_Task_$74_storage", 686 | "typeString": "struct Todo.Task storage ref" 687 | } 688 | }, 689 | "id": 111, 690 | "nodeType": "ExpressionStatement", 691 | "src": "528:53:2" 692 | } 693 | ] 694 | }, 695 | "documentation": null, 696 | "id": 113, 697 | "implemented": true, 698 | "kind": "function", 699 | "modifiers": [], 700 | "name": "createTask", 701 | "nodeType": "FunctionDefinition", 702 | "parameters": { 703 | "id": 97, 704 | "nodeType": "ParameterList", 705 | "parameters": [ 706 | { 707 | "constant": false, 708 | "id": 96, 709 | "name": "_content", 710 | "nodeType": "VariableDeclaration", 711 | "scope": 113, 712 | "src": "465:22:2", 713 | "stateVariable": false, 714 | "storageLocation": "memory", 715 | "typeDescriptions": { 716 | "typeIdentifier": "t_string_memory_ptr", 717 | "typeString": "string" 718 | }, 719 | "typeName": { 720 | "id": 95, 721 | "name": "string", 722 | "nodeType": "ElementaryTypeName", 723 | "src": "465:6:2", 724 | "typeDescriptions": { 725 | "typeIdentifier": "t_string_storage_ptr", 726 | "typeString": "string" 727 | } 728 | }, 729 | "value": null, 730 | "visibility": "internal" 731 | } 732 | ], 733 | "src": "464:24:2" 734 | }, 735 | "returnParameters": { 736 | "id": 98, 737 | "nodeType": "ParameterList", 738 | "parameters": [], 739 | "src": "496:0:2" 740 | }, 741 | "scope": 114, 742 | "src": "445:143:2", 743 | "stateMutability": "nonpayable", 744 | "superFunction": null, 745 | "visibility": "public" 746 | } 747 | ], 748 | "scope": 115, 749 | "src": "34:556:2" 750 | } 751 | ], 752 | "src": "0:591:2" 753 | }, 754 | "legacyAST": { 755 | "attributes": { 756 | "absolutePath": "project:/contracts/Todo.sol", 757 | "exportedSymbols": { 758 | "Todo": [ 759 | 114 760 | ] 761 | } 762 | }, 763 | "children": [ 764 | { 765 | "attributes": { 766 | "literals": [ 767 | "solidity", 768 | ">=", 769 | "0.4", 770 | ".21", 771 | "<", 772 | "0.7", 773 | ".0" 774 | ] 775 | }, 776 | "id": 61, 777 | "name": "PragmaDirective", 778 | "src": "0:32:2" 779 | }, 780 | { 781 | "attributes": { 782 | "baseContracts": [ 783 | null 784 | ], 785 | "contractDependencies": [ 786 | null 787 | ], 788 | "contractKind": "contract", 789 | "documentation": null, 790 | "fullyImplemented": true, 791 | "linearizedBaseContracts": [ 792 | 114 793 | ], 794 | "name": "Todo", 795 | "scope": 115 796 | }, 797 | "children": [ 798 | { 799 | "attributes": { 800 | "constant": false, 801 | "name": "countTasks", 802 | "scope": 114, 803 | "stateVariable": true, 804 | "storageLocation": "default", 805 | "type": "uint256", 806 | "visibility": "internal" 807 | }, 808 | "children": [ 809 | { 810 | "attributes": { 811 | "name": "uint256", 812 | "type": "uint256" 813 | }, 814 | "id": 62, 815 | "name": "ElementaryTypeName", 816 | "src": "54:7:2" 817 | }, 818 | { 819 | "attributes": { 820 | "argumentTypes": null, 821 | "hexvalue": "30", 822 | "isConstant": false, 823 | "isLValue": false, 824 | "isPure": true, 825 | "lValueRequested": false, 826 | "subdenomination": null, 827 | "token": "number", 828 | "type": "int_const 0", 829 | "value": "0" 830 | }, 831 | "id": 63, 832 | "name": "Literal", 833 | "src": "75:1:2" 834 | } 835 | ], 836 | "id": 64, 837 | "name": "VariableDeclaration", 838 | "src": "54:22:2" 839 | }, 840 | { 841 | "attributes": { 842 | "constant": false, 843 | "name": "msg", 844 | "scope": 114, 845 | "stateVariable": true, 846 | "storageLocation": "default", 847 | "type": "string", 848 | "visibility": "internal" 849 | }, 850 | "children": [ 851 | { 852 | "attributes": { 853 | "name": "string", 854 | "type": "string" 855 | }, 856 | "id": 65, 857 | "name": "ElementaryTypeName", 858 | "src": "82:6:2" 859 | }, 860 | { 861 | "attributes": { 862 | "argumentTypes": null, 863 | "hexvalue": "48656c6c6f2066726f6d20457468657265756d", 864 | "isConstant": false, 865 | "isLValue": false, 866 | "isPure": true, 867 | "lValueRequested": false, 868 | "subdenomination": null, 869 | "token": "string", 870 | "type": "literal_string \"Hello from Ethereum\"", 871 | "value": "Hello from Ethereum" 872 | }, 873 | "id": 66, 874 | "name": "Literal", 875 | "src": "95:21:2" 876 | } 877 | ], 878 | "id": 67, 879 | "name": "VariableDeclaration", 880 | "src": "82:34:2" 881 | }, 882 | { 883 | "attributes": { 884 | "canonicalName": "Todo.Task", 885 | "name": "Task", 886 | "scope": 114, 887 | "visibility": "public" 888 | }, 889 | "children": [ 890 | { 891 | "attributes": { 892 | "constant": false, 893 | "name": "id", 894 | "scope": 74, 895 | "stateVariable": false, 896 | "storageLocation": "default", 897 | "type": "uint256", 898 | "value": null, 899 | "visibility": "internal" 900 | }, 901 | "children": [ 902 | { 903 | "attributes": { 904 | "name": "uint256", 905 | "type": "uint256" 906 | }, 907 | "id": 68, 908 | "name": "ElementaryTypeName", 909 | "src": "144:7:2" 910 | } 911 | ], 912 | "id": 69, 913 | "name": "VariableDeclaration", 914 | "src": "144:10:2" 915 | }, 916 | { 917 | "attributes": { 918 | "constant": false, 919 | "name": "content", 920 | "scope": 74, 921 | "stateVariable": false, 922 | "storageLocation": "default", 923 | "type": "string", 924 | "value": null, 925 | "visibility": "internal" 926 | }, 927 | "children": [ 928 | { 929 | "attributes": { 930 | "name": "string", 931 | "type": "string" 932 | }, 933 | "id": 70, 934 | "name": "ElementaryTypeName", 935 | "src": "164:6:2" 936 | } 937 | ], 938 | "id": 71, 939 | "name": "VariableDeclaration", 940 | "src": "164:14:2" 941 | }, 942 | { 943 | "attributes": { 944 | "constant": false, 945 | "name": "complete", 946 | "scope": 74, 947 | "stateVariable": false, 948 | "storageLocation": "default", 949 | "type": "bool", 950 | "value": null, 951 | "visibility": "internal" 952 | }, 953 | "children": [ 954 | { 955 | "attributes": { 956 | "name": "bool", 957 | "type": "bool" 958 | }, 959 | "id": 72, 960 | "name": "ElementaryTypeName", 961 | "src": "188:4:2" 962 | } 963 | ], 964 | "id": 73, 965 | "name": "VariableDeclaration", 966 | "src": "188:13:2" 967 | } 968 | ], 969 | "id": 74, 970 | "name": "StructDefinition", 971 | "src": "122:86:2" 972 | }, 973 | { 974 | "attributes": { 975 | "constant": false, 976 | "name": "tasks", 977 | "scope": 114, 978 | "stateVariable": true, 979 | "storageLocation": "default", 980 | "type": "mapping(uint256 => struct Todo.Task)", 981 | "value": null, 982 | "visibility": "public" 983 | }, 984 | "children": [ 985 | { 986 | "attributes": { 987 | "type": "mapping(uint256 => struct Todo.Task)" 988 | }, 989 | "children": [ 990 | { 991 | "attributes": { 992 | "name": "uint256", 993 | "type": "uint256" 994 | }, 995 | "id": 75, 996 | "name": "ElementaryTypeName", 997 | "src": "222:7:2" 998 | }, 999 | { 1000 | "attributes": { 1001 | "contractScope": null, 1002 | "name": "Task", 1003 | "referencedDeclaration": 74, 1004 | "type": "struct Todo.Task" 1005 | }, 1006 | "id": 76, 1007 | "name": "UserDefinedTypeName", 1008 | "src": "233:4:2" 1009 | } 1010 | ], 1011 | "id": 77, 1012 | "name": "Mapping", 1013 | "src": "214:24:2" 1014 | } 1015 | ], 1016 | "id": 78, 1017 | "name": "VariableDeclaration", 1018 | "src": "214:37:2" 1019 | }, 1020 | { 1021 | "attributes": { 1022 | "documentation": null, 1023 | "implemented": true, 1024 | "isConstructor": false, 1025 | "kind": "function", 1026 | "modifiers": [ 1027 | null 1028 | ], 1029 | "name": "getCountTasks", 1030 | "scope": 114, 1031 | "stateMutability": "view", 1032 | "superFunction": null, 1033 | "visibility": "public" 1034 | }, 1035 | "children": [ 1036 | { 1037 | "attributes": { 1038 | "parameters": [ 1039 | null 1040 | ] 1041 | }, 1042 | "children": [], 1043 | "id": 79, 1044 | "name": "ParameterList", 1045 | "src": "280:2:2" 1046 | }, 1047 | { 1048 | "children": [ 1049 | { 1050 | "attributes": { 1051 | "constant": false, 1052 | "name": "", 1053 | "scope": 86, 1054 | "stateVariable": false, 1055 | "storageLocation": "default", 1056 | "type": "uint256", 1057 | "value": null, 1058 | "visibility": "internal" 1059 | }, 1060 | "children": [ 1061 | { 1062 | "attributes": { 1063 | "name": "uint256", 1064 | "type": "uint256" 1065 | }, 1066 | "id": 80, 1067 | "name": "ElementaryTypeName", 1068 | "src": "304:7:2" 1069 | } 1070 | ], 1071 | "id": 81, 1072 | "name": "VariableDeclaration", 1073 | "src": "304:7:2" 1074 | } 1075 | ], 1076 | "id": 82, 1077 | "name": "ParameterList", 1078 | "src": "303:9:2" 1079 | }, 1080 | { 1081 | "children": [ 1082 | { 1083 | "attributes": { 1084 | "functionReturnParameters": 82 1085 | }, 1086 | "children": [ 1087 | { 1088 | "attributes": { 1089 | "argumentTypes": null, 1090 | "overloadedDeclarations": [ 1091 | null 1092 | ], 1093 | "referencedDeclaration": 64, 1094 | "type": "uint256", 1095 | "value": "countTasks" 1096 | }, 1097 | "id": 83, 1098 | "name": "Identifier", 1099 | "src": "330:10:2" 1100 | } 1101 | ], 1102 | "id": 84, 1103 | "name": "Return", 1104 | "src": "323:17:2" 1105 | } 1106 | ], 1107 | "id": 85, 1108 | "name": "Block", 1109 | "src": "313:34:2" 1110 | } 1111 | ], 1112 | "id": 86, 1113 | "name": "FunctionDefinition", 1114 | "src": "258:89:2" 1115 | }, 1116 | { 1117 | "attributes": { 1118 | "documentation": null, 1119 | "implemented": true, 1120 | "isConstructor": false, 1121 | "kind": "function", 1122 | "modifiers": [ 1123 | null 1124 | ], 1125 | "name": "getGreeting", 1126 | "scope": 114, 1127 | "stateMutability": "view", 1128 | "superFunction": null, 1129 | "visibility": "public" 1130 | }, 1131 | "children": [ 1132 | { 1133 | "attributes": { 1134 | "parameters": [ 1135 | null 1136 | ] 1137 | }, 1138 | "children": [], 1139 | "id": 87, 1140 | "name": "ParameterList", 1141 | "src": "373:2:2" 1142 | }, 1143 | { 1144 | "children": [ 1145 | { 1146 | "attributes": { 1147 | "constant": false, 1148 | "name": "", 1149 | "scope": 94, 1150 | "stateVariable": false, 1151 | "storageLocation": "memory", 1152 | "type": "string", 1153 | "value": null, 1154 | "visibility": "internal" 1155 | }, 1156 | "children": [ 1157 | { 1158 | "attributes": { 1159 | "name": "string", 1160 | "type": "string" 1161 | }, 1162 | "id": 88, 1163 | "name": "ElementaryTypeName", 1164 | "src": "397:6:2" 1165 | } 1166 | ], 1167 | "id": 89, 1168 | "name": "VariableDeclaration", 1169 | "src": "397:13:2" 1170 | } 1171 | ], 1172 | "id": 90, 1173 | "name": "ParameterList", 1174 | "src": "396:15:2" 1175 | }, 1176 | { 1177 | "children": [ 1178 | { 1179 | "attributes": { 1180 | "functionReturnParameters": 90 1181 | }, 1182 | "children": [ 1183 | { 1184 | "attributes": { 1185 | "argumentTypes": null, 1186 | "overloadedDeclarations": [ 1187 | null 1188 | ], 1189 | "referencedDeclaration": 67, 1190 | "type": "string storage ref", 1191 | "value": "msg" 1192 | }, 1193 | "id": 91, 1194 | "name": "Identifier", 1195 | "src": "429:3:2" 1196 | } 1197 | ], 1198 | "id": 92, 1199 | "name": "Return", 1200 | "src": "422:10:2" 1201 | } 1202 | ], 1203 | "id": 93, 1204 | "name": "Block", 1205 | "src": "412:27:2" 1206 | } 1207 | ], 1208 | "id": 94, 1209 | "name": "FunctionDefinition", 1210 | "src": "353:86:2" 1211 | }, 1212 | { 1213 | "attributes": { 1214 | "documentation": null, 1215 | "implemented": true, 1216 | "isConstructor": false, 1217 | "kind": "function", 1218 | "modifiers": [ 1219 | null 1220 | ], 1221 | "name": "createTask", 1222 | "scope": 114, 1223 | "stateMutability": "nonpayable", 1224 | "superFunction": null, 1225 | "visibility": "public" 1226 | }, 1227 | "children": [ 1228 | { 1229 | "children": [ 1230 | { 1231 | "attributes": { 1232 | "constant": false, 1233 | "name": "_content", 1234 | "scope": 113, 1235 | "stateVariable": false, 1236 | "storageLocation": "memory", 1237 | "type": "string", 1238 | "value": null, 1239 | "visibility": "internal" 1240 | }, 1241 | "children": [ 1242 | { 1243 | "attributes": { 1244 | "name": "string", 1245 | "type": "string" 1246 | }, 1247 | "id": 95, 1248 | "name": "ElementaryTypeName", 1249 | "src": "465:6:2" 1250 | } 1251 | ], 1252 | "id": 96, 1253 | "name": "VariableDeclaration", 1254 | "src": "465:22:2" 1255 | } 1256 | ], 1257 | "id": 97, 1258 | "name": "ParameterList", 1259 | "src": "464:24:2" 1260 | }, 1261 | { 1262 | "attributes": { 1263 | "parameters": [ 1264 | null 1265 | ] 1266 | }, 1267 | "children": [], 1268 | "id": 98, 1269 | "name": "ParameterList", 1270 | "src": "496:0:2" 1271 | }, 1272 | { 1273 | "children": [ 1274 | { 1275 | "children": [ 1276 | { 1277 | "attributes": { 1278 | "argumentTypes": null, 1279 | "isConstant": false, 1280 | "isLValue": false, 1281 | "isPure": false, 1282 | "lValueRequested": false, 1283 | "operator": "++", 1284 | "prefix": false, 1285 | "type": "uint256" 1286 | }, 1287 | "children": [ 1288 | { 1289 | "attributes": { 1290 | "argumentTypes": null, 1291 | "overloadedDeclarations": [ 1292 | null 1293 | ], 1294 | "referencedDeclaration": 64, 1295 | "type": "uint256", 1296 | "value": "countTasks" 1297 | }, 1298 | "id": 99, 1299 | "name": "Identifier", 1300 | "src": "506:10:2" 1301 | } 1302 | ], 1303 | "id": 100, 1304 | "name": "UnaryOperation", 1305 | "src": "506:12:2" 1306 | } 1307 | ], 1308 | "id": 101, 1309 | "name": "ExpressionStatement", 1310 | "src": "506:12:2" 1311 | }, 1312 | { 1313 | "children": [ 1314 | { 1315 | "attributes": { 1316 | "argumentTypes": null, 1317 | "isConstant": false, 1318 | "isLValue": false, 1319 | "isPure": false, 1320 | "lValueRequested": false, 1321 | "operator": "=", 1322 | "type": "struct Todo.Task storage ref" 1323 | }, 1324 | "children": [ 1325 | { 1326 | "attributes": { 1327 | "argumentTypes": null, 1328 | "isConstant": false, 1329 | "isLValue": true, 1330 | "isPure": false, 1331 | "lValueRequested": true, 1332 | "type": "struct Todo.Task storage ref" 1333 | }, 1334 | "children": [ 1335 | { 1336 | "attributes": { 1337 | "argumentTypes": null, 1338 | "overloadedDeclarations": [ 1339 | null 1340 | ], 1341 | "referencedDeclaration": 78, 1342 | "type": "mapping(uint256 => struct Todo.Task storage ref)", 1343 | "value": "tasks" 1344 | }, 1345 | "id": 102, 1346 | "name": "Identifier", 1347 | "src": "528:5:2" 1348 | }, 1349 | { 1350 | "attributes": { 1351 | "argumentTypes": null, 1352 | "overloadedDeclarations": [ 1353 | null 1354 | ], 1355 | "referencedDeclaration": 64, 1356 | "type": "uint256", 1357 | "value": "countTasks" 1358 | }, 1359 | "id": 103, 1360 | "name": "Identifier", 1361 | "src": "534:10:2" 1362 | } 1363 | ], 1364 | "id": 104, 1365 | "name": "IndexAccess", 1366 | "src": "528:17:2" 1367 | }, 1368 | { 1369 | "attributes": { 1370 | "argumentTypes": null, 1371 | "isConstant": false, 1372 | "isLValue": false, 1373 | "isPure": false, 1374 | "isStructConstructorCall": true, 1375 | "lValueRequested": false, 1376 | "names": [ 1377 | null 1378 | ], 1379 | "type": "struct Todo.Task memory", 1380 | "type_conversion": false 1381 | }, 1382 | "children": [ 1383 | { 1384 | "attributes": { 1385 | "argumentTypes": [ 1386 | { 1387 | "typeIdentifier": "t_uint256", 1388 | "typeString": "uint256" 1389 | }, 1390 | { 1391 | "typeIdentifier": "t_string_memory_ptr", 1392 | "typeString": "string memory" 1393 | }, 1394 | { 1395 | "typeIdentifier": "t_bool", 1396 | "typeString": "bool" 1397 | } 1398 | ], 1399 | "overloadedDeclarations": [ 1400 | null 1401 | ], 1402 | "referencedDeclaration": 74, 1403 | "type": "type(struct Todo.Task storage pointer)", 1404 | "value": "Task" 1405 | }, 1406 | "id": 105, 1407 | "name": "Identifier", 1408 | "src": "548:4:2" 1409 | }, 1410 | { 1411 | "attributes": { 1412 | "argumentTypes": null, 1413 | "overloadedDeclarations": [ 1414 | null 1415 | ], 1416 | "referencedDeclaration": 64, 1417 | "type": "uint256", 1418 | "value": "countTasks" 1419 | }, 1420 | "id": 106, 1421 | "name": "Identifier", 1422 | "src": "553:10:2" 1423 | }, 1424 | { 1425 | "attributes": { 1426 | "argumentTypes": null, 1427 | "overloadedDeclarations": [ 1428 | null 1429 | ], 1430 | "referencedDeclaration": 96, 1431 | "type": "string memory", 1432 | "value": "_content" 1433 | }, 1434 | "id": 107, 1435 | "name": "Identifier", 1436 | "src": "565:8:2" 1437 | }, 1438 | { 1439 | "attributes": { 1440 | "argumentTypes": null, 1441 | "hexvalue": "66616c7365", 1442 | "isConstant": false, 1443 | "isLValue": false, 1444 | "isPure": true, 1445 | "lValueRequested": false, 1446 | "subdenomination": null, 1447 | "token": "bool", 1448 | "type": "bool", 1449 | "value": "false" 1450 | }, 1451 | "id": 108, 1452 | "name": "Literal", 1453 | "src": "575:5:2" 1454 | } 1455 | ], 1456 | "id": 109, 1457 | "name": "FunctionCall", 1458 | "src": "548:33:2" 1459 | } 1460 | ], 1461 | "id": 110, 1462 | "name": "Assignment", 1463 | "src": "528:53:2" 1464 | } 1465 | ], 1466 | "id": 111, 1467 | "name": "ExpressionStatement", 1468 | "src": "528:53:2" 1469 | } 1470 | ], 1471 | "id": 112, 1472 | "name": "Block", 1473 | "src": "496:92:2" 1474 | } 1475 | ], 1476 | "id": 113, 1477 | "name": "FunctionDefinition", 1478 | "src": "445:143:2" 1479 | } 1480 | ], 1481 | "id": 114, 1482 | "name": "ContractDefinition", 1483 | "src": "34:556:2" 1484 | } 1485 | ], 1486 | "id": 115, 1487 | "name": "SourceUnit", 1488 | "src": "0:591:2" 1489 | }, 1490 | "compiler": { 1491 | "name": "solc", 1492 | "version": "0.5.16+commit.9c3226ce.Emscripten.clang" 1493 | }, 1494 | "networks": { 1495 | "5777": { 1496 | "events": {}, 1497 | "links": {}, 1498 | "address": "0xd9E7FEeB4012D2f8b787E9EC1D26BAA2a3c7d0FC", 1499 | "transactionHash": "0xd847a7305836bd2a3e99bc691109e4225d1be97246b940c8ec08e2d5f12b463b" 1500 | } 1501 | }, 1502 | "schemaVersion": "3.4.3", 1503 | "updatedAt": "2021-12-17T17:35:15.758Z", 1504 | "networkType": "ethereum", 1505 | "devdoc": { 1506 | "methods": {} 1507 | }, 1508 | "userdoc": { 1509 | "methods": {} 1510 | } 1511 | } -------------------------------------------------------------------------------- /client/src/getWeb3.js: -------------------------------------------------------------------------------- 1 | import Web3 from "web3"; 2 | 3 | const getWeb3 = () => 4 | new Promise((resolve, reject) => { 5 | const provider = new Web3.providers.HttpProvider("http://127.0.0.1:8545"); 6 | const web3 = new Web3(provider); 7 | console.log("No web3 instance injected, using Local web3."); 8 | resolve(web3); 9 | }); 10 | 11 | export default getWeb3; 12 | -------------------------------------------------------------------------------- /client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /client/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.21 <0.7.0; 3 | 4 | contract Migrations { 5 | address public owner; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | if (msg.sender == owner) _; 10 | } 11 | 12 | constructor() public { 13 | owner = msg.sender; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /contracts/SimpleStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.21 <0.7.0; 3 | 4 | contract SimpleStorage { 5 | uint storedData; 6 | 7 | function set(uint x) public { 8 | storedData = x; 9 | } 10 | 11 | function get() public view returns (uint) { 12 | return storedData; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/Todo.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.7.0; 2 | 3 | contract Todo { 4 | uint256 countTasks = 0; 5 | string msg = "Hello from Ethereum"; 6 | struct Task { 7 | uint256 id; 8 | string content; 9 | bool complete; 10 | } 11 | 12 | mapping(uint256 => Task) public tasks; 13 | 14 | function getCountTasks() public view returns (uint256) { 15 | return countTasks; 16 | } 17 | 18 | function getGreeting() public view returns (string memory) { 19 | return msg; 20 | } 21 | 22 | function createTask(string memory _content) public { 23 | countTasks++; 24 | tasks[countTasks] = Task(countTasks, _content, false); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | var SimpleStorage = artifacts.require("./SimpleStorage.sol"); 2 | var Todo = artifacts.require("./Todo.sol"); 3 | 4 | module.exports = function(deployer) { 5 | deployer.deploy(Todo); 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /test/TestSimpleStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.7.0; 2 | 3 | import "truffle/Assert.sol"; 4 | import "truffle/DeployedAddresses.sol"; 5 | import "../contracts/SimpleStorage.sol"; 6 | 7 | contract TestSimpleStorage { 8 | 9 | function testItStoresAValue() public { 10 | SimpleStorage simpleStorage = SimpleStorage(DeployedAddresses.SimpleStorage()); 11 | 12 | simpleStorage.set(89); 13 | 14 | uint expected = 89; 15 | 16 | Assert.equal(simpleStorage.get(), expected, "It should store the value 89."); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /test/simplestorage.js: -------------------------------------------------------------------------------- 1 | const SimpleStorage = artifacts.require("./SimpleStorage.sol"); 2 | 3 | contract("SimpleStorage", accounts => { 4 | it("...should store the value 89.", async () => { 5 | const simpleStorageInstance = await SimpleStorage.deployed(); 6 | 7 | // Set value of 89 8 | await simpleStorageInstance.set(89, { from: accounts[0] }); 9 | 10 | // Get stored value 11 | const storedData = await simpleStorageInstance.get.call(); 12 | 13 | assert.equal(storedData, 89, "The value 89 was not stored."); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | // See 5 | // to customize your Truffle configuration! 6 | contracts_build_directory: path.join(__dirname, "client/src/contracts"), 7 | networks: { 8 | develop: { 9 | port: 8545 10 | } 11 | } 12 | }; 13 | --------------------------------------------------------------------------------