├── .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 | Pete's Pet Shop 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |
22 |
23 |
24 |

Adote o seu pet!

25 |
26 |
27 |
28 |
29 | 30 |
31 | 32 |
33 |
34 | 35 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/js/app.js: -------------------------------------------------------------------------------- 1 | App = { 2 | web3Provider: null, 3 | contracts: {}, 4 | 5 | init: async function() { 6 | // Load pets. 7 | $.getJSON('../pets.json', function(data) { 8 | var petsRow = $('#petsRow'); 9 | var petTemplate = $('#petTemplate'); 10 | 11 | for (i = 0; i < 12; i ++) { 12 | petTemplate.find('.panel-title').text(data[i].name); 13 | petTemplate.find('img').attr('src', data[i].picture); 14 | petTemplate.find('.pet-breed').text(data[i].breed); 15 | petTemplate.find('.pet-age').text(data[i].age); 16 | petTemplate.find('.pet-location').text(data[i].location); 17 | petTemplate.find('.btn-adopt').attr('data-id', data[i].id); 18 | 19 | petsRow.append(petTemplate.html()); 20 | } 21 | }); 22 | 23 | return await App.initWeb3(); 24 | }, 25 | 26 | //Iniciando a aplicação com o Metamask 27 | initWeb3: async function() { 28 | //verificar a instalação do Metamask 29 | if (window.ethereum) { 30 | App.web3Provider = window.ethereum; 31 | try { 32 | // Request account access 33 | await window.ethereum.request({ method: "eth_requestAccounts" });; 34 | } catch (error) { 35 | // User denied account access... 36 | console.error("User denied account access") 37 | } 38 | } 39 | 40 | // Legacy dapp browsers... 41 | else if (window.web3) { 42 | App.web3Provider = window.web3.currentProvider; 43 | } 44 | // If no injected web3 instance is detected, fall back to Ganache 45 | else { 46 | App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545'); 47 | } 48 | web3 = new Web3(App.web3Provider); 49 | 50 | return App.initContract(); 51 | }, 52 | 53 | //Incializando o contrato inteligente 54 | initContract: function() { 55 | 56 | $.getJSON('Adoption.json', function(data) { 57 | // Get the necessary contract artifact file and instantiate it with @truffle/contract 58 | var AdoptionArtifact = data; 59 | App.contracts.Adoption = TruffleContract(AdoptionArtifact); 60 | 61 | // Set the provider for our contract 62 | App.contracts.Adoption.setProvider(App.web3Provider); 63 | 64 | // Use our contract to retrieve and mark the adopted pets 65 | return App.markAdopted(); 66 | }); 67 | 68 | return App.bindEvents(); 69 | }, 70 | 71 | bindEvents: function() { 72 | $(document).on('click', '.btn-adopt', App.handleAdopt); 73 | }, 74 | 75 | markAdopted: function() { 76 | var adoptionInstance; 77 | 78 | App.contracts.Adoption.deployed().then(function(instance) { 79 | adoptionInstance = instance; 80 | 81 | return adoptionInstance.getAdopters.call(); 82 | }).then(function(adopters) { 83 | for (i = 0; i < adopters.length; i++) { 84 | if (adopters[i] !== '0x0000000000000000000000000000000000000000') { 85 | $('.panel-pet').eq(i).find('button').text('Success').attr('disabled', true); 86 | } 87 | } 88 | }).catch(function(err) { 89 | console.log(err.message); 90 | }); 91 | }, 92 | 93 | handleAdopt: function(event) { 94 | event.preventDefault(); 95 | 96 | var petId = parseInt($(event.target).data('id')); 97 | 98 | var adoptionInstance; 99 | 100 | web3.eth.getAccounts(function(error, accounts) { 101 | if (error) { 102 | console.log(error); 103 | } 104 | 105 | var account = accounts[0]; 106 | 107 | App.contracts.Adoption.deployed().then(function(instance) { 108 | adoptionInstance = instance; 109 | 110 | // Execute adopt as a transaction by sending account 111 | return adoptionInstance.adopt(petId, {from: account}); 112 | }).then(function(result) { 113 | return App.markAdopted(); 114 | }).catch(function(err) { 115 | console.log(err.message); 116 | }); 117 | }); 118 | } 119 | 120 | }; 121 | 122 | $(function() { 123 | $(window).load(function() { 124 | App.init(); 125 | }); 126 | }); 127 | -------------------------------------------------------------------------------- /src/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.7 (http://getbootstrap.com) 3 | * Copyright 2011-2016 Twitter, Inc. 4 | * Licensed under the MIT license 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); -------------------------------------------------------------------------------- /src/pets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "name": "Paçoca", 5 | "picture": "images/scottish-terrier.jpeg", 6 | "age": 3, 7 | "breed": "Scottish Terrier", 8 | "location": "Lisco, Alabama" 9 | }, 10 | { 11 | "id": 1, 12 | "name": "Banana", 13 | "picture": "images/scottish-terrier.jpeg", 14 | "age": 3, 15 | "breed": "Scottish Terrier", 16 | "location": "Tooleville, West Virginia" 17 | }, 18 | { 19 | "id": 2, 20 | "name": "Canela", 21 | "picture": "images/french-bulldog.jpeg", 22 | "age": 2, 23 | "breed": "French Bulldog", 24 | "location": "Freeburn, Idaho" 25 | }, 26 | { 27 | "id": 3, 28 | "name": "Melinda", 29 | "picture": "images/boxer.jpeg", 30 | "age": 2, 31 | "breed": "Boxer", 32 | "location": "Camas, Pennsylvania" 33 | }, 34 | { 35 | "id": 4, 36 | "name": "Malu", 37 | "picture": "images/french-bulldog.jpeg", 38 | "age": 2, 39 | "breed": "French Bulldog", 40 | "location": "Gerber, South Dakota" 41 | }, 42 | { 43 | "id": 5, 44 | "name": "Tessa", 45 | "picture": "images/french-bulldog.jpeg", 46 | "age": 3, 47 | "breed": "French Bulldog", 48 | "location": "Innsbrook, Illinois" 49 | }, 50 | { 51 | "id": 6, 52 | "name": "Pudim", 53 | "picture": "images/golden-retriever.jpeg", 54 | "age": 3, 55 | "breed": "Golden Retriever", 56 | "location": "Soudan, Louisiana" 57 | }, 58 | { 59 | "id": 7, 60 | "name": "Caramelo", 61 | "picture": "images/golden-retriever.jpeg", 62 | "age": 3, 63 | "breed": "Golden Retriever", 64 | "location": "Jacksonwald, Palau" 65 | }, 66 | { 67 | "id": 8, 68 | "name": "Lilica", 69 | "picture": "images/french-bulldog.jpeg", 70 | "age": 2, 71 | "breed": "French Bulldog", 72 | "location": "Honolulu, Hawaii" 73 | }, 74 | { 75 | "id": 9, 76 | "name": "Jojo", 77 | "picture": "images/boxer.jpeg", 78 | "age": 3, 79 | "breed": "Boxer", 80 | "location": "Matheny, Utah" 81 | }, 82 | { 83 | "id": 10, 84 | "name": "Paçoquinha", 85 | "picture": "images/boxer.jpeg", 86 | "age": 2, 87 | "breed": "Boxer", 88 | "location": "Tyhee, Indiana" 89 | }, 90 | { 91 | "id": 11, 92 | "name": "Dean", 93 | "picture": "images/scottish-terrier.jpeg", 94 | "age": 3, 95 | "breed": "Scottish Terrier", 96 | "location": "Windsor, Montana" 97 | }, 98 | { 99 | "id": 12, 100 | "name": "Gigi", 101 | "picture": "images/french-bulldog.jpeg", 102 | "age": 3, 103 | "breed": "French Bulldog", 104 | "location": "Kingstowne, Nevada" 105 | } 106 | ] 107 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // See 3 | // for more about customizing your Truffle configuration! 4 | networks: { 5 | development: { 6 | host: "127.0.0.1", 7 | port: 7545, 8 | network_id: "*" // Match any network id 9 | }, 10 | develop: { 11 | port: 8545 12 | } 13 | } 14 | }; 15 | --------------------------------------------------------------------------------