├── .gitignore ├── LICENSE ├── README.md ├── box-img-lg.png ├── box-img-sm.png ├── bs-config.json ├── build └── contracts │ ├── Adoption.json │ └── Migrations.json ├── contracts ├── Adoption.sol └── Migrations.sol ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js ├── package-lock.json ├── package.json ├── src ├── css │ ├── bootstrap.min.css │ └── bootstrap.min.css.map ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── images │ ├── boxer.jpeg │ ├── caramelo.jpg │ ├── french-bulldog.jpeg │ ├── golden-retriever.jpeg │ ├── poodle.jpg │ ├── scottish-terrier.jpeg │ └── srd.jpg ├── index.html ├── js │ ├── app.js │ ├── bootstrap.min.js │ ├── truffle-contract.js │ └── web3.min.js └── pets.json └── truffle-config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /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 | 2 | 3 | # dio-blockchain-for-devs 4 | 5 | ## Pré-requsitos 6 | 7 | ### Instalar o NodeJS com NPM: 8 | 9 | - https://nodejs.org/en/download/ 10 | 11 | ### Instalar o VS Code: 12 | 13 | - https://code.visualstudio.com/download 14 | 15 | ### Download do Ganache: 16 | 17 | - https://trufflesuite.com/ganache/ 18 | 19 | ### Instalação do Metamask: 20 | 21 | - https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en 22 | 23 | ## Instruções 24 | 25 | ## O projeto 26 | 27 | ### Clonar o repositório e acessar o projeto: 28 | 29 | - git clone https://github.com/digitalinnovationone/dio-blockchain-for-devs.git 30 | 31 | - cd dio-blockchain-for-devs 32 | 33 | ### Instalar os pacotes do NPM: 34 | 35 | - npm i 36 | 37 | ### Instalar o Framework Truffle: 38 | 39 | - npm i -g truffle 40 | 41 | ## Configurações 42 | 43 | - Executar o Ganache 44 | 45 | ### No Metamask 46 | 47 | - Criar a nova carteira no Metamask e salvar a seed 48 | 49 | - Criar uma nova rede com a RPC URL: http://127.0.0.1:7545 50 | 51 | - O nome e o símbolo são personalizadas (DIOCoin) (DIO) 52 | 53 | ### Importando conta do Ganache no Metamask 54 | 55 | - Selecionar a chave privada de um dos endereços (no símbolo da chave) no Ganache 56 | 57 | - Importar conta no Metamask passando a chave privada 58 | 59 | ## Compilando o contrato 60 | 61 | - truffle compile 62 | 63 | ## Deploy na blockchain 64 | 65 | - truffle deploy 66 | 67 | ## Realizando transações 68 | 69 | - Irão solicitar a aprovação da transação no Metamask 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /box-img-lg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/box-img-lg.png -------------------------------------------------------------------------------- /box-img-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/box-img-sm.png -------------------------------------------------------------------------------- /bs-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": { 3 | "baseDir": ["./src", "./build/contracts"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /build/contracts/Adoption.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Adoption", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [ 7 | { 8 | "internalType": "uint256", 9 | "name": "", 10 | "type": "uint256" 11 | } 12 | ], 13 | "name": "adopters", 14 | "outputs": [ 15 | { 16 | "internalType": "address", 17 | "name": "", 18 | "type": "address" 19 | } 20 | ], 21 | "payable": false, 22 | "stateMutability": "view", 23 | "type": "function" 24 | }, 25 | { 26 | "constant": false, 27 | "inputs": [ 28 | { 29 | "internalType": "uint256", 30 | "name": "petId", 31 | "type": "uint256" 32 | } 33 | ], 34 | "name": "adopt", 35 | "outputs": [ 36 | { 37 | "internalType": "uint256", 38 | "name": "", 39 | "type": "uint256" 40 | } 41 | ], 42 | "payable": false, 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | }, 46 | { 47 | "constant": true, 48 | "inputs": [], 49 | "name": "getAdopters", 50 | "outputs": [ 51 | { 52 | "internalType": "address[16]", 53 | "name": "", 54 | "type": "address[16]" 55 | } 56 | ], 57 | "payable": false, 58 | "stateMutability": "view", 59 | "type": "function" 60 | } 61 | ], 62 | "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"petId\",\"type\":\"uint256\"}],\"name\":\"adopt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"adopters\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getAdopters\",\"outputs\":[{\"internalType\":\"address[16]\",\"name\":\"\",\"type\":\"address[16]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Adoption.sol\":\"Adoption\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Adoption.sol\":{\"keccak256\":\"0x33fbbcecf8cd5cf84e23c695daf5e346a64d53f7498c9d26a8f6227e5981ae7a\",\"urls\":[\"bzz-raw://052c4cd5fdc2b230e5af9b278d116c33f081f1baec8ac646ea1bafec3684c317\",\"dweb:/ipfs/QmTm8fj57gWCnbZoLKLa7e4FzyWrmWic68EKwnLG7NUGdG\"]}},\"version\":1}", 63 | "bytecode": "0x608060405234801561001057600080fd5b506102b9806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80633de4eb171461004657806343ae80d31461008c5780638588b2c5146100fa575b600080fd5b61004e61013c565b6040518082601060200280838360005b8381101561007957808201518184015260208101905061005e565b5050505090500191505060405180910390f35b6100b8600480360360208110156100a257600080fd5b81019080803590602001909291905050506101bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101266004803603602081101561011057600080fd5b81019080803590602001909291905050506101f0565b6040518082815260200191505060405180910390f35b610144610261565b60006010806020026040519081016040528092919082601080156101b3576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610169575b5050505050905090565b600081601081106101ca57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082101580156102035750600f8211155b61020c57600080fd5b336000836010811061021a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b60405180610200016040528060109060208202803883398082019150509050509056fea265627a7a723158201e5521f7bd6d2aa608035a8976d7740589d869c8deaab4daf36b372a80b1204c64736f6c63430005100032", 64 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80633de4eb171461004657806343ae80d31461008c5780638588b2c5146100fa575b600080fd5b61004e61013c565b6040518082601060200280838360005b8381101561007957808201518184015260208101905061005e565b5050505090500191505060405180910390f35b6100b8600480360360208110156100a257600080fd5b81019080803590602001909291905050506101bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101266004803603602081101561011057600080fd5b81019080803590602001909291905050506101f0565b6040518082815260200191505060405180910390f35b610144610261565b60006010806020026040519081016040528092919082601080156101b3576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610169575b5050505050905090565b600081601081106101ca57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082101580156102035750600f8211155b61020c57600080fd5b336000836010811061021a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b60405180610200016040528060109060208202803883398082019150509050509056fea265627a7a723158201e5521f7bd6d2aa608035a8976d7740589d869c8deaab4daf36b372a80b1204c64736f6c63430005100032", 65 | "sourceMap": "27:397:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27:397:0;;;;;;;", 66 | "deployedSourceMap": "27:397:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27:397:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;321:98;;;:::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;321:98:0;;;;;;;;;;;;;;;;54:27;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;54:27:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;113:168;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;113:168:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;321:98;365:18;;:::i;:::-;403:8;396:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;321:98;:::o;54:27::-;;;;;;;;;;;;;;;;;;;;;;;:::o;113:168::-;156:4;190:1;181:5;:10;;:25;;;;;204:2;195:5;:11;;181:25;173:34;;;;;;238:10;220:8;229:5;220:15;;;;;;;;;:28;;;;;;;;;;;;;;;;;;268:5;261:12;;113:168;;;:::o;27:397::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;27:397:0;;;;:::o", 67 | "source": "pragma solidity ^0.5.0;\r\n\r\ncontract Adoption {\r\n\r\n address[16] public adopters;\r\n\r\n // Adopting a pet\r\n function adopt(uint petId) public returns (uint) {\r\n require(petId >= 0 && petId <= 15);\r\n\r\n adopters[petId] = msg.sender;\r\n\r\n return petId;\r\n }\r\n\r\n // Retrieving the adopters\r\n function getAdopters() public view returns (address[16] memory) {\r\n return adopters;\r\n }\r\n\r\n}", 68 | "sourcePath": "C:\\Users\\cassi\\teste\\dio-blockchain-for-devs\\contracts\\Adoption.sol", 69 | "ast": { 70 | "absolutePath": "project:/contracts/Adoption.sol", 71 | "exportedSymbols": { 72 | "Adoption": [ 73 | 43 74 | ] 75 | }, 76 | "id": 44, 77 | "nodeType": "SourceUnit", 78 | "nodes": [ 79 | { 80 | "id": 1, 81 | "literals": [ 82 | "solidity", 83 | "^", 84 | "0.5", 85 | ".0" 86 | ], 87 | "nodeType": "PragmaDirective", 88 | "src": "0:23:0" 89 | }, 90 | { 91 | "baseContracts": [], 92 | "contractDependencies": [], 93 | "contractKind": "contract", 94 | "documentation": null, 95 | "fullyImplemented": true, 96 | "id": 43, 97 | "linearizedBaseContracts": [ 98 | 43 99 | ], 100 | "name": "Adoption", 101 | "nodeType": "ContractDefinition", 102 | "nodes": [ 103 | { 104 | "constant": false, 105 | "id": 5, 106 | "name": "adopters", 107 | "nodeType": "VariableDeclaration", 108 | "scope": 43, 109 | "src": "54:27:0", 110 | "stateVariable": true, 111 | "storageLocation": "default", 112 | "typeDescriptions": { 113 | "typeIdentifier": "t_array$_t_address_$16_storage", 114 | "typeString": "address[16]" 115 | }, 116 | "typeName": { 117 | "baseType": { 118 | "id": 2, 119 | "name": "address", 120 | "nodeType": "ElementaryTypeName", 121 | "src": "54:7:0", 122 | "stateMutability": "nonpayable", 123 | "typeDescriptions": { 124 | "typeIdentifier": "t_address", 125 | "typeString": "address" 126 | } 127 | }, 128 | "id": 4, 129 | "length": { 130 | "argumentTypes": null, 131 | "hexValue": "3136", 132 | "id": 3, 133 | "isConstant": false, 134 | "isLValue": false, 135 | "isPure": true, 136 | "kind": "number", 137 | "lValueRequested": false, 138 | "nodeType": "Literal", 139 | "src": "62:2:0", 140 | "subdenomination": null, 141 | "typeDescriptions": { 142 | "typeIdentifier": "t_rational_16_by_1", 143 | "typeString": "int_const 16" 144 | }, 145 | "value": "16" 146 | }, 147 | "nodeType": "ArrayTypeName", 148 | "src": "54:11:0", 149 | "typeDescriptions": { 150 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 151 | "typeString": "address[16]" 152 | } 153 | }, 154 | "value": null, 155 | "visibility": "public" 156 | }, 157 | { 158 | "body": { 159 | "id": 31, 160 | "nodeType": "Block", 161 | "src": "162:119:0", 162 | "statements": [ 163 | { 164 | "expression": { 165 | "argumentTypes": null, 166 | "arguments": [ 167 | { 168 | "argumentTypes": null, 169 | "commonType": { 170 | "typeIdentifier": "t_bool", 171 | "typeString": "bool" 172 | }, 173 | "id": 19, 174 | "isConstant": false, 175 | "isLValue": false, 176 | "isPure": false, 177 | "lValueRequested": false, 178 | "leftExpression": { 179 | "argumentTypes": null, 180 | "commonType": { 181 | "typeIdentifier": "t_uint256", 182 | "typeString": "uint256" 183 | }, 184 | "id": 15, 185 | "isConstant": false, 186 | "isLValue": false, 187 | "isPure": false, 188 | "lValueRequested": false, 189 | "leftExpression": { 190 | "argumentTypes": null, 191 | "id": 13, 192 | "name": "petId", 193 | "nodeType": "Identifier", 194 | "overloadedDeclarations": [], 195 | "referencedDeclaration": 7, 196 | "src": "181:5:0", 197 | "typeDescriptions": { 198 | "typeIdentifier": "t_uint256", 199 | "typeString": "uint256" 200 | } 201 | }, 202 | "nodeType": "BinaryOperation", 203 | "operator": ">=", 204 | "rightExpression": { 205 | "argumentTypes": null, 206 | "hexValue": "30", 207 | "id": 14, 208 | "isConstant": false, 209 | "isLValue": false, 210 | "isPure": true, 211 | "kind": "number", 212 | "lValueRequested": false, 213 | "nodeType": "Literal", 214 | "src": "190:1:0", 215 | "subdenomination": null, 216 | "typeDescriptions": { 217 | "typeIdentifier": "t_rational_0_by_1", 218 | "typeString": "int_const 0" 219 | }, 220 | "value": "0" 221 | }, 222 | "src": "181:10:0", 223 | "typeDescriptions": { 224 | "typeIdentifier": "t_bool", 225 | "typeString": "bool" 226 | } 227 | }, 228 | "nodeType": "BinaryOperation", 229 | "operator": "&&", 230 | "rightExpression": { 231 | "argumentTypes": null, 232 | "commonType": { 233 | "typeIdentifier": "t_uint256", 234 | "typeString": "uint256" 235 | }, 236 | "id": 18, 237 | "isConstant": false, 238 | "isLValue": false, 239 | "isPure": false, 240 | "lValueRequested": false, 241 | "leftExpression": { 242 | "argumentTypes": null, 243 | "id": 16, 244 | "name": "petId", 245 | "nodeType": "Identifier", 246 | "overloadedDeclarations": [], 247 | "referencedDeclaration": 7, 248 | "src": "195:5:0", 249 | "typeDescriptions": { 250 | "typeIdentifier": "t_uint256", 251 | "typeString": "uint256" 252 | } 253 | }, 254 | "nodeType": "BinaryOperation", 255 | "operator": "<=", 256 | "rightExpression": { 257 | "argumentTypes": null, 258 | "hexValue": "3135", 259 | "id": 17, 260 | "isConstant": false, 261 | "isLValue": false, 262 | "isPure": true, 263 | "kind": "number", 264 | "lValueRequested": false, 265 | "nodeType": "Literal", 266 | "src": "204:2:0", 267 | "subdenomination": null, 268 | "typeDescriptions": { 269 | "typeIdentifier": "t_rational_15_by_1", 270 | "typeString": "int_const 15" 271 | }, 272 | "value": "15" 273 | }, 274 | "src": "195:11:0", 275 | "typeDescriptions": { 276 | "typeIdentifier": "t_bool", 277 | "typeString": "bool" 278 | } 279 | }, 280 | "src": "181:25:0", 281 | "typeDescriptions": { 282 | "typeIdentifier": "t_bool", 283 | "typeString": "bool" 284 | } 285 | } 286 | ], 287 | "expression": { 288 | "argumentTypes": [ 289 | { 290 | "typeIdentifier": "t_bool", 291 | "typeString": "bool" 292 | } 293 | ], 294 | "id": 12, 295 | "name": "require", 296 | "nodeType": "Identifier", 297 | "overloadedDeclarations": [ 298 | 94, 299 | 95 300 | ], 301 | "referencedDeclaration": 94, 302 | "src": "173:7:0", 303 | "typeDescriptions": { 304 | "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", 305 | "typeString": "function (bool) pure" 306 | } 307 | }, 308 | "id": 20, 309 | "isConstant": false, 310 | "isLValue": false, 311 | "isPure": false, 312 | "kind": "functionCall", 313 | "lValueRequested": false, 314 | "names": [], 315 | "nodeType": "FunctionCall", 316 | "src": "173:34:0", 317 | "typeDescriptions": { 318 | "typeIdentifier": "t_tuple$__$", 319 | "typeString": "tuple()" 320 | } 321 | }, 322 | "id": 21, 323 | "nodeType": "ExpressionStatement", 324 | "src": "173:34:0" 325 | }, 326 | { 327 | "expression": { 328 | "argumentTypes": null, 329 | "id": 27, 330 | "isConstant": false, 331 | "isLValue": false, 332 | "isPure": false, 333 | "lValueRequested": false, 334 | "leftHandSide": { 335 | "argumentTypes": null, 336 | "baseExpression": { 337 | "argumentTypes": null, 338 | "id": 22, 339 | "name": "adopters", 340 | "nodeType": "Identifier", 341 | "overloadedDeclarations": [], 342 | "referencedDeclaration": 5, 343 | "src": "220:8:0", 344 | "typeDescriptions": { 345 | "typeIdentifier": "t_array$_t_address_$16_storage", 346 | "typeString": "address[16] storage ref" 347 | } 348 | }, 349 | "id": 24, 350 | "indexExpression": { 351 | "argumentTypes": null, 352 | "id": 23, 353 | "name": "petId", 354 | "nodeType": "Identifier", 355 | "overloadedDeclarations": [], 356 | "referencedDeclaration": 7, 357 | "src": "229:5:0", 358 | "typeDescriptions": { 359 | "typeIdentifier": "t_uint256", 360 | "typeString": "uint256" 361 | } 362 | }, 363 | "isConstant": false, 364 | "isLValue": true, 365 | "isPure": false, 366 | "lValueRequested": true, 367 | "nodeType": "IndexAccess", 368 | "src": "220:15:0", 369 | "typeDescriptions": { 370 | "typeIdentifier": "t_address", 371 | "typeString": "address" 372 | } 373 | }, 374 | "nodeType": "Assignment", 375 | "operator": "=", 376 | "rightHandSide": { 377 | "argumentTypes": null, 378 | "expression": { 379 | "argumentTypes": null, 380 | "id": 25, 381 | "name": "msg", 382 | "nodeType": "Identifier", 383 | "overloadedDeclarations": [], 384 | "referencedDeclaration": 91, 385 | "src": "238:3:0", 386 | "typeDescriptions": { 387 | "typeIdentifier": "t_magic_message", 388 | "typeString": "msg" 389 | } 390 | }, 391 | "id": 26, 392 | "isConstant": false, 393 | "isLValue": false, 394 | "isPure": false, 395 | "lValueRequested": false, 396 | "memberName": "sender", 397 | "nodeType": "MemberAccess", 398 | "referencedDeclaration": null, 399 | "src": "238:10:0", 400 | "typeDescriptions": { 401 | "typeIdentifier": "t_address_payable", 402 | "typeString": "address payable" 403 | } 404 | }, 405 | "src": "220:28:0", 406 | "typeDescriptions": { 407 | "typeIdentifier": "t_address", 408 | "typeString": "address" 409 | } 410 | }, 411 | "id": 28, 412 | "nodeType": "ExpressionStatement", 413 | "src": "220:28:0" 414 | }, 415 | { 416 | "expression": { 417 | "argumentTypes": null, 418 | "id": 29, 419 | "name": "petId", 420 | "nodeType": "Identifier", 421 | "overloadedDeclarations": [], 422 | "referencedDeclaration": 7, 423 | "src": "268:5:0", 424 | "typeDescriptions": { 425 | "typeIdentifier": "t_uint256", 426 | "typeString": "uint256" 427 | } 428 | }, 429 | "functionReturnParameters": 11, 430 | "id": 30, 431 | "nodeType": "Return", 432 | "src": "261:12:0" 433 | } 434 | ] 435 | }, 436 | "documentation": null, 437 | "id": 32, 438 | "implemented": true, 439 | "kind": "function", 440 | "modifiers": [], 441 | "name": "adopt", 442 | "nodeType": "FunctionDefinition", 443 | "parameters": { 444 | "id": 8, 445 | "nodeType": "ParameterList", 446 | "parameters": [ 447 | { 448 | "constant": false, 449 | "id": 7, 450 | "name": "petId", 451 | "nodeType": "VariableDeclaration", 452 | "scope": 32, 453 | "src": "128:10:0", 454 | "stateVariable": false, 455 | "storageLocation": "default", 456 | "typeDescriptions": { 457 | "typeIdentifier": "t_uint256", 458 | "typeString": "uint256" 459 | }, 460 | "typeName": { 461 | "id": 6, 462 | "name": "uint", 463 | "nodeType": "ElementaryTypeName", 464 | "src": "128:4:0", 465 | "typeDescriptions": { 466 | "typeIdentifier": "t_uint256", 467 | "typeString": "uint256" 468 | } 469 | }, 470 | "value": null, 471 | "visibility": "internal" 472 | } 473 | ], 474 | "src": "127:12:0" 475 | }, 476 | "returnParameters": { 477 | "id": 11, 478 | "nodeType": "ParameterList", 479 | "parameters": [ 480 | { 481 | "constant": false, 482 | "id": 10, 483 | "name": "", 484 | "nodeType": "VariableDeclaration", 485 | "scope": 32, 486 | "src": "156:4:0", 487 | "stateVariable": false, 488 | "storageLocation": "default", 489 | "typeDescriptions": { 490 | "typeIdentifier": "t_uint256", 491 | "typeString": "uint256" 492 | }, 493 | "typeName": { 494 | "id": 9, 495 | "name": "uint", 496 | "nodeType": "ElementaryTypeName", 497 | "src": "156:4:0", 498 | "typeDescriptions": { 499 | "typeIdentifier": "t_uint256", 500 | "typeString": "uint256" 501 | } 502 | }, 503 | "value": null, 504 | "visibility": "internal" 505 | } 506 | ], 507 | "src": "155:6:0" 508 | }, 509 | "scope": 43, 510 | "src": "113:168:0", 511 | "stateMutability": "nonpayable", 512 | "superFunction": null, 513 | "visibility": "public" 514 | }, 515 | { 516 | "body": { 517 | "id": 41, 518 | "nodeType": "Block", 519 | "src": "385:34:0", 520 | "statements": [ 521 | { 522 | "expression": { 523 | "argumentTypes": null, 524 | "id": 39, 525 | "name": "adopters", 526 | "nodeType": "Identifier", 527 | "overloadedDeclarations": [], 528 | "referencedDeclaration": 5, 529 | "src": "403:8:0", 530 | "typeDescriptions": { 531 | "typeIdentifier": "t_array$_t_address_$16_storage", 532 | "typeString": "address[16] storage ref" 533 | } 534 | }, 535 | "functionReturnParameters": 38, 536 | "id": 40, 537 | "nodeType": "Return", 538 | "src": "396:15:0" 539 | } 540 | ] 541 | }, 542 | "documentation": null, 543 | "id": 42, 544 | "implemented": true, 545 | "kind": "function", 546 | "modifiers": [], 547 | "name": "getAdopters", 548 | "nodeType": "FunctionDefinition", 549 | "parameters": { 550 | "id": 33, 551 | "nodeType": "ParameterList", 552 | "parameters": [], 553 | "src": "341:2:0" 554 | }, 555 | "returnParameters": { 556 | "id": 38, 557 | "nodeType": "ParameterList", 558 | "parameters": [ 559 | { 560 | "constant": false, 561 | "id": 37, 562 | "name": "", 563 | "nodeType": "VariableDeclaration", 564 | "scope": 42, 565 | "src": "365:18:0", 566 | "stateVariable": false, 567 | "storageLocation": "memory", 568 | "typeDescriptions": { 569 | "typeIdentifier": "t_array$_t_address_$16_memory_ptr", 570 | "typeString": "address[16]" 571 | }, 572 | "typeName": { 573 | "baseType": { 574 | "id": 34, 575 | "name": "address", 576 | "nodeType": "ElementaryTypeName", 577 | "src": "365:7:0", 578 | "stateMutability": "nonpayable", 579 | "typeDescriptions": { 580 | "typeIdentifier": "t_address", 581 | "typeString": "address" 582 | } 583 | }, 584 | "id": 36, 585 | "length": { 586 | "argumentTypes": null, 587 | "hexValue": "3136", 588 | "id": 35, 589 | "isConstant": false, 590 | "isLValue": false, 591 | "isPure": true, 592 | "kind": "number", 593 | "lValueRequested": false, 594 | "nodeType": "Literal", 595 | "src": "373:2:0", 596 | "subdenomination": null, 597 | "typeDescriptions": { 598 | "typeIdentifier": "t_rational_16_by_1", 599 | "typeString": "int_const 16" 600 | }, 601 | "value": "16" 602 | }, 603 | "nodeType": "ArrayTypeName", 604 | "src": "365:11:0", 605 | "typeDescriptions": { 606 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 607 | "typeString": "address[16]" 608 | } 609 | }, 610 | "value": null, 611 | "visibility": "internal" 612 | } 613 | ], 614 | "src": "364:20:0" 615 | }, 616 | "scope": 43, 617 | "src": "321:98:0", 618 | "stateMutability": "view", 619 | "superFunction": null, 620 | "visibility": "public" 621 | } 622 | ], 623 | "scope": 44, 624 | "src": "27:397:0" 625 | } 626 | ], 627 | "src": "0:424:0" 628 | }, 629 | "legacyAST": { 630 | "attributes": { 631 | "absolutePath": "project:/contracts/Adoption.sol", 632 | "exportedSymbols": { 633 | "Adoption": [ 634 | 43 635 | ] 636 | } 637 | }, 638 | "children": [ 639 | { 640 | "attributes": { 641 | "literals": [ 642 | "solidity", 643 | "^", 644 | "0.5", 645 | ".0" 646 | ] 647 | }, 648 | "id": 1, 649 | "name": "PragmaDirective", 650 | "src": "0:23:0" 651 | }, 652 | { 653 | "attributes": { 654 | "baseContracts": [ 655 | null 656 | ], 657 | "contractDependencies": [ 658 | null 659 | ], 660 | "contractKind": "contract", 661 | "documentation": null, 662 | "fullyImplemented": true, 663 | "linearizedBaseContracts": [ 664 | 43 665 | ], 666 | "name": "Adoption", 667 | "scope": 44 668 | }, 669 | "children": [ 670 | { 671 | "attributes": { 672 | "constant": false, 673 | "name": "adopters", 674 | "scope": 43, 675 | "stateVariable": true, 676 | "storageLocation": "default", 677 | "type": "address[16]", 678 | "value": null, 679 | "visibility": "public" 680 | }, 681 | "children": [ 682 | { 683 | "attributes": { 684 | "type": "address[16]" 685 | }, 686 | "children": [ 687 | { 688 | "attributes": { 689 | "name": "address", 690 | "stateMutability": "nonpayable", 691 | "type": "address" 692 | }, 693 | "id": 2, 694 | "name": "ElementaryTypeName", 695 | "src": "54:7:0" 696 | }, 697 | { 698 | "attributes": { 699 | "argumentTypes": null, 700 | "hexvalue": "3136", 701 | "isConstant": false, 702 | "isLValue": false, 703 | "isPure": true, 704 | "lValueRequested": false, 705 | "subdenomination": null, 706 | "token": "number", 707 | "type": "int_const 16", 708 | "value": "16" 709 | }, 710 | "id": 3, 711 | "name": "Literal", 712 | "src": "62:2:0" 713 | } 714 | ], 715 | "id": 4, 716 | "name": "ArrayTypeName", 717 | "src": "54:11:0" 718 | } 719 | ], 720 | "id": 5, 721 | "name": "VariableDeclaration", 722 | "src": "54:27:0" 723 | }, 724 | { 725 | "attributes": { 726 | "documentation": null, 727 | "implemented": true, 728 | "isConstructor": false, 729 | "kind": "function", 730 | "modifiers": [ 731 | null 732 | ], 733 | "name": "adopt", 734 | "scope": 43, 735 | "stateMutability": "nonpayable", 736 | "superFunction": null, 737 | "visibility": "public" 738 | }, 739 | "children": [ 740 | { 741 | "children": [ 742 | { 743 | "attributes": { 744 | "constant": false, 745 | "name": "petId", 746 | "scope": 32, 747 | "stateVariable": false, 748 | "storageLocation": "default", 749 | "type": "uint256", 750 | "value": null, 751 | "visibility": "internal" 752 | }, 753 | "children": [ 754 | { 755 | "attributes": { 756 | "name": "uint", 757 | "type": "uint256" 758 | }, 759 | "id": 6, 760 | "name": "ElementaryTypeName", 761 | "src": "128:4:0" 762 | } 763 | ], 764 | "id": 7, 765 | "name": "VariableDeclaration", 766 | "src": "128:10:0" 767 | } 768 | ], 769 | "id": 8, 770 | "name": "ParameterList", 771 | "src": "127:12:0" 772 | }, 773 | { 774 | "children": [ 775 | { 776 | "attributes": { 777 | "constant": false, 778 | "name": "", 779 | "scope": 32, 780 | "stateVariable": false, 781 | "storageLocation": "default", 782 | "type": "uint256", 783 | "value": null, 784 | "visibility": "internal" 785 | }, 786 | "children": [ 787 | { 788 | "attributes": { 789 | "name": "uint", 790 | "type": "uint256" 791 | }, 792 | "id": 9, 793 | "name": "ElementaryTypeName", 794 | "src": "156:4:0" 795 | } 796 | ], 797 | "id": 10, 798 | "name": "VariableDeclaration", 799 | "src": "156:4:0" 800 | } 801 | ], 802 | "id": 11, 803 | "name": "ParameterList", 804 | "src": "155:6:0" 805 | }, 806 | { 807 | "children": [ 808 | { 809 | "children": [ 810 | { 811 | "attributes": { 812 | "argumentTypes": null, 813 | "isConstant": false, 814 | "isLValue": false, 815 | "isPure": false, 816 | "isStructConstructorCall": false, 817 | "lValueRequested": false, 818 | "names": [ 819 | null 820 | ], 821 | "type": "tuple()", 822 | "type_conversion": false 823 | }, 824 | "children": [ 825 | { 826 | "attributes": { 827 | "argumentTypes": [ 828 | { 829 | "typeIdentifier": "t_bool", 830 | "typeString": "bool" 831 | } 832 | ], 833 | "overloadedDeclarations": [ 834 | 94, 835 | 95 836 | ], 837 | "referencedDeclaration": 94, 838 | "type": "function (bool) pure", 839 | "value": "require" 840 | }, 841 | "id": 12, 842 | "name": "Identifier", 843 | "src": "173:7:0" 844 | }, 845 | { 846 | "attributes": { 847 | "argumentTypes": null, 848 | "commonType": { 849 | "typeIdentifier": "t_bool", 850 | "typeString": "bool" 851 | }, 852 | "isConstant": false, 853 | "isLValue": false, 854 | "isPure": false, 855 | "lValueRequested": false, 856 | "operator": "&&", 857 | "type": "bool" 858 | }, 859 | "children": [ 860 | { 861 | "attributes": { 862 | "argumentTypes": null, 863 | "commonType": { 864 | "typeIdentifier": "t_uint256", 865 | "typeString": "uint256" 866 | }, 867 | "isConstant": false, 868 | "isLValue": false, 869 | "isPure": false, 870 | "lValueRequested": false, 871 | "operator": ">=", 872 | "type": "bool" 873 | }, 874 | "children": [ 875 | { 876 | "attributes": { 877 | "argumentTypes": null, 878 | "overloadedDeclarations": [ 879 | null 880 | ], 881 | "referencedDeclaration": 7, 882 | "type": "uint256", 883 | "value": "petId" 884 | }, 885 | "id": 13, 886 | "name": "Identifier", 887 | "src": "181:5:0" 888 | }, 889 | { 890 | "attributes": { 891 | "argumentTypes": null, 892 | "hexvalue": "30", 893 | "isConstant": false, 894 | "isLValue": false, 895 | "isPure": true, 896 | "lValueRequested": false, 897 | "subdenomination": null, 898 | "token": "number", 899 | "type": "int_const 0", 900 | "value": "0" 901 | }, 902 | "id": 14, 903 | "name": "Literal", 904 | "src": "190:1:0" 905 | } 906 | ], 907 | "id": 15, 908 | "name": "BinaryOperation", 909 | "src": "181:10:0" 910 | }, 911 | { 912 | "attributes": { 913 | "argumentTypes": null, 914 | "commonType": { 915 | "typeIdentifier": "t_uint256", 916 | "typeString": "uint256" 917 | }, 918 | "isConstant": false, 919 | "isLValue": false, 920 | "isPure": false, 921 | "lValueRequested": false, 922 | "operator": "<=", 923 | "type": "bool" 924 | }, 925 | "children": [ 926 | { 927 | "attributes": { 928 | "argumentTypes": null, 929 | "overloadedDeclarations": [ 930 | null 931 | ], 932 | "referencedDeclaration": 7, 933 | "type": "uint256", 934 | "value": "petId" 935 | }, 936 | "id": 16, 937 | "name": "Identifier", 938 | "src": "195:5:0" 939 | }, 940 | { 941 | "attributes": { 942 | "argumentTypes": null, 943 | "hexvalue": "3135", 944 | "isConstant": false, 945 | "isLValue": false, 946 | "isPure": true, 947 | "lValueRequested": false, 948 | "subdenomination": null, 949 | "token": "number", 950 | "type": "int_const 15", 951 | "value": "15" 952 | }, 953 | "id": 17, 954 | "name": "Literal", 955 | "src": "204:2:0" 956 | } 957 | ], 958 | "id": 18, 959 | "name": "BinaryOperation", 960 | "src": "195:11:0" 961 | } 962 | ], 963 | "id": 19, 964 | "name": "BinaryOperation", 965 | "src": "181:25:0" 966 | } 967 | ], 968 | "id": 20, 969 | "name": "FunctionCall", 970 | "src": "173:34:0" 971 | } 972 | ], 973 | "id": 21, 974 | "name": "ExpressionStatement", 975 | "src": "173:34:0" 976 | }, 977 | { 978 | "children": [ 979 | { 980 | "attributes": { 981 | "argumentTypes": null, 982 | "isConstant": false, 983 | "isLValue": false, 984 | "isPure": false, 985 | "lValueRequested": false, 986 | "operator": "=", 987 | "type": "address" 988 | }, 989 | "children": [ 990 | { 991 | "attributes": { 992 | "argumentTypes": null, 993 | "isConstant": false, 994 | "isLValue": true, 995 | "isPure": false, 996 | "lValueRequested": true, 997 | "type": "address" 998 | }, 999 | "children": [ 1000 | { 1001 | "attributes": { 1002 | "argumentTypes": null, 1003 | "overloadedDeclarations": [ 1004 | null 1005 | ], 1006 | "referencedDeclaration": 5, 1007 | "type": "address[16] storage ref", 1008 | "value": "adopters" 1009 | }, 1010 | "id": 22, 1011 | "name": "Identifier", 1012 | "src": "220:8:0" 1013 | }, 1014 | { 1015 | "attributes": { 1016 | "argumentTypes": null, 1017 | "overloadedDeclarations": [ 1018 | null 1019 | ], 1020 | "referencedDeclaration": 7, 1021 | "type": "uint256", 1022 | "value": "petId" 1023 | }, 1024 | "id": 23, 1025 | "name": "Identifier", 1026 | "src": "229:5:0" 1027 | } 1028 | ], 1029 | "id": 24, 1030 | "name": "IndexAccess", 1031 | "src": "220:15:0" 1032 | }, 1033 | { 1034 | "attributes": { 1035 | "argumentTypes": null, 1036 | "isConstant": false, 1037 | "isLValue": false, 1038 | "isPure": false, 1039 | "lValueRequested": false, 1040 | "member_name": "sender", 1041 | "referencedDeclaration": null, 1042 | "type": "address payable" 1043 | }, 1044 | "children": [ 1045 | { 1046 | "attributes": { 1047 | "argumentTypes": null, 1048 | "overloadedDeclarations": [ 1049 | null 1050 | ], 1051 | "referencedDeclaration": 91, 1052 | "type": "msg", 1053 | "value": "msg" 1054 | }, 1055 | "id": 25, 1056 | "name": "Identifier", 1057 | "src": "238:3:0" 1058 | } 1059 | ], 1060 | "id": 26, 1061 | "name": "MemberAccess", 1062 | "src": "238:10:0" 1063 | } 1064 | ], 1065 | "id": 27, 1066 | "name": "Assignment", 1067 | "src": "220:28:0" 1068 | } 1069 | ], 1070 | "id": 28, 1071 | "name": "ExpressionStatement", 1072 | "src": "220:28:0" 1073 | }, 1074 | { 1075 | "attributes": { 1076 | "functionReturnParameters": 11 1077 | }, 1078 | "children": [ 1079 | { 1080 | "attributes": { 1081 | "argumentTypes": null, 1082 | "overloadedDeclarations": [ 1083 | null 1084 | ], 1085 | "referencedDeclaration": 7, 1086 | "type": "uint256", 1087 | "value": "petId" 1088 | }, 1089 | "id": 29, 1090 | "name": "Identifier", 1091 | "src": "268:5:0" 1092 | } 1093 | ], 1094 | "id": 30, 1095 | "name": "Return", 1096 | "src": "261:12:0" 1097 | } 1098 | ], 1099 | "id": 31, 1100 | "name": "Block", 1101 | "src": "162:119:0" 1102 | } 1103 | ], 1104 | "id": 32, 1105 | "name": "FunctionDefinition", 1106 | "src": "113:168:0" 1107 | }, 1108 | { 1109 | "attributes": { 1110 | "documentation": null, 1111 | "implemented": true, 1112 | "isConstructor": false, 1113 | "kind": "function", 1114 | "modifiers": [ 1115 | null 1116 | ], 1117 | "name": "getAdopters", 1118 | "scope": 43, 1119 | "stateMutability": "view", 1120 | "superFunction": null, 1121 | "visibility": "public" 1122 | }, 1123 | "children": [ 1124 | { 1125 | "attributes": { 1126 | "parameters": [ 1127 | null 1128 | ] 1129 | }, 1130 | "children": [], 1131 | "id": 33, 1132 | "name": "ParameterList", 1133 | "src": "341:2:0" 1134 | }, 1135 | { 1136 | "children": [ 1137 | { 1138 | "attributes": { 1139 | "constant": false, 1140 | "name": "", 1141 | "scope": 42, 1142 | "stateVariable": false, 1143 | "storageLocation": "memory", 1144 | "type": "address[16]", 1145 | "value": null, 1146 | "visibility": "internal" 1147 | }, 1148 | "children": [ 1149 | { 1150 | "attributes": { 1151 | "type": "address[16]" 1152 | }, 1153 | "children": [ 1154 | { 1155 | "attributes": { 1156 | "name": "address", 1157 | "stateMutability": "nonpayable", 1158 | "type": "address" 1159 | }, 1160 | "id": 34, 1161 | "name": "ElementaryTypeName", 1162 | "src": "365:7:0" 1163 | }, 1164 | { 1165 | "attributes": { 1166 | "argumentTypes": null, 1167 | "hexvalue": "3136", 1168 | "isConstant": false, 1169 | "isLValue": false, 1170 | "isPure": true, 1171 | "lValueRequested": false, 1172 | "subdenomination": null, 1173 | "token": "number", 1174 | "type": "int_const 16", 1175 | "value": "16" 1176 | }, 1177 | "id": 35, 1178 | "name": "Literal", 1179 | "src": "373:2:0" 1180 | } 1181 | ], 1182 | "id": 36, 1183 | "name": "ArrayTypeName", 1184 | "src": "365:11:0" 1185 | } 1186 | ], 1187 | "id": 37, 1188 | "name": "VariableDeclaration", 1189 | "src": "365:18:0" 1190 | } 1191 | ], 1192 | "id": 38, 1193 | "name": "ParameterList", 1194 | "src": "364:20:0" 1195 | }, 1196 | { 1197 | "children": [ 1198 | { 1199 | "attributes": { 1200 | "functionReturnParameters": 38 1201 | }, 1202 | "children": [ 1203 | { 1204 | "attributes": { 1205 | "argumentTypes": null, 1206 | "overloadedDeclarations": [ 1207 | null 1208 | ], 1209 | "referencedDeclaration": 5, 1210 | "type": "address[16] storage ref", 1211 | "value": "adopters" 1212 | }, 1213 | "id": 39, 1214 | "name": "Identifier", 1215 | "src": "403:8:0" 1216 | } 1217 | ], 1218 | "id": 40, 1219 | "name": "Return", 1220 | "src": "396:15:0" 1221 | } 1222 | ], 1223 | "id": 41, 1224 | "name": "Block", 1225 | "src": "385:34:0" 1226 | } 1227 | ], 1228 | "id": 42, 1229 | "name": "FunctionDefinition", 1230 | "src": "321:98:0" 1231 | } 1232 | ], 1233 | "id": 43, 1234 | "name": "ContractDefinition", 1235 | "src": "27:397:0" 1236 | } 1237 | ], 1238 | "id": 44, 1239 | "name": "SourceUnit", 1240 | "src": "0:424:0" 1241 | }, 1242 | "compiler": { 1243 | "name": "solc", 1244 | "version": "0.5.16+commit.9c3226ce.Emscripten.clang" 1245 | }, 1246 | "networks": { 1247 | "5777": { 1248 | "events": {}, 1249 | "links": {}, 1250 | "address": "0xb7d1881d8165ca9fdd9803e37aa934D377F2ca46", 1251 | "transactionHash": "0xf06f7c3d8b64148d264d253541c364d1b5dfbae9b37ee37857fb7560c1b3d623" 1252 | } 1253 | }, 1254 | "schemaVersion": "3.4.8", 1255 | "updatedAt": "2022-07-26T00:38:41.779Z", 1256 | "networkType": "ethereum", 1257 | "devdoc": { 1258 | "methods": {} 1259 | }, 1260 | "userdoc": { 1261 | "methods": {} 1262 | } 1263 | } -------------------------------------------------------------------------------- /build/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "last_completed_migration", 8 | "outputs": [ 9 | { 10 | "internalType": "uint256", 11 | "name": "", 12 | "type": "uint256" 13 | } 14 | ], 15 | "payable": false, 16 | "stateMutability": "view", 17 | "type": "function" 18 | }, 19 | { 20 | "constant": true, 21 | "inputs": [], 22 | "name": "owner", 23 | "outputs": [ 24 | { 25 | "internalType": "address", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "payable": false, 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "constant": false, 36 | "inputs": [ 37 | { 38 | "internalType": "uint256", 39 | "name": "completed", 40 | "type": "uint256" 41 | } 42 | ], 43 | "name": "setCompleted", 44 | "outputs": [], 45 | "payable": false, 46 | "stateMutability": "nonpayable", 47 | "type": "function" 48 | } 49 | ], 50 | "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":\"0x67ad278ea9cefc7b6b87c73f137231d7c0a8a106c81099dbb4d445bde16b0d4a\",\"urls\":[\"bzz-raw://6d525f2aee0cf8d841d2ea0e1f4fb085521f6bec9a8004204755101d69ac9928\",\"dweb:/ipfs/QmeoyfFJPN3vtxDKFAEvHzj5HuCZsLm7qmX4ZPif9ccctW\"]}},\"version\":1}", 51 | "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b5061021e806100606000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd576146100ae575b600080fd5b61004e6100dc565b6040518082815260200191505060405180910390f35b61006c6100e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610107565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806101b76033913960400191505060405180910390fd5b806001819055505056fe546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572a265627a7a72315820f2927c229bc5df6f89364c279b6dc85262f84d7199929230bdb54a692560349064736f6c63430005100032", 52 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd576146100ae575b600080fd5b61004e6100dc565b6040518082815260200191505060405180910390f35b61006c6100e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610107565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806101b76033913960400191505060405180910390fd5b806001819055505056fe546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572a265627a7a72315820f2927c229bc5df6f89364c279b6dc85262f84d7199929230bdb54a692560349064736f6c63430005100032", 53 | "sourceMap": "69:367:1:-;;;117:10;94:33;;;;;;;;;;;;;;;;;;;;69:367;8:9:-1;5:2;;;30:1;27;20:12;5:2;69:367:1;;;;;;;", 54 | "deployedSourceMap": "69:367:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;69:367:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;132:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;94:33;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;328:105;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;328:105:1;;;;;;;;;;;;;;;;;:::i;:::-;;132:36;;;;:::o;94:33::-;;;;;;;;;;;;;:::o;328:105::-;234:5;;;;;;;;;;;220:19;;:10;:19;;;204:104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;418:9;391:24;:36;;;;328:105;:::o", 55 | "source": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.22 <0.8.0;\r\n\r\ncontract Migrations {\r\n address public owner = msg.sender;\r\n uint public last_completed_migration;\r\n\r\n modifier restricted() {\r\n require(\r\n msg.sender == owner,\r\n \"This function is restricted to the contract's owner\"\r\n );\r\n _;\r\n }\r\n\r\n function setCompleted(uint completed) public restricted {\r\n last_completed_migration = completed;\r\n }\r\n}\r\n", 56 | "sourcePath": "C:\\Users\\cassi\\teste\\dio-blockchain-for-devs\\contracts\\Migrations.sol", 57 | "ast": { 58 | "absolutePath": "project:/contracts/Migrations.sol", 59 | "exportedSymbols": { 60 | "Migrations": [ 61 | 76 62 | ] 63 | }, 64 | "id": 77, 65 | "nodeType": "SourceUnit", 66 | "nodes": [ 67 | { 68 | "id": 45, 69 | "literals": [ 70 | "solidity", 71 | ">=", 72 | "0.4", 73 | ".22", 74 | "<", 75 | "0.8", 76 | ".0" 77 | ], 78 | "nodeType": "PragmaDirective", 79 | "src": "33:32:1" 80 | }, 81 | { 82 | "baseContracts": [], 83 | "contractDependencies": [], 84 | "contractKind": "contract", 85 | "documentation": null, 86 | "fullyImplemented": true, 87 | "id": 76, 88 | "linearizedBaseContracts": [ 89 | 76 90 | ], 91 | "name": "Migrations", 92 | "nodeType": "ContractDefinition", 93 | "nodes": [ 94 | { 95 | "constant": false, 96 | "id": 49, 97 | "name": "owner", 98 | "nodeType": "VariableDeclaration", 99 | "scope": 76, 100 | "src": "94:33:1", 101 | "stateVariable": true, 102 | "storageLocation": "default", 103 | "typeDescriptions": { 104 | "typeIdentifier": "t_address", 105 | "typeString": "address" 106 | }, 107 | "typeName": { 108 | "id": 46, 109 | "name": "address", 110 | "nodeType": "ElementaryTypeName", 111 | "src": "94:7:1", 112 | "stateMutability": "nonpayable", 113 | "typeDescriptions": { 114 | "typeIdentifier": "t_address", 115 | "typeString": "address" 116 | } 117 | }, 118 | "value": { 119 | "argumentTypes": null, 120 | "expression": { 121 | "argumentTypes": null, 122 | "id": 47, 123 | "name": "msg", 124 | "nodeType": "Identifier", 125 | "overloadedDeclarations": [], 126 | "referencedDeclaration": 91, 127 | "src": "117:3:1", 128 | "typeDescriptions": { 129 | "typeIdentifier": "t_magic_message", 130 | "typeString": "msg" 131 | } 132 | }, 133 | "id": 48, 134 | "isConstant": false, 135 | "isLValue": false, 136 | "isPure": false, 137 | "lValueRequested": false, 138 | "memberName": "sender", 139 | "nodeType": "MemberAccess", 140 | "referencedDeclaration": null, 141 | "src": "117:10:1", 142 | "typeDescriptions": { 143 | "typeIdentifier": "t_address_payable", 144 | "typeString": "address payable" 145 | } 146 | }, 147 | "visibility": "public" 148 | }, 149 | { 150 | "constant": false, 151 | "id": 51, 152 | "name": "last_completed_migration", 153 | "nodeType": "VariableDeclaration", 154 | "scope": 76, 155 | "src": "132:36:1", 156 | "stateVariable": true, 157 | "storageLocation": "default", 158 | "typeDescriptions": { 159 | "typeIdentifier": "t_uint256", 160 | "typeString": "uint256" 161 | }, 162 | "typeName": { 163 | "id": 50, 164 | "name": "uint", 165 | "nodeType": "ElementaryTypeName", 166 | "src": "132:4:1", 167 | "typeDescriptions": { 168 | "typeIdentifier": "t_uint256", 169 | "typeString": "uint256" 170 | } 171 | }, 172 | "value": null, 173 | "visibility": "public" 174 | }, 175 | { 176 | "body": { 177 | "id": 62, 178 | "nodeType": "Block", 179 | "src": "197:125:1", 180 | "statements": [ 181 | { 182 | "expression": { 183 | "argumentTypes": null, 184 | "arguments": [ 185 | { 186 | "argumentTypes": null, 187 | "commonType": { 188 | "typeIdentifier": "t_address", 189 | "typeString": "address" 190 | }, 191 | "id": 57, 192 | "isConstant": false, 193 | "isLValue": false, 194 | "isPure": false, 195 | "lValueRequested": false, 196 | "leftExpression": { 197 | "argumentTypes": null, 198 | "expression": { 199 | "argumentTypes": null, 200 | "id": 54, 201 | "name": "msg", 202 | "nodeType": "Identifier", 203 | "overloadedDeclarations": [], 204 | "referencedDeclaration": 91, 205 | "src": "220:3:1", 206 | "typeDescriptions": { 207 | "typeIdentifier": "t_magic_message", 208 | "typeString": "msg" 209 | } 210 | }, 211 | "id": 55, 212 | "isConstant": false, 213 | "isLValue": false, 214 | "isPure": false, 215 | "lValueRequested": false, 216 | "memberName": "sender", 217 | "nodeType": "MemberAccess", 218 | "referencedDeclaration": null, 219 | "src": "220:10:1", 220 | "typeDescriptions": { 221 | "typeIdentifier": "t_address_payable", 222 | "typeString": "address payable" 223 | } 224 | }, 225 | "nodeType": "BinaryOperation", 226 | "operator": "==", 227 | "rightExpression": { 228 | "argumentTypes": null, 229 | "id": 56, 230 | "name": "owner", 231 | "nodeType": "Identifier", 232 | "overloadedDeclarations": [], 233 | "referencedDeclaration": 49, 234 | "src": "234:5:1", 235 | "typeDescriptions": { 236 | "typeIdentifier": "t_address", 237 | "typeString": "address" 238 | } 239 | }, 240 | "src": "220:19:1", 241 | "typeDescriptions": { 242 | "typeIdentifier": "t_bool", 243 | "typeString": "bool" 244 | } 245 | }, 246 | { 247 | "argumentTypes": null, 248 | "hexValue": "546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572", 249 | "id": 58, 250 | "isConstant": false, 251 | "isLValue": false, 252 | "isPure": true, 253 | "kind": "string", 254 | "lValueRequested": false, 255 | "nodeType": "Literal", 256 | "src": "248:53:1", 257 | "subdenomination": null, 258 | "typeDescriptions": { 259 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 260 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 261 | }, 262 | "value": "This function is restricted to the contract's owner" 263 | } 264 | ], 265 | "expression": { 266 | "argumentTypes": [ 267 | { 268 | "typeIdentifier": "t_bool", 269 | "typeString": "bool" 270 | }, 271 | { 272 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 273 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 274 | } 275 | ], 276 | "id": 53, 277 | "name": "require", 278 | "nodeType": "Identifier", 279 | "overloadedDeclarations": [ 280 | 94, 281 | 95 282 | ], 283 | "referencedDeclaration": 95, 284 | "src": "204:7:1", 285 | "typeDescriptions": { 286 | "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", 287 | "typeString": "function (bool,string memory) pure" 288 | } 289 | }, 290 | "id": 59, 291 | "isConstant": false, 292 | "isLValue": false, 293 | "isPure": false, 294 | "kind": "functionCall", 295 | "lValueRequested": false, 296 | "names": [], 297 | "nodeType": "FunctionCall", 298 | "src": "204:104:1", 299 | "typeDescriptions": { 300 | "typeIdentifier": "t_tuple$__$", 301 | "typeString": "tuple()" 302 | } 303 | }, 304 | "id": 60, 305 | "nodeType": "ExpressionStatement", 306 | "src": "204:104:1" 307 | }, 308 | { 309 | "id": 61, 310 | "nodeType": "PlaceholderStatement", 311 | "src": "315:1:1" 312 | } 313 | ] 314 | }, 315 | "documentation": null, 316 | "id": 63, 317 | "name": "restricted", 318 | "nodeType": "ModifierDefinition", 319 | "parameters": { 320 | "id": 52, 321 | "nodeType": "ParameterList", 322 | "parameters": [], 323 | "src": "194:2:1" 324 | }, 325 | "src": "175:147:1", 326 | "visibility": "internal" 327 | }, 328 | { 329 | "body": { 330 | "id": 74, 331 | "nodeType": "Block", 332 | "src": "384:49:1", 333 | "statements": [ 334 | { 335 | "expression": { 336 | "argumentTypes": null, 337 | "id": 72, 338 | "isConstant": false, 339 | "isLValue": false, 340 | "isPure": false, 341 | "lValueRequested": false, 342 | "leftHandSide": { 343 | "argumentTypes": null, 344 | "id": 70, 345 | "name": "last_completed_migration", 346 | "nodeType": "Identifier", 347 | "overloadedDeclarations": [], 348 | "referencedDeclaration": 51, 349 | "src": "391:24:1", 350 | "typeDescriptions": { 351 | "typeIdentifier": "t_uint256", 352 | "typeString": "uint256" 353 | } 354 | }, 355 | "nodeType": "Assignment", 356 | "operator": "=", 357 | "rightHandSide": { 358 | "argumentTypes": null, 359 | "id": 71, 360 | "name": "completed", 361 | "nodeType": "Identifier", 362 | "overloadedDeclarations": [], 363 | "referencedDeclaration": 65, 364 | "src": "418:9:1", 365 | "typeDescriptions": { 366 | "typeIdentifier": "t_uint256", 367 | "typeString": "uint256" 368 | } 369 | }, 370 | "src": "391:36:1", 371 | "typeDescriptions": { 372 | "typeIdentifier": "t_uint256", 373 | "typeString": "uint256" 374 | } 375 | }, 376 | "id": 73, 377 | "nodeType": "ExpressionStatement", 378 | "src": "391:36:1" 379 | } 380 | ] 381 | }, 382 | "documentation": null, 383 | "id": 75, 384 | "implemented": true, 385 | "kind": "function", 386 | "modifiers": [ 387 | { 388 | "arguments": null, 389 | "id": 68, 390 | "modifierName": { 391 | "argumentTypes": null, 392 | "id": 67, 393 | "name": "restricted", 394 | "nodeType": "Identifier", 395 | "overloadedDeclarations": [], 396 | "referencedDeclaration": 63, 397 | "src": "373:10:1", 398 | "typeDescriptions": { 399 | "typeIdentifier": "t_modifier$__$", 400 | "typeString": "modifier ()" 401 | } 402 | }, 403 | "nodeType": "ModifierInvocation", 404 | "src": "373:10:1" 405 | } 406 | ], 407 | "name": "setCompleted", 408 | "nodeType": "FunctionDefinition", 409 | "parameters": { 410 | "id": 66, 411 | "nodeType": "ParameterList", 412 | "parameters": [ 413 | { 414 | "constant": false, 415 | "id": 65, 416 | "name": "completed", 417 | "nodeType": "VariableDeclaration", 418 | "scope": 75, 419 | "src": "350:14:1", 420 | "stateVariable": false, 421 | "storageLocation": "default", 422 | "typeDescriptions": { 423 | "typeIdentifier": "t_uint256", 424 | "typeString": "uint256" 425 | }, 426 | "typeName": { 427 | "id": 64, 428 | "name": "uint", 429 | "nodeType": "ElementaryTypeName", 430 | "src": "350:4:1", 431 | "typeDescriptions": { 432 | "typeIdentifier": "t_uint256", 433 | "typeString": "uint256" 434 | } 435 | }, 436 | "value": null, 437 | "visibility": "internal" 438 | } 439 | ], 440 | "src": "349:16:1" 441 | }, 442 | "returnParameters": { 443 | "id": 69, 444 | "nodeType": "ParameterList", 445 | "parameters": [], 446 | "src": "384:0:1" 447 | }, 448 | "scope": 76, 449 | "src": "328:105:1", 450 | "stateMutability": "nonpayable", 451 | "superFunction": null, 452 | "visibility": "public" 453 | } 454 | ], 455 | "scope": 77, 456 | "src": "69:367:1" 457 | } 458 | ], 459 | "src": "33:405:1" 460 | }, 461 | "legacyAST": { 462 | "attributes": { 463 | "absolutePath": "project:/contracts/Migrations.sol", 464 | "exportedSymbols": { 465 | "Migrations": [ 466 | 76 467 | ] 468 | } 469 | }, 470 | "children": [ 471 | { 472 | "attributes": { 473 | "literals": [ 474 | "solidity", 475 | ">=", 476 | "0.4", 477 | ".22", 478 | "<", 479 | "0.8", 480 | ".0" 481 | ] 482 | }, 483 | "id": 45, 484 | "name": "PragmaDirective", 485 | "src": "33:32:1" 486 | }, 487 | { 488 | "attributes": { 489 | "baseContracts": [ 490 | null 491 | ], 492 | "contractDependencies": [ 493 | null 494 | ], 495 | "contractKind": "contract", 496 | "documentation": null, 497 | "fullyImplemented": true, 498 | "linearizedBaseContracts": [ 499 | 76 500 | ], 501 | "name": "Migrations", 502 | "scope": 77 503 | }, 504 | "children": [ 505 | { 506 | "attributes": { 507 | "constant": false, 508 | "name": "owner", 509 | "scope": 76, 510 | "stateVariable": true, 511 | "storageLocation": "default", 512 | "type": "address", 513 | "visibility": "public" 514 | }, 515 | "children": [ 516 | { 517 | "attributes": { 518 | "name": "address", 519 | "stateMutability": "nonpayable", 520 | "type": "address" 521 | }, 522 | "id": 46, 523 | "name": "ElementaryTypeName", 524 | "src": "94:7:1" 525 | }, 526 | { 527 | "attributes": { 528 | "argumentTypes": null, 529 | "isConstant": false, 530 | "isLValue": false, 531 | "isPure": false, 532 | "lValueRequested": false, 533 | "member_name": "sender", 534 | "referencedDeclaration": null, 535 | "type": "address payable" 536 | }, 537 | "children": [ 538 | { 539 | "attributes": { 540 | "argumentTypes": null, 541 | "overloadedDeclarations": [ 542 | null 543 | ], 544 | "referencedDeclaration": 91, 545 | "type": "msg", 546 | "value": "msg" 547 | }, 548 | "id": 47, 549 | "name": "Identifier", 550 | "src": "117:3:1" 551 | } 552 | ], 553 | "id": 48, 554 | "name": "MemberAccess", 555 | "src": "117:10:1" 556 | } 557 | ], 558 | "id": 49, 559 | "name": "VariableDeclaration", 560 | "src": "94:33:1" 561 | }, 562 | { 563 | "attributes": { 564 | "constant": false, 565 | "name": "last_completed_migration", 566 | "scope": 76, 567 | "stateVariable": true, 568 | "storageLocation": "default", 569 | "type": "uint256", 570 | "value": null, 571 | "visibility": "public" 572 | }, 573 | "children": [ 574 | { 575 | "attributes": { 576 | "name": "uint", 577 | "type": "uint256" 578 | }, 579 | "id": 50, 580 | "name": "ElementaryTypeName", 581 | "src": "132:4:1" 582 | } 583 | ], 584 | "id": 51, 585 | "name": "VariableDeclaration", 586 | "src": "132:36:1" 587 | }, 588 | { 589 | "attributes": { 590 | "documentation": null, 591 | "name": "restricted", 592 | "visibility": "internal" 593 | }, 594 | "children": [ 595 | { 596 | "attributes": { 597 | "parameters": [ 598 | null 599 | ] 600 | }, 601 | "children": [], 602 | "id": 52, 603 | "name": "ParameterList", 604 | "src": "194:2:1" 605 | }, 606 | { 607 | "children": [ 608 | { 609 | "children": [ 610 | { 611 | "attributes": { 612 | "argumentTypes": null, 613 | "isConstant": false, 614 | "isLValue": false, 615 | "isPure": false, 616 | "isStructConstructorCall": false, 617 | "lValueRequested": false, 618 | "names": [ 619 | null 620 | ], 621 | "type": "tuple()", 622 | "type_conversion": false 623 | }, 624 | "children": [ 625 | { 626 | "attributes": { 627 | "argumentTypes": [ 628 | { 629 | "typeIdentifier": "t_bool", 630 | "typeString": "bool" 631 | }, 632 | { 633 | "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", 634 | "typeString": "literal_string \"This function is restricted to the contract's owner\"" 635 | } 636 | ], 637 | "overloadedDeclarations": [ 638 | 94, 639 | 95 640 | ], 641 | "referencedDeclaration": 95, 642 | "type": "function (bool,string memory) pure", 643 | "value": "require" 644 | }, 645 | "id": 53, 646 | "name": "Identifier", 647 | "src": "204:7:1" 648 | }, 649 | { 650 | "attributes": { 651 | "argumentTypes": null, 652 | "commonType": { 653 | "typeIdentifier": "t_address", 654 | "typeString": "address" 655 | }, 656 | "isConstant": false, 657 | "isLValue": false, 658 | "isPure": false, 659 | "lValueRequested": false, 660 | "operator": "==", 661 | "type": "bool" 662 | }, 663 | "children": [ 664 | { 665 | "attributes": { 666 | "argumentTypes": null, 667 | "isConstant": false, 668 | "isLValue": false, 669 | "isPure": false, 670 | "lValueRequested": false, 671 | "member_name": "sender", 672 | "referencedDeclaration": null, 673 | "type": "address payable" 674 | }, 675 | "children": [ 676 | { 677 | "attributes": { 678 | "argumentTypes": null, 679 | "overloadedDeclarations": [ 680 | null 681 | ], 682 | "referencedDeclaration": 91, 683 | "type": "msg", 684 | "value": "msg" 685 | }, 686 | "id": 54, 687 | "name": "Identifier", 688 | "src": "220:3:1" 689 | } 690 | ], 691 | "id": 55, 692 | "name": "MemberAccess", 693 | "src": "220:10:1" 694 | }, 695 | { 696 | "attributes": { 697 | "argumentTypes": null, 698 | "overloadedDeclarations": [ 699 | null 700 | ], 701 | "referencedDeclaration": 49, 702 | "type": "address", 703 | "value": "owner" 704 | }, 705 | "id": 56, 706 | "name": "Identifier", 707 | "src": "234:5:1" 708 | } 709 | ], 710 | "id": 57, 711 | "name": "BinaryOperation", 712 | "src": "220:19:1" 713 | }, 714 | { 715 | "attributes": { 716 | "argumentTypes": null, 717 | "hexvalue": "546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572", 718 | "isConstant": false, 719 | "isLValue": false, 720 | "isPure": true, 721 | "lValueRequested": false, 722 | "subdenomination": null, 723 | "token": "string", 724 | "type": "literal_string \"This function is restricted to the contract's owner\"", 725 | "value": "This function is restricted to the contract's owner" 726 | }, 727 | "id": 58, 728 | "name": "Literal", 729 | "src": "248:53:1" 730 | } 731 | ], 732 | "id": 59, 733 | "name": "FunctionCall", 734 | "src": "204:104:1" 735 | } 736 | ], 737 | "id": 60, 738 | "name": "ExpressionStatement", 739 | "src": "204:104:1" 740 | }, 741 | { 742 | "id": 61, 743 | "name": "PlaceholderStatement", 744 | "src": "315:1:1" 745 | } 746 | ], 747 | "id": 62, 748 | "name": "Block", 749 | "src": "197:125:1" 750 | } 751 | ], 752 | "id": 63, 753 | "name": "ModifierDefinition", 754 | "src": "175:147:1" 755 | }, 756 | { 757 | "attributes": { 758 | "documentation": null, 759 | "implemented": true, 760 | "isConstructor": false, 761 | "kind": "function", 762 | "name": "setCompleted", 763 | "scope": 76, 764 | "stateMutability": "nonpayable", 765 | "superFunction": null, 766 | "visibility": "public" 767 | }, 768 | "children": [ 769 | { 770 | "children": [ 771 | { 772 | "attributes": { 773 | "constant": false, 774 | "name": "completed", 775 | "scope": 75, 776 | "stateVariable": false, 777 | "storageLocation": "default", 778 | "type": "uint256", 779 | "value": null, 780 | "visibility": "internal" 781 | }, 782 | "children": [ 783 | { 784 | "attributes": { 785 | "name": "uint", 786 | "type": "uint256" 787 | }, 788 | "id": 64, 789 | "name": "ElementaryTypeName", 790 | "src": "350:4:1" 791 | } 792 | ], 793 | "id": 65, 794 | "name": "VariableDeclaration", 795 | "src": "350:14:1" 796 | } 797 | ], 798 | "id": 66, 799 | "name": "ParameterList", 800 | "src": "349:16:1" 801 | }, 802 | { 803 | "attributes": { 804 | "parameters": [ 805 | null 806 | ] 807 | }, 808 | "children": [], 809 | "id": 69, 810 | "name": "ParameterList", 811 | "src": "384:0:1" 812 | }, 813 | { 814 | "attributes": { 815 | "arguments": null 816 | }, 817 | "children": [ 818 | { 819 | "attributes": { 820 | "argumentTypes": null, 821 | "overloadedDeclarations": [ 822 | null 823 | ], 824 | "referencedDeclaration": 63, 825 | "type": "modifier ()", 826 | "value": "restricted" 827 | }, 828 | "id": 67, 829 | "name": "Identifier", 830 | "src": "373:10:1" 831 | } 832 | ], 833 | "id": 68, 834 | "name": "ModifierInvocation", 835 | "src": "373:10:1" 836 | }, 837 | { 838 | "children": [ 839 | { 840 | "children": [ 841 | { 842 | "attributes": { 843 | "argumentTypes": null, 844 | "isConstant": false, 845 | "isLValue": false, 846 | "isPure": false, 847 | "lValueRequested": false, 848 | "operator": "=", 849 | "type": "uint256" 850 | }, 851 | "children": [ 852 | { 853 | "attributes": { 854 | "argumentTypes": null, 855 | "overloadedDeclarations": [ 856 | null 857 | ], 858 | "referencedDeclaration": 51, 859 | "type": "uint256", 860 | "value": "last_completed_migration" 861 | }, 862 | "id": 70, 863 | "name": "Identifier", 864 | "src": "391:24:1" 865 | }, 866 | { 867 | "attributes": { 868 | "argumentTypes": null, 869 | "overloadedDeclarations": [ 870 | null 871 | ], 872 | "referencedDeclaration": 65, 873 | "type": "uint256", 874 | "value": "completed" 875 | }, 876 | "id": 71, 877 | "name": "Identifier", 878 | "src": "418:9:1" 879 | } 880 | ], 881 | "id": 72, 882 | "name": "Assignment", 883 | "src": "391:36:1" 884 | } 885 | ], 886 | "id": 73, 887 | "name": "ExpressionStatement", 888 | "src": "391:36:1" 889 | } 890 | ], 891 | "id": 74, 892 | "name": "Block", 893 | "src": "384:49:1" 894 | } 895 | ], 896 | "id": 75, 897 | "name": "FunctionDefinition", 898 | "src": "328:105:1" 899 | } 900 | ], 901 | "id": 76, 902 | "name": "ContractDefinition", 903 | "src": "69:367:1" 904 | } 905 | ], 906 | "id": 77, 907 | "name": "SourceUnit", 908 | "src": "33:405:1" 909 | }, 910 | "compiler": { 911 | "name": "solc", 912 | "version": "0.5.16+commit.9c3226ce.Emscripten.clang" 913 | }, 914 | "networks": { 915 | "5777": { 916 | "events": {}, 917 | "links": {}, 918 | "address": "0x4c61fE5555F67D86ecf30d17453FF6157C287CBa", 919 | "transactionHash": "0x07c4e411b6de86deca7aba61235922f4553f6cfdc0c50f4d91b024d4b893da19" 920 | } 921 | }, 922 | "schemaVersion": "3.4.8", 923 | "updatedAt": "2022-07-26T00:38:41.781Z", 924 | "networkType": "ethereum", 925 | "devdoc": { 926 | "methods": {} 927 | }, 928 | "userdoc": { 929 | "methods": {} 930 | } 931 | } -------------------------------------------------------------------------------- /contracts/Adoption.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Adoption { 4 | 5 | address[16] public adopters; 6 | 7 | // Adopting a pet 8 | function adopt(uint petId) public returns (uint) { 9 | require(petId >= 0 && petId <= 15); 10 | 11 | adopters[petId] = msg.sender; 12 | 13 | return petId; 14 | } 15 | 16 | // Retrieving the adopters 17 | function getAdopters() public view returns (address[16] memory) { 18 | return adopters; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.22 <0.8.0; 3 | 4 | contract Migrations { 5 | address public owner = msg.sender; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | require( 10 | msg.sender == owner, 11 | "This function is restricted to the contract's owner" 12 | ); 13 | _; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 Adoption = artifacts.require("Adoption"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Adoption); 5 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pet-shop", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "truffle.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "dev": "lite-server", 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "lite-server": "^2.3.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/images/boxer.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/boxer.jpeg -------------------------------------------------------------------------------- /src/images/caramelo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/caramelo.jpg -------------------------------------------------------------------------------- /src/images/french-bulldog.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/french-bulldog.jpeg -------------------------------------------------------------------------------- /src/images/golden-retriever.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/golden-retriever.jpeg -------------------------------------------------------------------------------- /src/images/poodle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/poodle.jpg -------------------------------------------------------------------------------- /src/images/scottish-terrier.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/scottish-terrier.jpeg -------------------------------------------------------------------------------- /src/images/srd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalinnovationone/dio-blockchain-for-devs/06daa46877d9b86ad4058b8056cb041880efa706/src/images/srd.jpg -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |