├── PEC2 ├── ejercicio_2 │ ├── imagenes │ │ ├── imagenes.md │ │ ├── ipfs_pin.png │ │ ├── ipfs_daemon.png │ │ ├── ipfs_subido.png │ │ └── ipfs_cargando.png │ ├── box-img-lg.png │ ├── box-img-sm.png │ ├── bs-config.json │ ├── src │ │ ├── images │ │ │ ├── boxer.jpeg │ │ │ ├── french-bulldog.jpeg │ │ │ ├── golden-retriever.jpeg │ │ │ └── scottish-terrier.jpeg │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── index.html │ │ ├── pets.json │ │ └── js │ │ │ ├── app.js │ │ │ └── bootstrap.min.js │ ├── migrations │ │ ├── 2_deploy_contracts.js │ │ └── 1_initial_migration.js │ ├── truffle-config.js │ ├── package.json │ ├── contracts │ │ ├── Adoption.sol │ │ └── Migrations.sol │ ├── ejercicio2.md │ ├── LICENSE │ ├── test │ │ └── TestAdoption.sol │ └── build │ │ └── contracts │ │ ├── Adoption.json │ │ └── Migrations.json ├── ejercicio_3 │ ├── cat.jpg │ ├── bloque3.pdf │ ├── swarm_manifest.png │ ├── documento1_swarm.png │ ├── documento2_swam.png │ ├── index.html │ └── ejercicio3.md ├── ejercicio_1 │ ├── loadScript.png │ ├── owner_dominio.png │ ├── comprobacion_ens.png │ ├── registro_dominio.png │ ├── desbloque_account.png │ └── ejercicio1.md └── ejercicio_4 │ ├── swarm_init.png │ ├── set_resolver.png │ ├── swarm_pet_shop.png │ ├── swarm_upload.png │ └── ejercicio4.md ├── ejercicio_1 ├── miner.png ├── geth_init.png ├── genesis.json └── ejercicio1.md ├── ejercicio5 ├── arp_hash.png ├── callbacl_hash.png ├── getDetails_hash.png ├── hash_sumValues.png └── ejercicio_5.md ├── ejercicio_2 ├── geth_result.png ├── truffle_prev.png ├── truffle_result.png ├── transaction_geth.png ├── truffle_transac.png └── ejercicio2.md ├── Documents └── Master_Blockchain │ └── BLOQUE_2 │ └── README.md ├── ejercicio_4 ├── Purchase.sol └── ejercicio4.md └── ejercicio_3 └── ejercicio3.md /PEC2/ejercicio_2/imagenes/imagenes.md: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /ejercicio_1/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_1/miner.png -------------------------------------------------------------------------------- /PEC2/ejercicio_3/cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_3/cat.jpg -------------------------------------------------------------------------------- /ejercicio5/arp_hash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio5/arp_hash.png -------------------------------------------------------------------------------- /ejercicio_1/geth_init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_1/geth_init.png -------------------------------------------------------------------------------- /ejercicio_2/geth_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_2/geth_result.png -------------------------------------------------------------------------------- /PEC2/ejercicio_3/bloque3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_3/bloque3.pdf -------------------------------------------------------------------------------- /ejercicio5/callbacl_hash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio5/callbacl_hash.png -------------------------------------------------------------------------------- /ejercicio5/getDetails_hash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio5/getDetails_hash.png -------------------------------------------------------------------------------- /ejercicio5/hash_sumValues.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio5/hash_sumValues.png -------------------------------------------------------------------------------- /ejercicio_2/truffle_prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_2/truffle_prev.png -------------------------------------------------------------------------------- /ejercicio_2/truffle_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_2/truffle_result.png -------------------------------------------------------------------------------- /PEC2/ejercicio_1/loadScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_1/loadScript.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/box-img-lg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/box-img-lg.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/box-img-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/box-img-sm.png -------------------------------------------------------------------------------- /PEC2/ejercicio_4/swarm_init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_4/swarm_init.png -------------------------------------------------------------------------------- /ejercicio_2/transaction_geth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_2/transaction_geth.png -------------------------------------------------------------------------------- /ejercicio_2/truffle_transac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/ejercicio_2/truffle_transac.png -------------------------------------------------------------------------------- /PEC2/ejercicio_1/owner_dominio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_1/owner_dominio.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/bs-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": { 3 | "baseDir": ["./src", "./build/contracts"] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /PEC2/ejercicio_3/swarm_manifest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_3/swarm_manifest.png -------------------------------------------------------------------------------- /PEC2/ejercicio_4/set_resolver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_4/set_resolver.png -------------------------------------------------------------------------------- /PEC2/ejercicio_4/swarm_pet_shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_4/swarm_pet_shop.png -------------------------------------------------------------------------------- /PEC2/ejercicio_4/swarm_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_4/swarm_upload.png -------------------------------------------------------------------------------- /PEC2/ejercicio_1/comprobacion_ens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_1/comprobacion_ens.png -------------------------------------------------------------------------------- /PEC2/ejercicio_1/registro_dominio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_1/registro_dominio.png -------------------------------------------------------------------------------- /PEC2/ejercicio_3/documento1_swarm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_3/documento1_swarm.png -------------------------------------------------------------------------------- /PEC2/ejercicio_3/documento2_swam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_3/documento2_swam.png -------------------------------------------------------------------------------- /PEC2/ejercicio_1/desbloque_account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_1/desbloque_account.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/imagenes/ipfs_pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/imagenes/ipfs_pin.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/images/boxer.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/images/boxer.jpeg -------------------------------------------------------------------------------- /PEC2/ejercicio_2/imagenes/ipfs_daemon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/imagenes/ipfs_daemon.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/imagenes/ipfs_subido.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/imagenes/ipfs_subido.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/imagenes/ipfs_cargando.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/imagenes/ipfs_cargando.png -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/images/french-bulldog.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/images/french-bulldog.jpeg -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/images/golden-retriever.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/images/golden-retriever.jpeg -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/images/scottish-terrier.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/images/scottish-terrier.jpeg -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrirod/masteruah/HEAD/PEC2/ejercicio_2/src/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /PEC2/ejercicio_2/migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | var Adoption = artifacts.require("Adoption"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Adoption); 5 | }; -------------------------------------------------------------------------------- /PEC2/ejercicio_2/migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /ejercicio_1/genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "chainId": 1, 4 | "homesteadBlock": 0, 5 | "eip155Block": 0, 6 | "eip158Block": 0 7 | }, 8 | "difficulty": "10", 9 | "gasLimit": "99000000", 10 | "alloc": { 11 | 12 | "7df9a875a174b3bc565e6424a0050ebc1b2d1d82": 13 | { "balance": "999" } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/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 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/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.5.3" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Documents/Master_Blockchain/BLOQUE_2/README.md: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf400 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | {\*\expandedcolortbl;;} 5 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 6 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 7 | 8 | \f0\fs24 \cf0 primera linea} -------------------------------------------------------------------------------- /PEC2/ejercicio_2/contracts/Adoption.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Adoption { 4 | address[16] public adopters; 5 | 6 | // Adopting a pet 7 | function adopt(uint petId) public returns (uint) { 8 | require(petId >= 0 && petId <= 15); 9 | 10 | adopters[petId] = msg.sender; 11 | 12 | return petId; 13 | } 14 | 15 | // Retrieving the adopters 16 | function getAdopters() public view returns (address[16] memory) { 17 | return adopters; 18 | } 19 | 20 | 21 | 22 | } -------------------------------------------------------------------------------- /PEC2/ejercicio_3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adrian's File 8 | 9 | 10 |
11 | Documento 1 12 | Documento 2 13 |
14 | 15 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | constructor() public { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /PEC2/ejercicio_4/ejercicio4.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 4 2 | 3 | Proyecto utilizado está desplegado en Ganache 4 | 5 | Se inicializa la conexión con Swarm: 6 | ```console 7 | swarm --bzzaccount 5be5cb0dea26d2c5a6b9e5c562eadb0b534b802a 8 | ``` 9 | Se suben los ficheros: 10 | ```console 11 | swarm --recursive up ./src 12 | ``` 13 | Se comprueba que se pueda acceder a los ficheros, ver imagenes. 14 | 15 | Se vuelve a inicializar swarm, pero esta vez con la API de ENS: 16 | ```console 17 | swarm --ens-api $HOME/.ethereum/rinkeby/geth.ipc --bzzaccount 5be5cb0dea26d2c5a6b9e5c562eadb0b534b802a 18 | ``` 19 | 20 | Se procede a relacionar el dominio con el contenido: 21 | ```console 22 | publicResolver.setContent(namehash('arpEther.tst'),'0x5b5ffbca02b04347298f11628ba145469c0c5e8c2ea44366583b9cd5d1da4355', {from: eth.accounts[0], gas: 100000}) 23 | ``` 24 | Ver captura set_resolver.png. 25 | 26 | 27 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/ejercicio2.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 2 2 | 3 | **Las imagenes se encuentran en la carpeta de imagenes** 4 | 5 | Se va a utilizar el proyecto pet-shop-tutorial. **Este proyecto está desplegado en una red local con Ganache** 6 | 7 | Se inicializa IPFS: 8 | 9 | ```console 10 | ipfs daemon 11 | ``` 12 | (ver imagen ipfs_daemon.png) 13 | 14 | La subida de los ficheros se realiza con el comando: 15 | ```console 16 | ipfs add -r src/ 17 | ``` 18 | 19 | Se adjunta captura donde se muestra la finalización de la carga. ver imagen ipfs_cargado.png. 20 | 21 | Copio el hash de la carpeta: 22 | 23 | ```console 24 | added QmSXkvV51kaLzV3WEEHDnZpNqQzgWV5S6xsLvRoiAQ6P3N src/ 25 | ``` 26 | http://127.0.0.1:8080/ipfs/QmSXkvV51kaLzV3WEEHDnZpNqQzgWV5S6xsLvRoiAQ6P3N/ 27 | 28 | Por último, se configura un pin: 29 | 30 | ```console 31 | ipfs pin add -r QmSXkvV51kaLzV3WEEHDnZpNqQzgWV5S6xsLvRoiAQ6P3N 32 | ``` 33 | ver imagen ipf_pin.png 34 | -------------------------------------------------------------------------------- /ejercicio5/ejercicio_5.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 5 2 | Para la obtención de los identificadores he utilizado la siguiente web: 3 | 4 | https://emn178.github.io/online-tools/keccak_256.html 5 | 6 | La utilización de la misma es para obtener el hash completo del literal nombre de funcion y parámetros, por ejemplo, 7 | sumValues(uint,uint) 8 | 9 | Una vez obtenido se corta el hash para quedarnos solo con los primeros 4 bytes 10 | 11 | -function sumValues (uint _a, uint _b) public view returns (uint _c) {} 12 | (ver imagen hash_sumvalues.png) 13 | **Identificador: 0x06cbb87** 14 | 15 | -function getGasDetails() public payable{} 16 | (ver imagen getDetails_hash.png) 17 | **Identificador:*0x3d86f4a* 18 | 19 | -function __callback(bytes32 id, string memory result) public{} 20 | (ver imagen callback_hash.png) 21 | **Identificador:0x27dc297** 22 | 23 | -function arp(uint8 _a, address _address) internal{} 24 | (ver imagen arp_hash.png) 25 | **Identificador:*0x4d766f3* 26 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Truffle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /PEC2/ejercicio_1/ejercicio1.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 1 2 | 3 | Se ha utilizado el fichero **ensutils-testnet.js**. Al cual se ha introducido una modificacion para que apunte a la red rinkeby. 4 | 5 | Tras ello, nos sincronizamos en modo light a la red rinkeby: 6 | 7 | ```console 8 | geth -rinkeby -syncmode "fast" 9 | ``` 10 | 11 | Tras sincronizarnos al 100% podemos realizar el ejercicio: 12 | Cargamos el javascript comentado anteriormente: 13 | 14 | ```console 15 | loadScript("/home/adri/Proyectos/CryptoZombies/ensutils-testnet.js") 16 | ``` 17 | Comprobamos si está libre el dominio: 18 | 19 | ```console 20 | testRegistrar.expiryTimes(web3.sha3("arpEther")) 21 | ``` 22 | Lo cual nos devuelve 0 (ver imagen comprobacion_ens.png), entonces quiere decir que está libre. 23 | 24 | Pasamos a desbloquear la cuenta (ver imagen desbloqueo_account.png) 25 | ```console 26 | personal.unlockAccount(eth.accounts[0]) 27 | ``` 28 | 29 | Tras desbloquear la cuenta pasamos a registra el dominio: (ver imagen registro_dominio.png) 30 | ```console 31 | testRegistrar.register(web3.sha3("arpEther"), eth.accounts[0], {from: eth.accounts[0]}) 32 | ``` 33 | 34 | Volvemos a comprobar si el dominio está utilizado (ver imagen registro_dominio.png) 35 | Por último, comprobación del owner del dominio: 36 | 37 | ```console 38 | ens.owner(namehash("arpEther.test")) 39 | ``` 40 | (Ver imagen owner_dominio.png) 41 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/test/TestAdoption.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^ 0.5 .0; 2 | 3 | import "truffle/Assert.sol"; 4 | import "truffle/DeployedAddresses.sol"; 5 | import "../contracts/Adoption.sol"; 6 | 7 | contract TestAdoption { 8 | // Testing the adopt() function 9 | function testUserCanAdoptPet() public { 10 | uint returnedId = adoption.adopt(expectedPetId); 11 | 12 | Assert.equal(returnedId, expectedPetId, "Adoption of the expected pet should match what is returned."); 13 | } 14 | 15 | // Testing retrieval of a single pet's owner 16 | function testGetAdopterAddressByPetId() public { 17 | address adopter = adoption.adopters(expectedPetId); 18 | 19 | Assert.equal(adopter, expectedAdopter, "Owner of the expected pet should be this contract"); 20 | } 21 | 22 | // Testing retrieval of all pet owners 23 | function testGetAdopterAddressByPetIdInArray() public { 24 | // Store adopters in memory rather than contract's storage 25 | address[16] memory adopters = adoption.getAdopters(); 26 | 27 | Assert.equal(adopters[expectedPetId], expectedAdopter, "Owner of the expected pet should be this contract"); 28 | } 29 | 30 | // The address of the adoption contract to be tested 31 | Adoption adoption = Adoption(DeployedAddresses.Adoption()); 32 | 33 | // The id of the pet that will be used for testing 34 | uint expectedPetId = 8; 35 | 36 | //The expected owner of adopted pet is this contract 37 | address expectedAdopter = address(this); 38 | 39 | } -------------------------------------------------------------------------------- /PEC2/ejercicio_3/ejercicio3.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 3 2 | 3 | Primero, se crea el fichero html (se encuentra en esta carpeta) junto con los documentos con los que se enlaza. 4 | 5 | Segundo, se intenta subir los documentos con el siguiente comando: 6 | ```console 7 | swarm --recursive --defaultpath swarm-manifest/index.html --bzzapi http://swarm-gateways.net/ up swarm-manifest/ 2> up.log 8 | ``` 9 | Sin embargo, da el siguiente error: 10 | ```console 11 | Fatal: Upload failed: unexpected HTTP status: 308 Permanent Redirect 12 | ``` 13 | Por ello, se pasa a subirlo con el comando modificado: 14 | ```console 15 | swarm --recursive --defaultpath swarm-manifest/index.html up swarm-manifest/ 2> up.log 16 | ``` 17 | Consiguiendo subirlo todo dando el hash: 18 | **7928780620d70c668ff4ce117bb22763a65bac67721892d34a352ec9924cbc3f** 19 | (ver imagen swarm_manifest.png) 20 | 21 | Cuando se prueba con la url : 22 | https://swarm-gateways.net/bzz:/7928780620d70c668ff4ce117bb22763a65bac67721892d34a352ec9924cbc3f/ 23 | No funciona. 24 | 25 | Sin embargo cuando se prueba con: http://localhost:8500/bzz:/7928780620d70c668ff4ce117bb22763a65bac67721892d34a352ec9924cbc3f/ 26 | Funciona corretamente. 27 | La url del documento 1: 28 | chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://localhost:8500/bzz:/7928780620d70c668ff4ce117bb22763a65bac67721892d34a352ec9924cbc3f/bloque3.pdf 29 | La url del documento 2: 30 | http://localhost:8500/bzz:/7928780620d70c668ff4ce117bb22763a65bac67721892d34a352ec9924cbc3f/cat.jpg 31 | 32 | Se adjuntan capturas de las urls. 33 | 34 | 35 | -------------------------------------------------------------------------------- /ejercicio_1/ejercicio1.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 1 2 | 3 | Primero se debe crear el fichero **genesis.json**. Para ello se utiliza el comando: 4 | ```console 5 | cat > genesis.json 6 | ``` 7 | 8 | Pasamos a rellenar el fichero con la información necesaria para iniciar la cadena de bloques. 9 | ```json 10 | { 11 | "config": { 12 | "chainId": 1, 13 | "homesteadBlock": 0, 14 | "eip155Block": 0, 15 | "eip158Block": 0 16 | }, 17 | "difficulty": "10", 18 | "gasLimit": "99000000", 19 | "alloc": { 20 | 21 | "7df9a875a174b3bc565e6424a0050ebc1b2d1d82": 22 | { "balance": "999" } 23 | } 24 | } 25 | ``` 26 | 27 | Posteriormente, pasamos a inicializar el cliente Geth: 28 | ```console 29 | geth init genesis.json --datadir block_data 30 | ``` 31 | (Ver imagen geth_init.png) 32 | 33 | Antes de comenzar a minar hay que crear la cuenta etherbase y una personal, para ello hay que abrir la consola de geth: 34 | ```console 35 | geth --networkid 123 --datadir data_block console 36 | ``` 37 | 38 | Inicializada, se pasa a crear una nueva cuenta, la primera que se cree será la coinbase: 39 | ```console 40 | personal.newAccount() 41 | ``` 42 | **0xae348a3982157e49174d5fdb4fcd1235acef0037** 43 | 44 | La segunda será la personal: 45 | 46 | **0xe0613172db97c1708401dca784d9e3e0e1c6191f** 47 | 48 | Creadas ambas, se comienza a minar: 49 | ```console 50 | miner.start() 51 | ``` 52 | (Ver imagen miner.png) 53 | 54 | Tras minar unos bloques, paramos el minado con: 55 | ```console 56 | miner.stop() 57 | ``` 58 | 59 | Podemos comprobar el balance de las dos cuentas de la siguiente forma: 60 | ```console 61 | eth.getBalance("0xae348a3982157e49174d5fdb4fcd1235acef0037") 62 | ``` 63 | Devuelve: **645000000000000000000** 64 | ```console 65 | eth.getBalance("0xe0613172db97c1708401dca784d9e3e0e1c6191f") 66 | ``` 67 | Devuelve: **0** 68 | -------------------------------------------------------------------------------- /ejercicio_2/ejercicio2.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 2 2 | 3 | ## Con Geth 4 | 5 | Pasamos a transferir de la cuenta 0xae348a3982157e49174d5fdb4fcd1235acef0037 a 6 | 0xe0613172db97c1708401dca784d9e3e0e1c6191f unos ethers. Para ello usamos debemos desbloquear la primera cuenta con el comando: 7 | 8 | ```console 9 | personal.unlockAccount(eth.accounts[0], "password") 10 | ``` 11 | 12 | ```console 13 | eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(1, "ether")}) 14 | ``` 15 | Si todo ha ido correctamente saldra un mensaje como el de la imagen geth_transaction.png. 16 | 17 | Ahora hay que minar para que los fondos aparezcan en la cuenta destino, para ello usamos 18 | ```console 19 | miner.start() 20 | ``` 21 | Dejamos minar unos bloques y lo paramos con miner.stop(). 22 | 23 | Pasamos a comprobar los balances: 24 | ```console 25 | eth.getBalance(eth.accounts[0]) 26 | ``` 27 | **809000000000000000000** 28 | ```console 29 | eth.getBalance(eth.accounts[1]) 30 | ``` 31 | **1000000000000000000** 32 | 33 | (Ver imagen geth_result.png) 34 | 35 | ## Con Ganache y Truffle 36 | 37 | Primero, hay que comprobar las cuentas disponibles: 38 | ```console 39 | web3.eth.getAccounts() 40 | ``` 41 | Seleccionamos las dos primeras: 42 | 43 | 0x03D804075fFE9dC6b14a4CA0bA7E550E926cF9Aa 44 | 45 | 0xfca9A17236890214c242450a5b3e3F7DeBF1A0Db 46 | 47 | Pasamos a comprobar los balances de las mismas: 48 | ```console 49 | web3.eth.getBalance("0x03D804075fFE9dC6b14a4CA0bA7E550E926cF9Aa") 50 | 51 | web3.eth.getBalance("0xfca9A17236890214c242450a5b3e3F7DeBF1A0Db") 52 | ``` 53 | (ver imagen truffle_prev.png) 54 | 55 | Para mayor claridad creamos una variable donde guardaremos la cantidad a traspasar: 56 | ```console 57 | var amount = web3.utils.toWei('1', 'ether') 58 | ``` 59 | Y realizamos la transferencia: 60 | ```console 61 | web3.eth.sendTransaction({from:"0x03D804075fFE9dC6b14a4CA0bA7E550E926cF9Aa", to:"0xfca9A17236890214c242450a5b3e3F7DeBF1A0Db", value: amount}) 62 | ``` 63 | (ver imagen truffle_transac.png) 64 | 65 | Comprobamos si efectivamente se ha realizado, ver imagen truffle_result.png 66 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/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 |

Adrian's Pet Shop

25 |
26 |
27 |
28 |
29 | 30 |
31 | 32 |
33 |
34 | 35 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /ejercicio_4/Purchase.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.22 <0.7.0; 2 | 3 | contract Purchase { 4 | uint public value; 5 | address payable public seller; 6 | address payable public buyer; 7 | enum State { Created, Locked, Inactive } 8 | State public state; 9 | 10 | // Ensure that `msg.value` is an even number. 11 | // Division will truncate if it is an odd number. 12 | // Check via multiplication that it wasn't an odd number. 13 | constructor() public payable { 14 | seller = msg.sender; 15 | value = msg.value / 2; 16 | require((2 * value) == msg.value, "Value has to be even."); 17 | } 18 | 19 | modifier condition(bool _condition) { 20 | require(_condition); 21 | _; 22 | } 23 | 24 | modifier onlyBuyer() { 25 | require( 26 | msg.sender == buyer, 27 | "Only buyer can call this." 28 | ); 29 | _; 30 | } 31 | 32 | modifier onlySeller() { 33 | require( 34 | msg.sender == seller, 35 | "Only seller can call this." 36 | ); 37 | _; 38 | } 39 | 40 | modifier inState(State _state) { 41 | require( 42 | state == _state, 43 | "Invalid state." 44 | ); 45 | _; 46 | } 47 | 48 | event Aborted(); 49 | event PurchaseConfirmed(); 50 | event ItemReceived(); 51 | 52 | /// Abort the purchase and reclaim the ether. 53 | /// Can only be called by the seller before 54 | /// the contract is locked. 55 | function abort() 56 | public 57 | onlySeller 58 | inState(State.Created) 59 | { 60 | emit Aborted(); 61 | state = State.Inactive; 62 | seller.transfer(address(this).balance); 63 | } 64 | 65 | /// Confirm the purchase as buyer. 66 | /// Transaction has to include `2 * value` ether. 67 | /// The ether will be locked until confirmReceived 68 | /// is called. 69 | function confirmPurchase() 70 | public 71 | inState(State.Created) 72 | condition(msg.value == (2 * value)) 73 | payable 74 | { 75 | emit PurchaseConfirmed(); 76 | buyer = msg.sender; 77 | state = State.Locked; 78 | } 79 | 80 | /// Confirm that you (the buyer) received the item. 81 | /// This will release the locked ether. 82 | function confirmReceived() 83 | public 84 | onlyBuyer 85 | inState(State.Locked) 86 | { 87 | emit ItemReceived(); 88 | // It is important to change the state first because 89 | // otherwise, the contracts called using `send` below 90 | // can call in again here. 91 | state = State.Inactive; 92 | 93 | // NOTE: This actually allows both the buyer and the seller to 94 | // block the refund - the withdraw pattern should be used. 95 | 96 | buyer.transfer(value); 97 | seller.transfer(address(this).balance); 98 | } 99 | } -------------------------------------------------------------------------------- /PEC2/ejercicio_2/src/pets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "name": "Frieda", 5 | "picture": "images/scottish-terrier.jpeg", 6 | "age": 3, 7 | "breed": "Scottish Terrier", 8 | "location": "Lisco, Alabama" 9 | }, 10 | { 11 | "id": 1, 12 | "name": "Gina", 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": "Collins", 21 | "picture": "images/french-bulldog.jpeg", 22 | "age": 2, 23 | "breed": "French Bulldog", 24 | "location": "Freeburn, Idaho" 25 | }, 26 | { 27 | "id": 3, 28 | "name": "Melissa", 29 | "picture": "images/boxer.jpeg", 30 | "age": 2, 31 | "breed": "Boxer", 32 | "location": "Camas, Pennsylvania" 33 | }, 34 | { 35 | "id": 4, 36 | "name": "Jeanine", 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": "Elvia", 45 | "picture": "images/french-bulldog.jpeg", 46 | "age": 3, 47 | "breed": "French Bulldog", 48 | "location": "Innsbrook, Illinois" 49 | }, 50 | { 51 | "id": 6, 52 | "name": "Latisha", 53 | "picture": "images/golden-retriever.jpeg", 54 | "age": 3, 55 | "breed": "Golden Retriever", 56 | "location": "Soudan, Louisiana" 57 | }, 58 | { 59 | "id": 7, 60 | "name": "Coleman", 61 | "picture": "images/golden-retriever.jpeg", 62 | "age": 3, 63 | "breed": "Golden Retriever", 64 | "location": "Jacksonwald, Palau" 65 | }, 66 | { 67 | "id": 8, 68 | "name": "Nichole", 69 | "picture": "images/french-bulldog.jpeg", 70 | "age": 2, 71 | "breed": "French Bulldog", 72 | "location": "Honolulu, Hawaii" 73 | }, 74 | { 75 | "id": 9, 76 | "name": "Fran", 77 | "picture": "images/boxer.jpeg", 78 | "age": 3, 79 | "breed": "Boxer", 80 | "location": "Matheny, Utah" 81 | }, 82 | { 83 | "id": 10, 84 | "name": "Leonor", 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": "Stevenson", 101 | "picture": "images/french-bulldog.jpeg", 102 | "age": 3, 103 | "breed": "French Bulldog", 104 | "location": "Kingstowne, Nevada" 105 | }, 106 | { 107 | "id": 13, 108 | "name": "Kristina", 109 | "picture": "images/golden-retriever.jpeg", 110 | "age": 4, 111 | "breed": "Golden Retriever", 112 | "location": "Sultana, Massachusetts" 113 | }, 114 | { 115 | "id": 14, 116 | "name": "Ethel", 117 | "picture": "images/golden-retriever.jpeg", 118 | "age": 2, 119 | "breed": "Golden Retriever", 120 | "location": "Broadlands, Oregon" 121 | }, 122 | { 123 | "id": 15, 124 | "name": "Terry", 125 | "picture": "images/golden-retriever.jpeg", 126 | "age": 2, 127 | "breed": "Golden Retriever", 128 | "location": "Dawn, Wisconsin" 129 | } 130 | ] 131 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/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 < data.length; 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 | initWeb3: async function() { 27 | // Modern dapp browsers... 28 | if (window.ethereum) { 29 | App.web3Provider = window.ethereum; 30 | try { 31 | // Request account access 32 | await window.ethereum.enable(); 33 | } catch (error) { 34 | // User denied account access... 35 | console.error("User denied account access") 36 | } 37 | } 38 | // Legacy dapp browsers... 39 | else if (window.web3) { 40 | App.web3Provider = window.web3.currentProvider; 41 | } 42 | // If no injected web3 instance is detected, fall back to Ganache 43 | else { 44 | App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545'); 45 | } 46 | web3 = new Web3(App.web3Provider); 47 | 48 | return App.initContract(); 49 | }, 50 | 51 | initContract: function() { 52 | $.getJSON('Adoption.json', function(data) { 53 | // Get the necessary contract artifact file and instantiate it with truffle-contract 54 | var AdoptionArtifact = data; 55 | App.contracts.Adoption = TruffleContract(AdoptionArtifact); 56 | 57 | // Set the provider for our contract 58 | App.contracts.Adoption.setProvider(App.web3Provider); 59 | 60 | // Use our contract to retrieve and mark the adopted pets 61 | return App.markAdopted(); 62 | }); 63 | 64 | return App.bindEvents(); 65 | }, 66 | 67 | bindEvents: function() { 68 | $(document).on('click', '.btn-adopt', App.handleAdopt); 69 | }, 70 | 71 | markAdopted: function(adopters, account) { 72 | var adoptionInstance; 73 | 74 | App.contracts.Adoption.deployed().then(function(instance) { 75 | adoptionInstance = instance; 76 | 77 | return adoptionInstance.getAdopters.call(); 78 | }).then(function(adopters) { 79 | for (i = 0; i < adopters.length; i++) { 80 | if (adopters[i] !== '0x0000000000000000000000000000000000000000') { 81 | $('.panel-pet').eq(i).find('button').text('Success').attr('disabled', true); 82 | } 83 | } 84 | }).catch(function(err) { 85 | console.log(err.message); 86 | }); 87 | }, 88 | 89 | handleAdopt: function(event) { 90 | event.preventDefault(); 91 | 92 | var petId = parseInt($(event.target).data('id')); 93 | 94 | var adoptionInstance; 95 | 96 | web3.eth.getAccounts(function(error, accounts) { 97 | if (error) { 98 | console.log(error); 99 | } 100 | 101 | var account = accounts[0]; 102 | 103 | App.contracts.Adoption.deployed().then(function(instance) { 104 | adoptionInstance = instance; 105 | 106 | // Execute adopt as a transaction by sending account 107 | return adoptionInstance.adopt(petId, {from: account}); 108 | }).then(function(result) { 109 | return App.markAdopted(); 110 | }).catch(function(err) { 111 | console.log(err.message); 112 | }); 113 | }); 114 | } 115 | 116 | }; 117 | 118 | $(function() { 119 | $(window).load(function() { 120 | App.init(); 121 | }); 122 | }); 123 | -------------------------------------------------------------------------------- /ejercicio_3/ejercicio3.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 3 2 | 3 | Primero nos conectamos a la red Rinkeby, para ello usamos el comando: 4 | ```console 5 | geth --rinkeby 6 | ``` 7 | Para obtener el bloque genesis: 8 | ```console 9 | admin.nodeInfo 10 | ``` 11 | ```console 12 | { 13 | enode: "enode://61dab53c48695c62c46433724d71fa3c966d0b56932427a77a1e08752c985d89b125b8ca2161305041fe8ddfd9cd2de0639589d32582fa207704bd5a6fa78445@127.0.0.1:30304", 14 | enr: "0xf896b840da2c34e09c6f9602f35b9f5665052bd50a4d9655103653e3fb0a98445840e4b9147cfa9901d71190bdfe0f38592bf77bd89d88e83ecc46ce5a4d57d1ef2dc4f70883636170c6c5836574683f826964827634826970847f00000189736563703235366b31a10361dab53c48695c62c46433724d71fa3c966d0b56932427a77a1e08752c985d898374637082766083756470827660", 15 | id: "79e31826a5afbe6f0531b2cec224ebd114207133235743d4652c89a1a4f95819", 16 | ip: "127.0.0.1", 17 | listenAddr: "[::]:30304", 18 | name: "Geth/v1.8.27-stable-4bcc0a37/linux-amd64/go1.10.4", 19 | ports: { 20 | discovery: 30304, 21 | listener: 30304 22 | }, 23 | protocols: { 24 | eth: { 25 | config: { 26 | byzantiumBlock: 4370000, 27 | chainId: 1, 28 | constantinopleBlock: 7280000, 29 | daoForkBlock: 1920000, 30 | daoForkSupport: true, 31 | eip150Block: 2463000, 32 | eip150Hash: "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", 33 | eip155Block: 2675000, 34 | eip158Block: 2675000, 35 | ethash: {}, 36 | homesteadBlock: 1150000, 37 | petersburgBlock: 7280000 38 | }, 39 | difficulty: 17179869184, 40 | **genesis: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",** 41 | head: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3", 42 | network: 1 43 | } 44 | } 45 | } 46 | ``` 47 | 48 | 49 | Para obtener los peers a los que estoy conectado he utilizado el siguiente comando: 50 | ```console 51 | web3.net.peerCount 52 | ``` 53 | 54 | Para obtener información sobre ellos he utilizado: 55 | 56 | admin.peers 57 | ```javascript 58 | Lo cual ha devuelto: 59 | 60 | [{ 61 | caps: ["eth/62", "eth/63"], 62 | enode: "enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303", 63 | id: "1aabba770181eef1b399df4e4177cfc797a1ef5efb0bf961f455c6cab30bee5f", 64 | name: "Geth/v1.9.0-unstable-2da6d1e0-20190613/linux-amd64/go1.12", 65 | network: { 66 | inbound: false, 67 | localAddress: "192.168.1.39:51290", 68 | remoteAddress: "52.3.158.184:30303", 69 | static: false, 70 | trusted: false 71 | }, 72 | protocols: { 73 | eth: { 74 | difficulty: 8349139, 75 | head: "0x2693f50368c97447f385cf61b883f7c411fbf7dda5be9ef3d46af347c9cae284", 76 | version: 63 77 | } 78 | } 79 | }, { 80 | caps: ["eth/62", "eth/63", "les/2"], 81 | enode: "enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", 82 | id: "56483dbe3073c57241c3f128a6ca1c4018347cc0afd0ea1db6773c7e2794698b", 83 | name: "Geth/v1.9.0-unstable-97d36156-20190517/linux-amd64/go1.12.5", 84 | network: { 85 | inbound: false, 86 | localAddress: "192.168.1.39:38252", 87 | remoteAddress: "159.89.28.211:30303", 88 | static: false, 89 | trusted: false 90 | }, 91 | protocols: { 92 | eth: { 93 | difficulty: 8156838, 94 | head: "0x4efb29b6cbdebd02e9d8cc642f59ba88e4a4503730702e7a26e41014ab4159c9", 95 | version: 63 96 | } 97 | } 98 | }, { 99 | caps: ["eth/62", "eth/63", "les/2", "les/3"], 100 | enode: "enode://59f9c651a31269aa802e5f62c5ec91b6de5faf7b8ef4d96382febe896b830284682659aae158d3650ff99b198f889f7c7c032b885c4551ea2d2d6c772343e962@52.236.164.12:30303", 101 | id: "c65b921f9a2230edec169bd18f2eb8b040b7a9ab95421d1ac4e0a969fa3eee77", 102 | name: "Geth/v1.9.0-unstable-79c90dce-20190613/linux-amd64/go1.10.4", 103 | network: { 104 | inbound: false, 105 | localAddress: "192.168.1.39:38216", 106 | remoteAddress: "52.236.164.12:30303", 107 | static: false, 108 | trusted: false 109 | }, 110 | protocols: { 111 | eth: { 112 | difficulty: 8349119, 113 | head: "0xd3737b661cfdf5bca89f97cee4765be4ddf1f47c98d14b916fea72cee802cfeb", 114 | version: 63 115 | } 116 | } 117 | }, { 118 | caps: ["eth/62", "eth/63"], 119 | enode: "enode://3d5659c962081fc3a9b17d28a9cceaa06bfa2233e07db0df27fff235a126200af59a86768c139c61e6285e8c901ad9f598e14dad24cff49f31c89f16c7e6ceb7@69.127.0.122:30303", 120 | id: "e3d83346cf1286f83429c4e62809ae4ef40ddd16610ecf77803ab20917f3221f", 121 | name: "Geth/v1.8.27-stable/darwin-amd64/go1.12.5", 122 | network: { 123 | inbound: false, 124 | localAddress: "192.168.1.39:45886", 125 | remoteAddress: "69.127.0.122:30303", 126 | static: false, 127 | trusted: false 128 | }, 129 | protocols: { 130 | eth: { 131 | difficulty: 8349145, 132 | head: "0xc878b3e83ae86956ff96ec68cbfa747d43f400a142966d8f990bb09ba6a4b5c9", 133 | version: 63 134 | } 135 | } 136 | }] 137 | ``` 138 | Por último para añadir manualmente un bootnode: 139 | ```console 140 | bootnode --genkey=boot.key 141 | bootnode --nodekey=boot.key 142 | ``` 143 | Siendo la respuesta: 144 | ```console 145 | INFO [06-15|19:23:24.310] New local node record seq=1 id=45c0696cac56563c ip= udp=0 tcp=0 146 | ``` 147 | 148 | -------------------------------------------------------------------------------- /ejercicio_4/ejercicio4.md: -------------------------------------------------------------------------------- 1 | # Ejercicio 4 2 | 3 | Primero se instala el compilador de solidity con el comando: 4 | 5 | sudo snap install solc 6 | 7 | -Códigos de operación del contrato inteligente. 8 | ```console 9 | solc --optimize --opcodes Purchase.sol 10 | ``` 11 | **Respuesta** 12 | 13 | ```console 14 | ======= Purchase.sol:Purchase ======= 15 | Opcodes: 16 | PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x1 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND CALLER OR SWAP1 SSTORE PUSH1 0x2 CALLVALUE DIV PUSH1 0x0 DUP2 SWAP1 SSTORE PUSH1 0x2 MUL CALLVALUE EQ PUSH2 0x8F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56616C75652068617320746F206265206576656E2E0000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x535 DUP1 PUSH2 0x9E PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x70 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7150D8AE GT PUSH2 0x4E JUMPI DUP1 PUSH4 0x7150D8AE EQ PUSH2 0xE4 JUMPI DUP1 PUSH4 0x73FAC6F0 EQ PUSH2 0xF9 JUMPI DUP1 PUSH4 0xC19D93FB EQ PUSH2 0x10E JUMPI DUP1 PUSH4 0xD6960697 EQ PUSH2 0x147 JUMPI PUSH2 0x70 JUMP JUMPDEST DUP1 PUSH4 0x8551A53 EQ PUSH2 0x75 JUMPI DUP1 PUSH4 0x35A063B4 EQ PUSH2 0xA6 JUMPI DUP1 PUSH4 0x3FA4F245 EQ PUSH2 0xBD JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8A PUSH2 0x14F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBB PUSH2 0x15E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xC9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x2A6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8A PUSH2 0x2AC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x105 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBB PUSH2 0x2BB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x123 PUSH2 0x434 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH1 0x2 DUP2 GT ISZERO PUSH2 0x133 JUMPI INVALID JUMPDEST PUSH1 0xFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xBB PUSH2 0x444 JUMP JUMPDEST PUSH1 0x1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x1C0 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0xE5 SHL PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F6E6C792073656C6C65722063616E2063616C6C20746869732E000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH1 0xFF AND SWAP1 DUP2 GT ISZERO PUSH2 0x1DB JUMPI INVALID JUMPDEST EQ PUSH2 0x224 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0xE5 SHL PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x1 PUSH1 0x91 SHL PUSH14 0x24B73B30B634B21039BA30BA3297 MUL PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x72C874AEFF0B183A56E2B79C71B46E1AED4DEE5E09862134B8821BA2FDDBF8BF SWAP1 PUSH1 0x0 SWAP1 LOG1 PUSH1 0x2 DUP1 SLOAD DUP2 SWAP1 PUSH1 0x1 PUSH1 0xA0 SHL PUSH1 0xFF MUL NOT AND PUSH1 0x1 PUSH1 0xA0 SHL DUP3 MUL OR SWAP1 SSTORE POP PUSH1 0x1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 ADDRESS BALANCE DUP1 ISZERO PUSH2 0x8FC MUL SWAP2 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x2A2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x31D JUMPI PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0xE5 SHL PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F6E6C792062757965722063616E2063616C6C20746869732E00000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH1 0xFF AND SWAP1 DUP2 GT ISZERO PUSH2 0x338 JUMPI INVALID JUMPDEST EQ PUSH2 0x381 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0xE5 SHL PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x1 PUSH1 0x91 SHL PUSH14 0x24B73B30B634B21039BA30BA3297 MUL PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xE89152ACD703C9D8C7D28829D443260B411454D45394E7995815140C8CBCBCF7 SWAP1 PUSH1 0x0 SWAP1 LOG1 PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL PUSH1 0xFF MUL NOT AND PUSH1 0x1 PUSH1 0xA1 SHL OR SWAP1 DUP2 SWAP1 SSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP4 AND SWAP3 DUP2 ISZERO PUSH2 0x8FC MUL SWAP3 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x3F9 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH1 0x1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 ADDRESS BALANCE DUP1 ISZERO PUSH2 0x8FC MUL SWAP2 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x2A2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH1 0xFF AND SWAP1 DUP2 GT ISZERO PUSH2 0x45F JUMPI INVALID JUMPDEST EQ PUSH2 0x4A8 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0xE5 SHL PUSH3 0x461BCD MUL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xE PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x1 PUSH1 0x91 SHL PUSH14 0x24B73B30B634B21039BA30BA3297 MUL PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x2 MUL CALLVALUE EQ DUP1 PUSH2 0x4BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xD5D55C8A68912E9A110618DF8D5E2E83B8D83211C57A8DDD1203DF92885DC881 SWAP1 PUSH1 0x0 SWAP1 LOG1 POP POP PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND CALLER OR PUSH1 0x1 PUSH1 0xA0 SHL PUSH1 0xFF MUL NOT AND PUSH1 0x1 PUSH1 0xA0 SHL OR SWAP1 SSTORE JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 0x4c 0x26 0xa6 0x24 PUSH31 0xB8A454EF86614A08E4FBF4BFC8D84F0808BC0D519B1F776BA7100D00290000 17 | ``` 18 | 19 | 20 | -Identificadores de las funciones que existan dentro del contrato inteligente. 21 | 22 | ```console 23 | solc --optimize --hashes Purchase.sol 24 | ``` 25 | **Respuesta** 26 | ```console 27 | ======= Purchase.sol:Purchase ======= 28 | Function signatures: 29 | 35a063b4: abort() 30 | 7150d8ae: buyer() 31 | d6960697: confirmPurchase() 32 | 73fac6f0: confirmReceived() 33 | 08551a53: seller() 34 | c19d93fb: state() 35 | 3fa4f245: value() 36 | ``` 37 | 38 | -Estimación del gas utilizado por cada función 39 | 40 | ```console 41 | solc --optimize --gas Purchase.sol 42 | ``` 43 | 44 | **Respuesta** 45 | ```console 46 | ======= Purchase.sol:Purchase ======= 47 | Gas estimation: 48 | construction: 49 | 40563 + 266600 = 307163 50 | external: 51 | abort(): infinite 52 | buyer(): 437 53 | confirmPurchase(): 21739 54 | confirmReceived(): infinite 55 | seller(): 438 56 | state(): 504 57 | value(): 443 58 | ``` 59 | -------------------------------------------------------------------------------- /PEC2/ejercicio_2/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); -------------------------------------------------------------------------------- /PEC2/ejercicio_2/build/contracts/Adoption.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Adoption", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [ 7 | { 8 | "name": "", 9 | "type": "uint256" 10 | } 11 | ], 12 | "name": "adopters", 13 | "outputs": [ 14 | { 15 | "name": "", 16 | "type": "address" 17 | } 18 | ], 19 | "payable": false, 20 | "stateMutability": "view", 21 | "type": "function" 22 | }, 23 | { 24 | "constant": false, 25 | "inputs": [ 26 | { 27 | "name": "petId", 28 | "type": "uint256" 29 | } 30 | ], 31 | "name": "adopt", 32 | "outputs": [ 33 | { 34 | "name": "", 35 | "type": "uint256" 36 | } 37 | ], 38 | "payable": false, 39 | "stateMutability": "nonpayable", 40 | "type": "function" 41 | }, 42 | { 43 | "constant": true, 44 | "inputs": [], 45 | "name": "getAdopters", 46 | "outputs": [ 47 | { 48 | "name": "", 49 | "type": "address[16]" 50 | } 51 | ], 52 | "payable": false, 53 | "stateMutability": "view", 54 | "type": "function" 55 | } 56 | ], 57 | "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"getAdopters\",\"outputs\":[{\"name\":\"\",\"type\":\"address[16]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"adopters\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"petId\",\"type\":\"uint256\"}],\"name\":\"adopt\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/adri/Proyectos/pet-shop-tutorial/contracts/Adoption.sol\":\"Adoption\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/adri/Proyectos/pet-shop-tutorial/contracts/Adoption.sol\":{\"keccak256\":\"0x40fa1726ed2ad351b7ff0c7cb87cc8d71214611047c43fe00c6fe94c1a0d4a03\",\"urls\":[\"bzzr://b919f094d78492c82418bee6d4736a7329b5b4aa3e117ad7124857cc3c25fa7b\"]}},\"version\":1}", 58 | "bytecode": "0x608060405234801561001057600080fd5b506102b0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80633de4eb171461004657806343ae80d31461008c5780638588b2c5146100fa575b600080fd5b61004e61013c565b6040518082601060200280838360005b8381101561007957808201518184015260208101905061005e565b5050505090500191505060405180910390f35b6100b8600480360360208110156100a257600080fd5b81019080803590602001909291905050506101bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101266004803603602081101561011057600080fd5b81019080803590602001909291905050506101f0565b6040518082815260200191505060405180910390f35b610144610261565b60006010806020026040519081016040528092919082601080156101b3576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610169575b5050505050905090565b600081601081106101ca57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082101580156102035750600f8211155b61020c57600080fd5b336000836010811061021a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b60405180610200016040528060109060208202803883398082019150509050509056fea165627a7a72305820649c319998dbcff56470bcb1ca06c7d44ac8d4127cf2b6375f940eb33574f6ef0029", 59 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80633de4eb171461004657806343ae80d31461008c5780638588b2c5146100fa575b600080fd5b61004e61013c565b6040518082601060200280838360005b8381101561007957808201518184015260208101905061005e565b5050505090500191505060405180910390f35b6100b8600480360360208110156100a257600080fd5b81019080803590602001909291905050506101bd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101266004803603602081101561011057600080fd5b81019080803590602001909291905050506101f0565b6040518082815260200191505060405180910390f35b610144610261565b60006010806020026040519081016040528092919082601080156101b3576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610169575b5050505050905090565b600081601081106101ca57fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082101580156102035750600f8211155b61020c57600080fd5b336000836010811061021a57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b60405180610200016040528060109060208202803883398082019150509050509056fea165627a7a72305820649c319998dbcff56470bcb1ca06c7d44ac8d4127cf2b6375f940eb33574f6ef0029", 60 | "sourceMap": "25:328:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:328:0;;;;;;;", 61 | "deployedSourceMap": "25:328:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:328:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;262:86;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;262:86:0;;;;;;;;;;;;;;;;45:27;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;45:27:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;93:140;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;93:140:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;262:86;306:18;;:::i;:::-;337:8;330:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;262:86;:::o;45:27::-;;;;;;;;;;;;;;;;;;;;;;;:::o;93:140::-;136:4;163:1;154:5;:10;;:25;;;;;177:2;168:5;:11;;154:25;146:34;;;;;;203:10;185:8;194:5;185:15;;;;;;;;;:28;;;;;;;;;;;;;;;;;;225:5;218:12;;93:140;;;:::o;25:328::-;;;;;;;;;;;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;25:328:0;;;;:::o", 62 | "source": "pragma solidity ^0.5.0;\n\ncontract Adoption {\naddress[16] public adopters;\n\n// Adopting a pet\nfunction adopt(uint petId) public returns (uint) {\n require(petId >= 0 && petId <= 15);\n\n adopters[petId] = msg.sender;\n\n return petId;\n}\n\n// Retrieving the adopters\nfunction getAdopters() public view returns (address[16] memory) {\n return adopters;\n}\n\n\n\n}", 63 | "sourcePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Adoption.sol", 64 | "ast": { 65 | "absolutePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Adoption.sol", 66 | "exportedSymbols": { 67 | "Adoption": [ 68 | 43 69 | ] 70 | }, 71 | "id": 44, 72 | "nodeType": "SourceUnit", 73 | "nodes": [ 74 | { 75 | "id": 1, 76 | "literals": [ 77 | "solidity", 78 | "^", 79 | "0.5", 80 | ".0" 81 | ], 82 | "nodeType": "PragmaDirective", 83 | "src": "0:23:0" 84 | }, 85 | { 86 | "baseContracts": [], 87 | "contractDependencies": [], 88 | "contractKind": "contract", 89 | "documentation": null, 90 | "fullyImplemented": true, 91 | "id": 43, 92 | "linearizedBaseContracts": [ 93 | 43 94 | ], 95 | "name": "Adoption", 96 | "nodeType": "ContractDefinition", 97 | "nodes": [ 98 | { 99 | "constant": false, 100 | "id": 5, 101 | "name": "adopters", 102 | "nodeType": "VariableDeclaration", 103 | "scope": 43, 104 | "src": "45:27:0", 105 | "stateVariable": true, 106 | "storageLocation": "default", 107 | "typeDescriptions": { 108 | "typeIdentifier": "t_array$_t_address_$16_storage", 109 | "typeString": "address[16]" 110 | }, 111 | "typeName": { 112 | "baseType": { 113 | "id": 2, 114 | "name": "address", 115 | "nodeType": "ElementaryTypeName", 116 | "src": "45:7:0", 117 | "stateMutability": "nonpayable", 118 | "typeDescriptions": { 119 | "typeIdentifier": "t_address", 120 | "typeString": "address" 121 | } 122 | }, 123 | "id": 4, 124 | "length": { 125 | "argumentTypes": null, 126 | "hexValue": "3136", 127 | "id": 3, 128 | "isConstant": false, 129 | "isLValue": false, 130 | "isPure": true, 131 | "kind": "number", 132 | "lValueRequested": false, 133 | "nodeType": "Literal", 134 | "src": "53:2:0", 135 | "subdenomination": null, 136 | "typeDescriptions": { 137 | "typeIdentifier": "t_rational_16_by_1", 138 | "typeString": "int_const 16" 139 | }, 140 | "value": "16" 141 | }, 142 | "nodeType": "ArrayTypeName", 143 | "src": "45:11:0", 144 | "typeDescriptions": { 145 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 146 | "typeString": "address[16]" 147 | } 148 | }, 149 | "value": null, 150 | "visibility": "public" 151 | }, 152 | { 153 | "body": { 154 | "id": 31, 155 | "nodeType": "Block", 156 | "src": "142:91:0", 157 | "statements": [ 158 | { 159 | "expression": { 160 | "argumentTypes": null, 161 | "arguments": [ 162 | { 163 | "argumentTypes": null, 164 | "commonType": { 165 | "typeIdentifier": "t_bool", 166 | "typeString": "bool" 167 | }, 168 | "id": 19, 169 | "isConstant": false, 170 | "isLValue": false, 171 | "isPure": false, 172 | "lValueRequested": false, 173 | "leftExpression": { 174 | "argumentTypes": null, 175 | "commonType": { 176 | "typeIdentifier": "t_uint256", 177 | "typeString": "uint256" 178 | }, 179 | "id": 15, 180 | "isConstant": false, 181 | "isLValue": false, 182 | "isPure": false, 183 | "lValueRequested": false, 184 | "leftExpression": { 185 | "argumentTypes": null, 186 | "id": 13, 187 | "name": "petId", 188 | "nodeType": "Identifier", 189 | "overloadedDeclarations": [], 190 | "referencedDeclaration": 7, 191 | "src": "154:5:0", 192 | "typeDescriptions": { 193 | "typeIdentifier": "t_uint256", 194 | "typeString": "uint256" 195 | } 196 | }, 197 | "nodeType": "BinaryOperation", 198 | "operator": ">=", 199 | "rightExpression": { 200 | "argumentTypes": null, 201 | "hexValue": "30", 202 | "id": 14, 203 | "isConstant": false, 204 | "isLValue": false, 205 | "isPure": true, 206 | "kind": "number", 207 | "lValueRequested": false, 208 | "nodeType": "Literal", 209 | "src": "163:1:0", 210 | "subdenomination": null, 211 | "typeDescriptions": { 212 | "typeIdentifier": "t_rational_0_by_1", 213 | "typeString": "int_const 0" 214 | }, 215 | "value": "0" 216 | }, 217 | "src": "154:10:0", 218 | "typeDescriptions": { 219 | "typeIdentifier": "t_bool", 220 | "typeString": "bool" 221 | } 222 | }, 223 | "nodeType": "BinaryOperation", 224 | "operator": "&&", 225 | "rightExpression": { 226 | "argumentTypes": null, 227 | "commonType": { 228 | "typeIdentifier": "t_uint256", 229 | "typeString": "uint256" 230 | }, 231 | "id": 18, 232 | "isConstant": false, 233 | "isLValue": false, 234 | "isPure": false, 235 | "lValueRequested": false, 236 | "leftExpression": { 237 | "argumentTypes": null, 238 | "id": 16, 239 | "name": "petId", 240 | "nodeType": "Identifier", 241 | "overloadedDeclarations": [], 242 | "referencedDeclaration": 7, 243 | "src": "168:5:0", 244 | "typeDescriptions": { 245 | "typeIdentifier": "t_uint256", 246 | "typeString": "uint256" 247 | } 248 | }, 249 | "nodeType": "BinaryOperation", 250 | "operator": "<=", 251 | "rightExpression": { 252 | "argumentTypes": null, 253 | "hexValue": "3135", 254 | "id": 17, 255 | "isConstant": false, 256 | "isLValue": false, 257 | "isPure": true, 258 | "kind": "number", 259 | "lValueRequested": false, 260 | "nodeType": "Literal", 261 | "src": "177:2:0", 262 | "subdenomination": null, 263 | "typeDescriptions": { 264 | "typeIdentifier": "t_rational_15_by_1", 265 | "typeString": "int_const 15" 266 | }, 267 | "value": "15" 268 | }, 269 | "src": "168:11:0", 270 | "typeDescriptions": { 271 | "typeIdentifier": "t_bool", 272 | "typeString": "bool" 273 | } 274 | }, 275 | "src": "154:25:0", 276 | "typeDescriptions": { 277 | "typeIdentifier": "t_bool", 278 | "typeString": "bool" 279 | } 280 | } 281 | ], 282 | "expression": { 283 | "argumentTypes": [ 284 | { 285 | "typeIdentifier": "t_bool", 286 | "typeString": "bool" 287 | } 288 | ], 289 | "id": 12, 290 | "name": "require", 291 | "nodeType": "Identifier", 292 | "overloadedDeclarations": [ 293 | 118, 294 | 119 295 | ], 296 | "referencedDeclaration": 118, 297 | "src": "146:7:0", 298 | "typeDescriptions": { 299 | "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", 300 | "typeString": "function (bool) pure" 301 | } 302 | }, 303 | "id": 20, 304 | "isConstant": false, 305 | "isLValue": false, 306 | "isPure": false, 307 | "kind": "functionCall", 308 | "lValueRequested": false, 309 | "names": [], 310 | "nodeType": "FunctionCall", 311 | "src": "146:34:0", 312 | "typeDescriptions": { 313 | "typeIdentifier": "t_tuple$__$", 314 | "typeString": "tuple()" 315 | } 316 | }, 317 | "id": 21, 318 | "nodeType": "ExpressionStatement", 319 | "src": "146:34:0" 320 | }, 321 | { 322 | "expression": { 323 | "argumentTypes": null, 324 | "id": 27, 325 | "isConstant": false, 326 | "isLValue": false, 327 | "isPure": false, 328 | "lValueRequested": false, 329 | "leftHandSide": { 330 | "argumentTypes": null, 331 | "baseExpression": { 332 | "argumentTypes": null, 333 | "id": 22, 334 | "name": "adopters", 335 | "nodeType": "Identifier", 336 | "overloadedDeclarations": [], 337 | "referencedDeclaration": 5, 338 | "src": "185:8:0", 339 | "typeDescriptions": { 340 | "typeIdentifier": "t_array$_t_address_$16_storage", 341 | "typeString": "address[16] storage ref" 342 | } 343 | }, 344 | "id": 24, 345 | "indexExpression": { 346 | "argumentTypes": null, 347 | "id": 23, 348 | "name": "petId", 349 | "nodeType": "Identifier", 350 | "overloadedDeclarations": [], 351 | "referencedDeclaration": 7, 352 | "src": "194:5:0", 353 | "typeDescriptions": { 354 | "typeIdentifier": "t_uint256", 355 | "typeString": "uint256" 356 | } 357 | }, 358 | "isConstant": false, 359 | "isLValue": true, 360 | "isPure": false, 361 | "lValueRequested": true, 362 | "nodeType": "IndexAccess", 363 | "src": "185:15:0", 364 | "typeDescriptions": { 365 | "typeIdentifier": "t_address", 366 | "typeString": "address" 367 | } 368 | }, 369 | "nodeType": "Assignment", 370 | "operator": "=", 371 | "rightHandSide": { 372 | "argumentTypes": null, 373 | "expression": { 374 | "argumentTypes": null, 375 | "id": 25, 376 | "name": "msg", 377 | "nodeType": "Identifier", 378 | "overloadedDeclarations": [], 379 | "referencedDeclaration": 115, 380 | "src": "203:3:0", 381 | "typeDescriptions": { 382 | "typeIdentifier": "t_magic_message", 383 | "typeString": "msg" 384 | } 385 | }, 386 | "id": 26, 387 | "isConstant": false, 388 | "isLValue": false, 389 | "isPure": false, 390 | "lValueRequested": false, 391 | "memberName": "sender", 392 | "nodeType": "MemberAccess", 393 | "referencedDeclaration": null, 394 | "src": "203:10:0", 395 | "typeDescriptions": { 396 | "typeIdentifier": "t_address_payable", 397 | "typeString": "address payable" 398 | } 399 | }, 400 | "src": "185:28:0", 401 | "typeDescriptions": { 402 | "typeIdentifier": "t_address", 403 | "typeString": "address" 404 | } 405 | }, 406 | "id": 28, 407 | "nodeType": "ExpressionStatement", 408 | "src": "185:28:0" 409 | }, 410 | { 411 | "expression": { 412 | "argumentTypes": null, 413 | "id": 29, 414 | "name": "petId", 415 | "nodeType": "Identifier", 416 | "overloadedDeclarations": [], 417 | "referencedDeclaration": 7, 418 | "src": "225:5:0", 419 | "typeDescriptions": { 420 | "typeIdentifier": "t_uint256", 421 | "typeString": "uint256" 422 | } 423 | }, 424 | "functionReturnParameters": 11, 425 | "id": 30, 426 | "nodeType": "Return", 427 | "src": "218:12:0" 428 | } 429 | ] 430 | }, 431 | "documentation": null, 432 | "id": 32, 433 | "implemented": true, 434 | "kind": "function", 435 | "modifiers": [], 436 | "name": "adopt", 437 | "nodeType": "FunctionDefinition", 438 | "parameters": { 439 | "id": 8, 440 | "nodeType": "ParameterList", 441 | "parameters": [ 442 | { 443 | "constant": false, 444 | "id": 7, 445 | "name": "petId", 446 | "nodeType": "VariableDeclaration", 447 | "scope": 32, 448 | "src": "108:10:0", 449 | "stateVariable": false, 450 | "storageLocation": "default", 451 | "typeDescriptions": { 452 | "typeIdentifier": "t_uint256", 453 | "typeString": "uint256" 454 | }, 455 | "typeName": { 456 | "id": 6, 457 | "name": "uint", 458 | "nodeType": "ElementaryTypeName", 459 | "src": "108:4:0", 460 | "typeDescriptions": { 461 | "typeIdentifier": "t_uint256", 462 | "typeString": "uint256" 463 | } 464 | }, 465 | "value": null, 466 | "visibility": "internal" 467 | } 468 | ], 469 | "src": "107:12:0" 470 | }, 471 | "returnParameters": { 472 | "id": 11, 473 | "nodeType": "ParameterList", 474 | "parameters": [ 475 | { 476 | "constant": false, 477 | "id": 10, 478 | "name": "", 479 | "nodeType": "VariableDeclaration", 480 | "scope": 32, 481 | "src": "136:4:0", 482 | "stateVariable": false, 483 | "storageLocation": "default", 484 | "typeDescriptions": { 485 | "typeIdentifier": "t_uint256", 486 | "typeString": "uint256" 487 | }, 488 | "typeName": { 489 | "id": 9, 490 | "name": "uint", 491 | "nodeType": "ElementaryTypeName", 492 | "src": "136:4:0", 493 | "typeDescriptions": { 494 | "typeIdentifier": "t_uint256", 495 | "typeString": "uint256" 496 | } 497 | }, 498 | "value": null, 499 | "visibility": "internal" 500 | } 501 | ], 502 | "src": "135:6:0" 503 | }, 504 | "scope": 43, 505 | "src": "93:140:0", 506 | "stateMutability": "nonpayable", 507 | "superFunction": null, 508 | "visibility": "public" 509 | }, 510 | { 511 | "body": { 512 | "id": 41, 513 | "nodeType": "Block", 514 | "src": "326:22:0", 515 | "statements": [ 516 | { 517 | "expression": { 518 | "argumentTypes": null, 519 | "id": 39, 520 | "name": "adopters", 521 | "nodeType": "Identifier", 522 | "overloadedDeclarations": [], 523 | "referencedDeclaration": 5, 524 | "src": "337:8:0", 525 | "typeDescriptions": { 526 | "typeIdentifier": "t_array$_t_address_$16_storage", 527 | "typeString": "address[16] storage ref" 528 | } 529 | }, 530 | "functionReturnParameters": 38, 531 | "id": 40, 532 | "nodeType": "Return", 533 | "src": "330:15:0" 534 | } 535 | ] 536 | }, 537 | "documentation": null, 538 | "id": 42, 539 | "implemented": true, 540 | "kind": "function", 541 | "modifiers": [], 542 | "name": "getAdopters", 543 | "nodeType": "FunctionDefinition", 544 | "parameters": { 545 | "id": 33, 546 | "nodeType": "ParameterList", 547 | "parameters": [], 548 | "src": "282:2:0" 549 | }, 550 | "returnParameters": { 551 | "id": 38, 552 | "nodeType": "ParameterList", 553 | "parameters": [ 554 | { 555 | "constant": false, 556 | "id": 37, 557 | "name": "", 558 | "nodeType": "VariableDeclaration", 559 | "scope": 42, 560 | "src": "306:18:0", 561 | "stateVariable": false, 562 | "storageLocation": "memory", 563 | "typeDescriptions": { 564 | "typeIdentifier": "t_array$_t_address_$16_memory_ptr", 565 | "typeString": "address[16]" 566 | }, 567 | "typeName": { 568 | "baseType": { 569 | "id": 34, 570 | "name": "address", 571 | "nodeType": "ElementaryTypeName", 572 | "src": "306:7:0", 573 | "stateMutability": "nonpayable", 574 | "typeDescriptions": { 575 | "typeIdentifier": "t_address", 576 | "typeString": "address" 577 | } 578 | }, 579 | "id": 36, 580 | "length": { 581 | "argumentTypes": null, 582 | "hexValue": "3136", 583 | "id": 35, 584 | "isConstant": false, 585 | "isLValue": false, 586 | "isPure": true, 587 | "kind": "number", 588 | "lValueRequested": false, 589 | "nodeType": "Literal", 590 | "src": "314:2:0", 591 | "subdenomination": null, 592 | "typeDescriptions": { 593 | "typeIdentifier": "t_rational_16_by_1", 594 | "typeString": "int_const 16" 595 | }, 596 | "value": "16" 597 | }, 598 | "nodeType": "ArrayTypeName", 599 | "src": "306:11:0", 600 | "typeDescriptions": { 601 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 602 | "typeString": "address[16]" 603 | } 604 | }, 605 | "value": null, 606 | "visibility": "internal" 607 | } 608 | ], 609 | "src": "305:20:0" 610 | }, 611 | "scope": 43, 612 | "src": "262:86:0", 613 | "stateMutability": "view", 614 | "superFunction": null, 615 | "visibility": "public" 616 | } 617 | ], 618 | "scope": 44, 619 | "src": "25:328:0" 620 | } 621 | ], 622 | "src": "0:353:0" 623 | }, 624 | "legacyAST": { 625 | "absolutePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Adoption.sol", 626 | "exportedSymbols": { 627 | "Adoption": [ 628 | 43 629 | ] 630 | }, 631 | "id": 44, 632 | "nodeType": "SourceUnit", 633 | "nodes": [ 634 | { 635 | "id": 1, 636 | "literals": [ 637 | "solidity", 638 | "^", 639 | "0.5", 640 | ".0" 641 | ], 642 | "nodeType": "PragmaDirective", 643 | "src": "0:23:0" 644 | }, 645 | { 646 | "baseContracts": [], 647 | "contractDependencies": [], 648 | "contractKind": "contract", 649 | "documentation": null, 650 | "fullyImplemented": true, 651 | "id": 43, 652 | "linearizedBaseContracts": [ 653 | 43 654 | ], 655 | "name": "Adoption", 656 | "nodeType": "ContractDefinition", 657 | "nodes": [ 658 | { 659 | "constant": false, 660 | "id": 5, 661 | "name": "adopters", 662 | "nodeType": "VariableDeclaration", 663 | "scope": 43, 664 | "src": "45:27:0", 665 | "stateVariable": true, 666 | "storageLocation": "default", 667 | "typeDescriptions": { 668 | "typeIdentifier": "t_array$_t_address_$16_storage", 669 | "typeString": "address[16]" 670 | }, 671 | "typeName": { 672 | "baseType": { 673 | "id": 2, 674 | "name": "address", 675 | "nodeType": "ElementaryTypeName", 676 | "src": "45:7:0", 677 | "stateMutability": "nonpayable", 678 | "typeDescriptions": { 679 | "typeIdentifier": "t_address", 680 | "typeString": "address" 681 | } 682 | }, 683 | "id": 4, 684 | "length": { 685 | "argumentTypes": null, 686 | "hexValue": "3136", 687 | "id": 3, 688 | "isConstant": false, 689 | "isLValue": false, 690 | "isPure": true, 691 | "kind": "number", 692 | "lValueRequested": false, 693 | "nodeType": "Literal", 694 | "src": "53:2:0", 695 | "subdenomination": null, 696 | "typeDescriptions": { 697 | "typeIdentifier": "t_rational_16_by_1", 698 | "typeString": "int_const 16" 699 | }, 700 | "value": "16" 701 | }, 702 | "nodeType": "ArrayTypeName", 703 | "src": "45:11:0", 704 | "typeDescriptions": { 705 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 706 | "typeString": "address[16]" 707 | } 708 | }, 709 | "value": null, 710 | "visibility": "public" 711 | }, 712 | { 713 | "body": { 714 | "id": 31, 715 | "nodeType": "Block", 716 | "src": "142:91:0", 717 | "statements": [ 718 | { 719 | "expression": { 720 | "argumentTypes": null, 721 | "arguments": [ 722 | { 723 | "argumentTypes": null, 724 | "commonType": { 725 | "typeIdentifier": "t_bool", 726 | "typeString": "bool" 727 | }, 728 | "id": 19, 729 | "isConstant": false, 730 | "isLValue": false, 731 | "isPure": false, 732 | "lValueRequested": false, 733 | "leftExpression": { 734 | "argumentTypes": null, 735 | "commonType": { 736 | "typeIdentifier": "t_uint256", 737 | "typeString": "uint256" 738 | }, 739 | "id": 15, 740 | "isConstant": false, 741 | "isLValue": false, 742 | "isPure": false, 743 | "lValueRequested": false, 744 | "leftExpression": { 745 | "argumentTypes": null, 746 | "id": 13, 747 | "name": "petId", 748 | "nodeType": "Identifier", 749 | "overloadedDeclarations": [], 750 | "referencedDeclaration": 7, 751 | "src": "154:5:0", 752 | "typeDescriptions": { 753 | "typeIdentifier": "t_uint256", 754 | "typeString": "uint256" 755 | } 756 | }, 757 | "nodeType": "BinaryOperation", 758 | "operator": ">=", 759 | "rightExpression": { 760 | "argumentTypes": null, 761 | "hexValue": "30", 762 | "id": 14, 763 | "isConstant": false, 764 | "isLValue": false, 765 | "isPure": true, 766 | "kind": "number", 767 | "lValueRequested": false, 768 | "nodeType": "Literal", 769 | "src": "163:1:0", 770 | "subdenomination": null, 771 | "typeDescriptions": { 772 | "typeIdentifier": "t_rational_0_by_1", 773 | "typeString": "int_const 0" 774 | }, 775 | "value": "0" 776 | }, 777 | "src": "154:10:0", 778 | "typeDescriptions": { 779 | "typeIdentifier": "t_bool", 780 | "typeString": "bool" 781 | } 782 | }, 783 | "nodeType": "BinaryOperation", 784 | "operator": "&&", 785 | "rightExpression": { 786 | "argumentTypes": null, 787 | "commonType": { 788 | "typeIdentifier": "t_uint256", 789 | "typeString": "uint256" 790 | }, 791 | "id": 18, 792 | "isConstant": false, 793 | "isLValue": false, 794 | "isPure": false, 795 | "lValueRequested": false, 796 | "leftExpression": { 797 | "argumentTypes": null, 798 | "id": 16, 799 | "name": "petId", 800 | "nodeType": "Identifier", 801 | "overloadedDeclarations": [], 802 | "referencedDeclaration": 7, 803 | "src": "168:5:0", 804 | "typeDescriptions": { 805 | "typeIdentifier": "t_uint256", 806 | "typeString": "uint256" 807 | } 808 | }, 809 | "nodeType": "BinaryOperation", 810 | "operator": "<=", 811 | "rightExpression": { 812 | "argumentTypes": null, 813 | "hexValue": "3135", 814 | "id": 17, 815 | "isConstant": false, 816 | "isLValue": false, 817 | "isPure": true, 818 | "kind": "number", 819 | "lValueRequested": false, 820 | "nodeType": "Literal", 821 | "src": "177:2:0", 822 | "subdenomination": null, 823 | "typeDescriptions": { 824 | "typeIdentifier": "t_rational_15_by_1", 825 | "typeString": "int_const 15" 826 | }, 827 | "value": "15" 828 | }, 829 | "src": "168:11:0", 830 | "typeDescriptions": { 831 | "typeIdentifier": "t_bool", 832 | "typeString": "bool" 833 | } 834 | }, 835 | "src": "154:25:0", 836 | "typeDescriptions": { 837 | "typeIdentifier": "t_bool", 838 | "typeString": "bool" 839 | } 840 | } 841 | ], 842 | "expression": { 843 | "argumentTypes": [ 844 | { 845 | "typeIdentifier": "t_bool", 846 | "typeString": "bool" 847 | } 848 | ], 849 | "id": 12, 850 | "name": "require", 851 | "nodeType": "Identifier", 852 | "overloadedDeclarations": [ 853 | 118, 854 | 119 855 | ], 856 | "referencedDeclaration": 118, 857 | "src": "146:7:0", 858 | "typeDescriptions": { 859 | "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", 860 | "typeString": "function (bool) pure" 861 | } 862 | }, 863 | "id": 20, 864 | "isConstant": false, 865 | "isLValue": false, 866 | "isPure": false, 867 | "kind": "functionCall", 868 | "lValueRequested": false, 869 | "names": [], 870 | "nodeType": "FunctionCall", 871 | "src": "146:34:0", 872 | "typeDescriptions": { 873 | "typeIdentifier": "t_tuple$__$", 874 | "typeString": "tuple()" 875 | } 876 | }, 877 | "id": 21, 878 | "nodeType": "ExpressionStatement", 879 | "src": "146:34:0" 880 | }, 881 | { 882 | "expression": { 883 | "argumentTypes": null, 884 | "id": 27, 885 | "isConstant": false, 886 | "isLValue": false, 887 | "isPure": false, 888 | "lValueRequested": false, 889 | "leftHandSide": { 890 | "argumentTypes": null, 891 | "baseExpression": { 892 | "argumentTypes": null, 893 | "id": 22, 894 | "name": "adopters", 895 | "nodeType": "Identifier", 896 | "overloadedDeclarations": [], 897 | "referencedDeclaration": 5, 898 | "src": "185:8:0", 899 | "typeDescriptions": { 900 | "typeIdentifier": "t_array$_t_address_$16_storage", 901 | "typeString": "address[16] storage ref" 902 | } 903 | }, 904 | "id": 24, 905 | "indexExpression": { 906 | "argumentTypes": null, 907 | "id": 23, 908 | "name": "petId", 909 | "nodeType": "Identifier", 910 | "overloadedDeclarations": [], 911 | "referencedDeclaration": 7, 912 | "src": "194:5:0", 913 | "typeDescriptions": { 914 | "typeIdentifier": "t_uint256", 915 | "typeString": "uint256" 916 | } 917 | }, 918 | "isConstant": false, 919 | "isLValue": true, 920 | "isPure": false, 921 | "lValueRequested": true, 922 | "nodeType": "IndexAccess", 923 | "src": "185:15:0", 924 | "typeDescriptions": { 925 | "typeIdentifier": "t_address", 926 | "typeString": "address" 927 | } 928 | }, 929 | "nodeType": "Assignment", 930 | "operator": "=", 931 | "rightHandSide": { 932 | "argumentTypes": null, 933 | "expression": { 934 | "argumentTypes": null, 935 | "id": 25, 936 | "name": "msg", 937 | "nodeType": "Identifier", 938 | "overloadedDeclarations": [], 939 | "referencedDeclaration": 115, 940 | "src": "203:3:0", 941 | "typeDescriptions": { 942 | "typeIdentifier": "t_magic_message", 943 | "typeString": "msg" 944 | } 945 | }, 946 | "id": 26, 947 | "isConstant": false, 948 | "isLValue": false, 949 | "isPure": false, 950 | "lValueRequested": false, 951 | "memberName": "sender", 952 | "nodeType": "MemberAccess", 953 | "referencedDeclaration": null, 954 | "src": "203:10:0", 955 | "typeDescriptions": { 956 | "typeIdentifier": "t_address_payable", 957 | "typeString": "address payable" 958 | } 959 | }, 960 | "src": "185:28:0", 961 | "typeDescriptions": { 962 | "typeIdentifier": "t_address", 963 | "typeString": "address" 964 | } 965 | }, 966 | "id": 28, 967 | "nodeType": "ExpressionStatement", 968 | "src": "185:28:0" 969 | }, 970 | { 971 | "expression": { 972 | "argumentTypes": null, 973 | "id": 29, 974 | "name": "petId", 975 | "nodeType": "Identifier", 976 | "overloadedDeclarations": [], 977 | "referencedDeclaration": 7, 978 | "src": "225:5:0", 979 | "typeDescriptions": { 980 | "typeIdentifier": "t_uint256", 981 | "typeString": "uint256" 982 | } 983 | }, 984 | "functionReturnParameters": 11, 985 | "id": 30, 986 | "nodeType": "Return", 987 | "src": "218:12:0" 988 | } 989 | ] 990 | }, 991 | "documentation": null, 992 | "id": 32, 993 | "implemented": true, 994 | "kind": "function", 995 | "modifiers": [], 996 | "name": "adopt", 997 | "nodeType": "FunctionDefinition", 998 | "parameters": { 999 | "id": 8, 1000 | "nodeType": "ParameterList", 1001 | "parameters": [ 1002 | { 1003 | "constant": false, 1004 | "id": 7, 1005 | "name": "petId", 1006 | "nodeType": "VariableDeclaration", 1007 | "scope": 32, 1008 | "src": "108:10:0", 1009 | "stateVariable": false, 1010 | "storageLocation": "default", 1011 | "typeDescriptions": { 1012 | "typeIdentifier": "t_uint256", 1013 | "typeString": "uint256" 1014 | }, 1015 | "typeName": { 1016 | "id": 6, 1017 | "name": "uint", 1018 | "nodeType": "ElementaryTypeName", 1019 | "src": "108:4:0", 1020 | "typeDescriptions": { 1021 | "typeIdentifier": "t_uint256", 1022 | "typeString": "uint256" 1023 | } 1024 | }, 1025 | "value": null, 1026 | "visibility": "internal" 1027 | } 1028 | ], 1029 | "src": "107:12:0" 1030 | }, 1031 | "returnParameters": { 1032 | "id": 11, 1033 | "nodeType": "ParameterList", 1034 | "parameters": [ 1035 | { 1036 | "constant": false, 1037 | "id": 10, 1038 | "name": "", 1039 | "nodeType": "VariableDeclaration", 1040 | "scope": 32, 1041 | "src": "136:4:0", 1042 | "stateVariable": false, 1043 | "storageLocation": "default", 1044 | "typeDescriptions": { 1045 | "typeIdentifier": "t_uint256", 1046 | "typeString": "uint256" 1047 | }, 1048 | "typeName": { 1049 | "id": 9, 1050 | "name": "uint", 1051 | "nodeType": "ElementaryTypeName", 1052 | "src": "136:4:0", 1053 | "typeDescriptions": { 1054 | "typeIdentifier": "t_uint256", 1055 | "typeString": "uint256" 1056 | } 1057 | }, 1058 | "value": null, 1059 | "visibility": "internal" 1060 | } 1061 | ], 1062 | "src": "135:6:0" 1063 | }, 1064 | "scope": 43, 1065 | "src": "93:140:0", 1066 | "stateMutability": "nonpayable", 1067 | "superFunction": null, 1068 | "visibility": "public" 1069 | }, 1070 | { 1071 | "body": { 1072 | "id": 41, 1073 | "nodeType": "Block", 1074 | "src": "326:22:0", 1075 | "statements": [ 1076 | { 1077 | "expression": { 1078 | "argumentTypes": null, 1079 | "id": 39, 1080 | "name": "adopters", 1081 | "nodeType": "Identifier", 1082 | "overloadedDeclarations": [], 1083 | "referencedDeclaration": 5, 1084 | "src": "337:8:0", 1085 | "typeDescriptions": { 1086 | "typeIdentifier": "t_array$_t_address_$16_storage", 1087 | "typeString": "address[16] storage ref" 1088 | } 1089 | }, 1090 | "functionReturnParameters": 38, 1091 | "id": 40, 1092 | "nodeType": "Return", 1093 | "src": "330:15:0" 1094 | } 1095 | ] 1096 | }, 1097 | "documentation": null, 1098 | "id": 42, 1099 | "implemented": true, 1100 | "kind": "function", 1101 | "modifiers": [], 1102 | "name": "getAdopters", 1103 | "nodeType": "FunctionDefinition", 1104 | "parameters": { 1105 | "id": 33, 1106 | "nodeType": "ParameterList", 1107 | "parameters": [], 1108 | "src": "282:2:0" 1109 | }, 1110 | "returnParameters": { 1111 | "id": 38, 1112 | "nodeType": "ParameterList", 1113 | "parameters": [ 1114 | { 1115 | "constant": false, 1116 | "id": 37, 1117 | "name": "", 1118 | "nodeType": "VariableDeclaration", 1119 | "scope": 42, 1120 | "src": "306:18:0", 1121 | "stateVariable": false, 1122 | "storageLocation": "memory", 1123 | "typeDescriptions": { 1124 | "typeIdentifier": "t_array$_t_address_$16_memory_ptr", 1125 | "typeString": "address[16]" 1126 | }, 1127 | "typeName": { 1128 | "baseType": { 1129 | "id": 34, 1130 | "name": "address", 1131 | "nodeType": "ElementaryTypeName", 1132 | "src": "306:7:0", 1133 | "stateMutability": "nonpayable", 1134 | "typeDescriptions": { 1135 | "typeIdentifier": "t_address", 1136 | "typeString": "address" 1137 | } 1138 | }, 1139 | "id": 36, 1140 | "length": { 1141 | "argumentTypes": null, 1142 | "hexValue": "3136", 1143 | "id": 35, 1144 | "isConstant": false, 1145 | "isLValue": false, 1146 | "isPure": true, 1147 | "kind": "number", 1148 | "lValueRequested": false, 1149 | "nodeType": "Literal", 1150 | "src": "314:2:0", 1151 | "subdenomination": null, 1152 | "typeDescriptions": { 1153 | "typeIdentifier": "t_rational_16_by_1", 1154 | "typeString": "int_const 16" 1155 | }, 1156 | "value": "16" 1157 | }, 1158 | "nodeType": "ArrayTypeName", 1159 | "src": "306:11:0", 1160 | "typeDescriptions": { 1161 | "typeIdentifier": "t_array$_t_address_$16_storage_ptr", 1162 | "typeString": "address[16]" 1163 | } 1164 | }, 1165 | "value": null, 1166 | "visibility": "internal" 1167 | } 1168 | ], 1169 | "src": "305:20:0" 1170 | }, 1171 | "scope": 43, 1172 | "src": "262:86:0", 1173 | "stateMutability": "view", 1174 | "superFunction": null, 1175 | "visibility": "public" 1176 | } 1177 | ], 1178 | "scope": 44, 1179 | "src": "25:328:0" 1180 | } 1181 | ], 1182 | "src": "0:353:0" 1183 | }, 1184 | "compiler": { 1185 | "name": "solc", 1186 | "version": "0.5.8+commit.23d335f2.Emscripten.clang" 1187 | }, 1188 | "networks": { 1189 | "5777": { 1190 | "events": {}, 1191 | "links": {}, 1192 | "address": "0x85efDcC5CFC13F226f894DC31FceFdE9CE314dEd", 1193 | "transactionHash": "0x3897cf5d80c1ba6e526c831360cc4e28aff33883cd9213c6cf613bfe4ac16151" 1194 | } 1195 | }, 1196 | "schemaVersion": "3.0.10", 1197 | "updatedAt": "2019-06-12T17:10:19.273Z", 1198 | "devdoc": { 1199 | "methods": {} 1200 | }, 1201 | "userdoc": { 1202 | "methods": {} 1203 | } 1204 | } -------------------------------------------------------------------------------- /PEC2/ejercicio_2/build/contracts/Migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Migrations", 3 | "abi": [ 4 | { 5 | "constant": true, 6 | "inputs": [], 7 | "name": "last_completed_migration", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "uint256" 12 | } 13 | ], 14 | "payable": false, 15 | "stateMutability": "view", 16 | "type": "function" 17 | }, 18 | { 19 | "constant": true, 20 | "inputs": [], 21 | "name": "owner", 22 | "outputs": [ 23 | { 24 | "name": "", 25 | "type": "address" 26 | } 27 | ], 28 | "payable": false, 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [], 34 | "payable": false, 35 | "stateMutability": "nonpayable", 36 | "type": "constructor" 37 | }, 38 | { 39 | "constant": false, 40 | "inputs": [ 41 | { 42 | "name": "completed", 43 | "type": "uint256" 44 | } 45 | ], 46 | "name": "setCompleted", 47 | "outputs": [], 48 | "payable": false, 49 | "stateMutability": "nonpayable", 50 | "type": "function" 51 | }, 52 | { 53 | "constant": false, 54 | "inputs": [ 55 | { 56 | "name": "new_address", 57 | "type": "address" 58 | } 59 | ], 60 | "name": "upgrade", 61 | "outputs": [], 62 | "payable": false, 63 | "stateMutability": "nonpayable", 64 | "type": "function" 65 | } 66 | ], 67 | "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/adri/Proyectos/pet-shop-tutorial/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/adri/Proyectos/pet-shop-tutorial/contracts/Migrations.sol\":{\"keccak256\":\"0xf65fcb01f4b8ef6909f55bccf7f05ab483d953e671e205d9ce8ea6a9adc3c653\",\"urls\":[\"bzzr://ea0687984a75ca6b8aa89a3ba439fa3123a53421a5b5474320c74ad1174583fc\"]}},\"version\":1}", 68 | "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820eb74c87e014c28ab0621ddd87e3007a650dda001ff4128cb493f7eb98c8e36650029", 69 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820eb74c87e014c28ab0621ddd87e3007a650dda001ff4128cb493f7eb98c8e36650029", 70 | "sourceMap": "25:480:1:-;;;177:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;177:50:1;212:10;204:5;;:18;;;;;;;;;;;;;;;;;;25:480;;;;;;", 71 | "deployedSourceMap": "25:480:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:480:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;338:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;338:165:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;73:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;49:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;231:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;231:103:1;;;;;;;;;;;;;;;;;:::i;:::-;;338:165;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;400:19;433:11;400:45;;451:8;:21;;;473:24;;451:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;451:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;451:47:1;;;;167:1;142:26;338:165;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;231:103::-;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;320:9;293:24;:36;;;;142:26;231:103;:::o", 72 | "source": "pragma solidity ^0.5.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", 73 | "sourcePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Migrations.sol", 74 | "ast": { 75 | "absolutePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Migrations.sol", 76 | "exportedSymbols": { 77 | "Migrations": [ 78 | 100 79 | ] 80 | }, 81 | "id": 101, 82 | "nodeType": "SourceUnit", 83 | "nodes": [ 84 | { 85 | "id": 45, 86 | "literals": [ 87 | "solidity", 88 | "^", 89 | "0.5", 90 | ".0" 91 | ], 92 | "nodeType": "PragmaDirective", 93 | "src": "0:23:1" 94 | }, 95 | { 96 | "baseContracts": [], 97 | "contractDependencies": [], 98 | "contractKind": "contract", 99 | "documentation": null, 100 | "fullyImplemented": true, 101 | "id": 100, 102 | "linearizedBaseContracts": [ 103 | 100 104 | ], 105 | "name": "Migrations", 106 | "nodeType": "ContractDefinition", 107 | "nodes": [ 108 | { 109 | "constant": false, 110 | "id": 47, 111 | "name": "owner", 112 | "nodeType": "VariableDeclaration", 113 | "scope": 100, 114 | "src": "49:20:1", 115 | "stateVariable": true, 116 | "storageLocation": "default", 117 | "typeDescriptions": { 118 | "typeIdentifier": "t_address", 119 | "typeString": "address" 120 | }, 121 | "typeName": { 122 | "id": 46, 123 | "name": "address", 124 | "nodeType": "ElementaryTypeName", 125 | "src": "49:7:1", 126 | "stateMutability": "nonpayable", 127 | "typeDescriptions": { 128 | "typeIdentifier": "t_address", 129 | "typeString": "address" 130 | } 131 | }, 132 | "value": null, 133 | "visibility": "public" 134 | }, 135 | { 136 | "constant": false, 137 | "id": 49, 138 | "name": "last_completed_migration", 139 | "nodeType": "VariableDeclaration", 140 | "scope": 100, 141 | "src": "73:36:1", 142 | "stateVariable": true, 143 | "storageLocation": "default", 144 | "typeDescriptions": { 145 | "typeIdentifier": "t_uint256", 146 | "typeString": "uint256" 147 | }, 148 | "typeName": { 149 | "id": 48, 150 | "name": "uint", 151 | "nodeType": "ElementaryTypeName", 152 | "src": "73:4:1", 153 | "typeDescriptions": { 154 | "typeIdentifier": "t_uint256", 155 | "typeString": "uint256" 156 | } 157 | }, 158 | "value": null, 159 | "visibility": "public" 160 | }, 161 | { 162 | "body": { 163 | "id": 57, 164 | "nodeType": "Block", 165 | "src": "136:37:1", 166 | "statements": [ 167 | { 168 | "condition": { 169 | "argumentTypes": null, 170 | "commonType": { 171 | "typeIdentifier": "t_address", 172 | "typeString": "address" 173 | }, 174 | "id": 54, 175 | "isConstant": false, 176 | "isLValue": false, 177 | "isPure": false, 178 | "lValueRequested": false, 179 | "leftExpression": { 180 | "argumentTypes": null, 181 | "expression": { 182 | "argumentTypes": null, 183 | "id": 51, 184 | "name": "msg", 185 | "nodeType": "Identifier", 186 | "overloadedDeclarations": [], 187 | "referencedDeclaration": 115, 188 | "src": "146:3:1", 189 | "typeDescriptions": { 190 | "typeIdentifier": "t_magic_message", 191 | "typeString": "msg" 192 | } 193 | }, 194 | "id": 52, 195 | "isConstant": false, 196 | "isLValue": false, 197 | "isPure": false, 198 | "lValueRequested": false, 199 | "memberName": "sender", 200 | "nodeType": "MemberAccess", 201 | "referencedDeclaration": null, 202 | "src": "146:10:1", 203 | "typeDescriptions": { 204 | "typeIdentifier": "t_address_payable", 205 | "typeString": "address payable" 206 | } 207 | }, 208 | "nodeType": "BinaryOperation", 209 | "operator": "==", 210 | "rightExpression": { 211 | "argumentTypes": null, 212 | "id": 53, 213 | "name": "owner", 214 | "nodeType": "Identifier", 215 | "overloadedDeclarations": [], 216 | "referencedDeclaration": 47, 217 | "src": "160:5:1", 218 | "typeDescriptions": { 219 | "typeIdentifier": "t_address", 220 | "typeString": "address" 221 | } 222 | }, 223 | "src": "146:19:1", 224 | "typeDescriptions": { 225 | "typeIdentifier": "t_bool", 226 | "typeString": "bool" 227 | } 228 | }, 229 | "falseBody": null, 230 | "id": 56, 231 | "nodeType": "IfStatement", 232 | "src": "142:26:1", 233 | "trueBody": { 234 | "id": 55, 235 | "nodeType": "PlaceholderStatement", 236 | "src": "167:1:1" 237 | } 238 | } 239 | ] 240 | }, 241 | "documentation": null, 242 | "id": 58, 243 | "name": "restricted", 244 | "nodeType": "ModifierDefinition", 245 | "parameters": { 246 | "id": 50, 247 | "nodeType": "ParameterList", 248 | "parameters": [], 249 | "src": "133:2:1" 250 | }, 251 | "src": "114:59:1", 252 | "visibility": "internal" 253 | }, 254 | { 255 | "body": { 256 | "id": 66, 257 | "nodeType": "Block", 258 | "src": "198:29:1", 259 | "statements": [ 260 | { 261 | "expression": { 262 | "argumentTypes": null, 263 | "id": 64, 264 | "isConstant": false, 265 | "isLValue": false, 266 | "isPure": false, 267 | "lValueRequested": false, 268 | "leftHandSide": { 269 | "argumentTypes": null, 270 | "id": 61, 271 | "name": "owner", 272 | "nodeType": "Identifier", 273 | "overloadedDeclarations": [], 274 | "referencedDeclaration": 47, 275 | "src": "204:5:1", 276 | "typeDescriptions": { 277 | "typeIdentifier": "t_address", 278 | "typeString": "address" 279 | } 280 | }, 281 | "nodeType": "Assignment", 282 | "operator": "=", 283 | "rightHandSide": { 284 | "argumentTypes": null, 285 | "expression": { 286 | "argumentTypes": null, 287 | "id": 62, 288 | "name": "msg", 289 | "nodeType": "Identifier", 290 | "overloadedDeclarations": [], 291 | "referencedDeclaration": 115, 292 | "src": "212:3:1", 293 | "typeDescriptions": { 294 | "typeIdentifier": "t_magic_message", 295 | "typeString": "msg" 296 | } 297 | }, 298 | "id": 63, 299 | "isConstant": false, 300 | "isLValue": false, 301 | "isPure": false, 302 | "lValueRequested": false, 303 | "memberName": "sender", 304 | "nodeType": "MemberAccess", 305 | "referencedDeclaration": null, 306 | "src": "212:10:1", 307 | "typeDescriptions": { 308 | "typeIdentifier": "t_address_payable", 309 | "typeString": "address payable" 310 | } 311 | }, 312 | "src": "204:18:1", 313 | "typeDescriptions": { 314 | "typeIdentifier": "t_address", 315 | "typeString": "address" 316 | } 317 | }, 318 | "id": 65, 319 | "nodeType": "ExpressionStatement", 320 | "src": "204:18:1" 321 | } 322 | ] 323 | }, 324 | "documentation": null, 325 | "id": 67, 326 | "implemented": true, 327 | "kind": "constructor", 328 | "modifiers": [], 329 | "name": "", 330 | "nodeType": "FunctionDefinition", 331 | "parameters": { 332 | "id": 59, 333 | "nodeType": "ParameterList", 334 | "parameters": [], 335 | "src": "188:2:1" 336 | }, 337 | "returnParameters": { 338 | "id": 60, 339 | "nodeType": "ParameterList", 340 | "parameters": [], 341 | "src": "198:0:1" 342 | }, 343 | "scope": 100, 344 | "src": "177:50:1", 345 | "stateMutability": "nonpayable", 346 | "superFunction": null, 347 | "visibility": "public" 348 | }, 349 | { 350 | "body": { 351 | "id": 78, 352 | "nodeType": "Block", 353 | "src": "287:47:1", 354 | "statements": [ 355 | { 356 | "expression": { 357 | "argumentTypes": null, 358 | "id": 76, 359 | "isConstant": false, 360 | "isLValue": false, 361 | "isPure": false, 362 | "lValueRequested": false, 363 | "leftHandSide": { 364 | "argumentTypes": null, 365 | "id": 74, 366 | "name": "last_completed_migration", 367 | "nodeType": "Identifier", 368 | "overloadedDeclarations": [], 369 | "referencedDeclaration": 49, 370 | "src": "293:24:1", 371 | "typeDescriptions": { 372 | "typeIdentifier": "t_uint256", 373 | "typeString": "uint256" 374 | } 375 | }, 376 | "nodeType": "Assignment", 377 | "operator": "=", 378 | "rightHandSide": { 379 | "argumentTypes": null, 380 | "id": 75, 381 | "name": "completed", 382 | "nodeType": "Identifier", 383 | "overloadedDeclarations": [], 384 | "referencedDeclaration": 69, 385 | "src": "320:9:1", 386 | "typeDescriptions": { 387 | "typeIdentifier": "t_uint256", 388 | "typeString": "uint256" 389 | } 390 | }, 391 | "src": "293:36:1", 392 | "typeDescriptions": { 393 | "typeIdentifier": "t_uint256", 394 | "typeString": "uint256" 395 | } 396 | }, 397 | "id": 77, 398 | "nodeType": "ExpressionStatement", 399 | "src": "293:36:1" 400 | } 401 | ] 402 | }, 403 | "documentation": null, 404 | "id": 79, 405 | "implemented": true, 406 | "kind": "function", 407 | "modifiers": [ 408 | { 409 | "arguments": null, 410 | "id": 72, 411 | "modifierName": { 412 | "argumentTypes": null, 413 | "id": 71, 414 | "name": "restricted", 415 | "nodeType": "Identifier", 416 | "overloadedDeclarations": [], 417 | "referencedDeclaration": 58, 418 | "src": "276:10:1", 419 | "typeDescriptions": { 420 | "typeIdentifier": "t_modifier$__$", 421 | "typeString": "modifier ()" 422 | } 423 | }, 424 | "nodeType": "ModifierInvocation", 425 | "src": "276:10:1" 426 | } 427 | ], 428 | "name": "setCompleted", 429 | "nodeType": "FunctionDefinition", 430 | "parameters": { 431 | "id": 70, 432 | "nodeType": "ParameterList", 433 | "parameters": [ 434 | { 435 | "constant": false, 436 | "id": 69, 437 | "name": "completed", 438 | "nodeType": "VariableDeclaration", 439 | "scope": 79, 440 | "src": "253:14:1", 441 | "stateVariable": false, 442 | "storageLocation": "default", 443 | "typeDescriptions": { 444 | "typeIdentifier": "t_uint256", 445 | "typeString": "uint256" 446 | }, 447 | "typeName": { 448 | "id": 68, 449 | "name": "uint", 450 | "nodeType": "ElementaryTypeName", 451 | "src": "253:4:1", 452 | "typeDescriptions": { 453 | "typeIdentifier": "t_uint256", 454 | "typeString": "uint256" 455 | } 456 | }, 457 | "value": null, 458 | "visibility": "internal" 459 | } 460 | ], 461 | "src": "252:16:1" 462 | }, 463 | "returnParameters": { 464 | "id": 73, 465 | "nodeType": "ParameterList", 466 | "parameters": [], 467 | "src": "287:0:1" 468 | }, 469 | "scope": 100, 470 | "src": "231:103:1", 471 | "stateMutability": "nonpayable", 472 | "superFunction": null, 473 | "visibility": "public" 474 | }, 475 | { 476 | "body": { 477 | "id": 98, 478 | "nodeType": "Block", 479 | "src": "394:109:1", 480 | "statements": [ 481 | { 482 | "assignments": [ 483 | 87 484 | ], 485 | "declarations": [ 486 | { 487 | "constant": false, 488 | "id": 87, 489 | "name": "upgraded", 490 | "nodeType": "VariableDeclaration", 491 | "scope": 98, 492 | "src": "400:19:1", 493 | "stateVariable": false, 494 | "storageLocation": "default", 495 | "typeDescriptions": { 496 | "typeIdentifier": "t_contract$_Migrations_$100", 497 | "typeString": "contract Migrations" 498 | }, 499 | "typeName": { 500 | "contractScope": null, 501 | "id": 86, 502 | "name": "Migrations", 503 | "nodeType": "UserDefinedTypeName", 504 | "referencedDeclaration": 100, 505 | "src": "400:10:1", 506 | "typeDescriptions": { 507 | "typeIdentifier": "t_contract$_Migrations_$100", 508 | "typeString": "contract Migrations" 509 | } 510 | }, 511 | "value": null, 512 | "visibility": "internal" 513 | } 514 | ], 515 | "id": 91, 516 | "initialValue": { 517 | "argumentTypes": null, 518 | "arguments": [ 519 | { 520 | "argumentTypes": null, 521 | "id": 89, 522 | "name": "new_address", 523 | "nodeType": "Identifier", 524 | "overloadedDeclarations": [], 525 | "referencedDeclaration": 81, 526 | "src": "433:11:1", 527 | "typeDescriptions": { 528 | "typeIdentifier": "t_address", 529 | "typeString": "address" 530 | } 531 | } 532 | ], 533 | "expression": { 534 | "argumentTypes": [ 535 | { 536 | "typeIdentifier": "t_address", 537 | "typeString": "address" 538 | } 539 | ], 540 | "id": 88, 541 | "name": "Migrations", 542 | "nodeType": "Identifier", 543 | "overloadedDeclarations": [], 544 | "referencedDeclaration": 100, 545 | "src": "422:10:1", 546 | "typeDescriptions": { 547 | "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", 548 | "typeString": "type(contract Migrations)" 549 | } 550 | }, 551 | "id": 90, 552 | "isConstant": false, 553 | "isLValue": false, 554 | "isPure": false, 555 | "kind": "typeConversion", 556 | "lValueRequested": false, 557 | "names": [], 558 | "nodeType": "FunctionCall", 559 | "src": "422:23:1", 560 | "typeDescriptions": { 561 | "typeIdentifier": "t_contract$_Migrations_$100", 562 | "typeString": "contract Migrations" 563 | } 564 | }, 565 | "nodeType": "VariableDeclarationStatement", 566 | "src": "400:45:1" 567 | }, 568 | { 569 | "expression": { 570 | "argumentTypes": null, 571 | "arguments": [ 572 | { 573 | "argumentTypes": null, 574 | "id": 95, 575 | "name": "last_completed_migration", 576 | "nodeType": "Identifier", 577 | "overloadedDeclarations": [], 578 | "referencedDeclaration": 49, 579 | "src": "473:24:1", 580 | "typeDescriptions": { 581 | "typeIdentifier": "t_uint256", 582 | "typeString": "uint256" 583 | } 584 | } 585 | ], 586 | "expression": { 587 | "argumentTypes": [ 588 | { 589 | "typeIdentifier": "t_uint256", 590 | "typeString": "uint256" 591 | } 592 | ], 593 | "expression": { 594 | "argumentTypes": null, 595 | "id": 92, 596 | "name": "upgraded", 597 | "nodeType": "Identifier", 598 | "overloadedDeclarations": [], 599 | "referencedDeclaration": 87, 600 | "src": "451:8:1", 601 | "typeDescriptions": { 602 | "typeIdentifier": "t_contract$_Migrations_$100", 603 | "typeString": "contract Migrations" 604 | } 605 | }, 606 | "id": 94, 607 | "isConstant": false, 608 | "isLValue": false, 609 | "isPure": false, 610 | "lValueRequested": false, 611 | "memberName": "setCompleted", 612 | "nodeType": "MemberAccess", 613 | "referencedDeclaration": 79, 614 | "src": "451:21:1", 615 | "typeDescriptions": { 616 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", 617 | "typeString": "function (uint256) external" 618 | } 619 | }, 620 | "id": 96, 621 | "isConstant": false, 622 | "isLValue": false, 623 | "isPure": false, 624 | "kind": "functionCall", 625 | "lValueRequested": false, 626 | "names": [], 627 | "nodeType": "FunctionCall", 628 | "src": "451:47:1", 629 | "typeDescriptions": { 630 | "typeIdentifier": "t_tuple$__$", 631 | "typeString": "tuple()" 632 | } 633 | }, 634 | "id": 97, 635 | "nodeType": "ExpressionStatement", 636 | "src": "451:47:1" 637 | } 638 | ] 639 | }, 640 | "documentation": null, 641 | "id": 99, 642 | "implemented": true, 643 | "kind": "function", 644 | "modifiers": [ 645 | { 646 | "arguments": null, 647 | "id": 84, 648 | "modifierName": { 649 | "argumentTypes": null, 650 | "id": 83, 651 | "name": "restricted", 652 | "nodeType": "Identifier", 653 | "overloadedDeclarations": [], 654 | "referencedDeclaration": 58, 655 | "src": "383:10:1", 656 | "typeDescriptions": { 657 | "typeIdentifier": "t_modifier$__$", 658 | "typeString": "modifier ()" 659 | } 660 | }, 661 | "nodeType": "ModifierInvocation", 662 | "src": "383:10:1" 663 | } 664 | ], 665 | "name": "upgrade", 666 | "nodeType": "FunctionDefinition", 667 | "parameters": { 668 | "id": 82, 669 | "nodeType": "ParameterList", 670 | "parameters": [ 671 | { 672 | "constant": false, 673 | "id": 81, 674 | "name": "new_address", 675 | "nodeType": "VariableDeclaration", 676 | "scope": 99, 677 | "src": "355:19:1", 678 | "stateVariable": false, 679 | "storageLocation": "default", 680 | "typeDescriptions": { 681 | "typeIdentifier": "t_address", 682 | "typeString": "address" 683 | }, 684 | "typeName": { 685 | "id": 80, 686 | "name": "address", 687 | "nodeType": "ElementaryTypeName", 688 | "src": "355:7:1", 689 | "stateMutability": "nonpayable", 690 | "typeDescriptions": { 691 | "typeIdentifier": "t_address", 692 | "typeString": "address" 693 | } 694 | }, 695 | "value": null, 696 | "visibility": "internal" 697 | } 698 | ], 699 | "src": "354:21:1" 700 | }, 701 | "returnParameters": { 702 | "id": 85, 703 | "nodeType": "ParameterList", 704 | "parameters": [], 705 | "src": "394:0:1" 706 | }, 707 | "scope": 100, 708 | "src": "338:165:1", 709 | "stateMutability": "nonpayable", 710 | "superFunction": null, 711 | "visibility": "public" 712 | } 713 | ], 714 | "scope": 101, 715 | "src": "25:480:1" 716 | } 717 | ], 718 | "src": "0:506:1" 719 | }, 720 | "legacyAST": { 721 | "absolutePath": "/home/adri/Proyectos/pet-shop-tutorial/contracts/Migrations.sol", 722 | "exportedSymbols": { 723 | "Migrations": [ 724 | 100 725 | ] 726 | }, 727 | "id": 101, 728 | "nodeType": "SourceUnit", 729 | "nodes": [ 730 | { 731 | "id": 45, 732 | "literals": [ 733 | "solidity", 734 | "^", 735 | "0.5", 736 | ".0" 737 | ], 738 | "nodeType": "PragmaDirective", 739 | "src": "0:23:1" 740 | }, 741 | { 742 | "baseContracts": [], 743 | "contractDependencies": [], 744 | "contractKind": "contract", 745 | "documentation": null, 746 | "fullyImplemented": true, 747 | "id": 100, 748 | "linearizedBaseContracts": [ 749 | 100 750 | ], 751 | "name": "Migrations", 752 | "nodeType": "ContractDefinition", 753 | "nodes": [ 754 | { 755 | "constant": false, 756 | "id": 47, 757 | "name": "owner", 758 | "nodeType": "VariableDeclaration", 759 | "scope": 100, 760 | "src": "49:20:1", 761 | "stateVariable": true, 762 | "storageLocation": "default", 763 | "typeDescriptions": { 764 | "typeIdentifier": "t_address", 765 | "typeString": "address" 766 | }, 767 | "typeName": { 768 | "id": 46, 769 | "name": "address", 770 | "nodeType": "ElementaryTypeName", 771 | "src": "49:7:1", 772 | "stateMutability": "nonpayable", 773 | "typeDescriptions": { 774 | "typeIdentifier": "t_address", 775 | "typeString": "address" 776 | } 777 | }, 778 | "value": null, 779 | "visibility": "public" 780 | }, 781 | { 782 | "constant": false, 783 | "id": 49, 784 | "name": "last_completed_migration", 785 | "nodeType": "VariableDeclaration", 786 | "scope": 100, 787 | "src": "73:36:1", 788 | "stateVariable": true, 789 | "storageLocation": "default", 790 | "typeDescriptions": { 791 | "typeIdentifier": "t_uint256", 792 | "typeString": "uint256" 793 | }, 794 | "typeName": { 795 | "id": 48, 796 | "name": "uint", 797 | "nodeType": "ElementaryTypeName", 798 | "src": "73:4:1", 799 | "typeDescriptions": { 800 | "typeIdentifier": "t_uint256", 801 | "typeString": "uint256" 802 | } 803 | }, 804 | "value": null, 805 | "visibility": "public" 806 | }, 807 | { 808 | "body": { 809 | "id": 57, 810 | "nodeType": "Block", 811 | "src": "136:37:1", 812 | "statements": [ 813 | { 814 | "condition": { 815 | "argumentTypes": null, 816 | "commonType": { 817 | "typeIdentifier": "t_address", 818 | "typeString": "address" 819 | }, 820 | "id": 54, 821 | "isConstant": false, 822 | "isLValue": false, 823 | "isPure": false, 824 | "lValueRequested": false, 825 | "leftExpression": { 826 | "argumentTypes": null, 827 | "expression": { 828 | "argumentTypes": null, 829 | "id": 51, 830 | "name": "msg", 831 | "nodeType": "Identifier", 832 | "overloadedDeclarations": [], 833 | "referencedDeclaration": 115, 834 | "src": "146:3:1", 835 | "typeDescriptions": { 836 | "typeIdentifier": "t_magic_message", 837 | "typeString": "msg" 838 | } 839 | }, 840 | "id": 52, 841 | "isConstant": false, 842 | "isLValue": false, 843 | "isPure": false, 844 | "lValueRequested": false, 845 | "memberName": "sender", 846 | "nodeType": "MemberAccess", 847 | "referencedDeclaration": null, 848 | "src": "146:10:1", 849 | "typeDescriptions": { 850 | "typeIdentifier": "t_address_payable", 851 | "typeString": "address payable" 852 | } 853 | }, 854 | "nodeType": "BinaryOperation", 855 | "operator": "==", 856 | "rightExpression": { 857 | "argumentTypes": null, 858 | "id": 53, 859 | "name": "owner", 860 | "nodeType": "Identifier", 861 | "overloadedDeclarations": [], 862 | "referencedDeclaration": 47, 863 | "src": "160:5:1", 864 | "typeDescriptions": { 865 | "typeIdentifier": "t_address", 866 | "typeString": "address" 867 | } 868 | }, 869 | "src": "146:19:1", 870 | "typeDescriptions": { 871 | "typeIdentifier": "t_bool", 872 | "typeString": "bool" 873 | } 874 | }, 875 | "falseBody": null, 876 | "id": 56, 877 | "nodeType": "IfStatement", 878 | "src": "142:26:1", 879 | "trueBody": { 880 | "id": 55, 881 | "nodeType": "PlaceholderStatement", 882 | "src": "167:1:1" 883 | } 884 | } 885 | ] 886 | }, 887 | "documentation": null, 888 | "id": 58, 889 | "name": "restricted", 890 | "nodeType": "ModifierDefinition", 891 | "parameters": { 892 | "id": 50, 893 | "nodeType": "ParameterList", 894 | "parameters": [], 895 | "src": "133:2:1" 896 | }, 897 | "src": "114:59:1", 898 | "visibility": "internal" 899 | }, 900 | { 901 | "body": { 902 | "id": 66, 903 | "nodeType": "Block", 904 | "src": "198:29:1", 905 | "statements": [ 906 | { 907 | "expression": { 908 | "argumentTypes": null, 909 | "id": 64, 910 | "isConstant": false, 911 | "isLValue": false, 912 | "isPure": false, 913 | "lValueRequested": false, 914 | "leftHandSide": { 915 | "argumentTypes": null, 916 | "id": 61, 917 | "name": "owner", 918 | "nodeType": "Identifier", 919 | "overloadedDeclarations": [], 920 | "referencedDeclaration": 47, 921 | "src": "204:5:1", 922 | "typeDescriptions": { 923 | "typeIdentifier": "t_address", 924 | "typeString": "address" 925 | } 926 | }, 927 | "nodeType": "Assignment", 928 | "operator": "=", 929 | "rightHandSide": { 930 | "argumentTypes": null, 931 | "expression": { 932 | "argumentTypes": null, 933 | "id": 62, 934 | "name": "msg", 935 | "nodeType": "Identifier", 936 | "overloadedDeclarations": [], 937 | "referencedDeclaration": 115, 938 | "src": "212:3:1", 939 | "typeDescriptions": { 940 | "typeIdentifier": "t_magic_message", 941 | "typeString": "msg" 942 | } 943 | }, 944 | "id": 63, 945 | "isConstant": false, 946 | "isLValue": false, 947 | "isPure": false, 948 | "lValueRequested": false, 949 | "memberName": "sender", 950 | "nodeType": "MemberAccess", 951 | "referencedDeclaration": null, 952 | "src": "212:10:1", 953 | "typeDescriptions": { 954 | "typeIdentifier": "t_address_payable", 955 | "typeString": "address payable" 956 | } 957 | }, 958 | "src": "204:18:1", 959 | "typeDescriptions": { 960 | "typeIdentifier": "t_address", 961 | "typeString": "address" 962 | } 963 | }, 964 | "id": 65, 965 | "nodeType": "ExpressionStatement", 966 | "src": "204:18:1" 967 | } 968 | ] 969 | }, 970 | "documentation": null, 971 | "id": 67, 972 | "implemented": true, 973 | "kind": "constructor", 974 | "modifiers": [], 975 | "name": "", 976 | "nodeType": "FunctionDefinition", 977 | "parameters": { 978 | "id": 59, 979 | "nodeType": "ParameterList", 980 | "parameters": [], 981 | "src": "188:2:1" 982 | }, 983 | "returnParameters": { 984 | "id": 60, 985 | "nodeType": "ParameterList", 986 | "parameters": [], 987 | "src": "198:0:1" 988 | }, 989 | "scope": 100, 990 | "src": "177:50:1", 991 | "stateMutability": "nonpayable", 992 | "superFunction": null, 993 | "visibility": "public" 994 | }, 995 | { 996 | "body": { 997 | "id": 78, 998 | "nodeType": "Block", 999 | "src": "287:47:1", 1000 | "statements": [ 1001 | { 1002 | "expression": { 1003 | "argumentTypes": null, 1004 | "id": 76, 1005 | "isConstant": false, 1006 | "isLValue": false, 1007 | "isPure": false, 1008 | "lValueRequested": false, 1009 | "leftHandSide": { 1010 | "argumentTypes": null, 1011 | "id": 74, 1012 | "name": "last_completed_migration", 1013 | "nodeType": "Identifier", 1014 | "overloadedDeclarations": [], 1015 | "referencedDeclaration": 49, 1016 | "src": "293:24:1", 1017 | "typeDescriptions": { 1018 | "typeIdentifier": "t_uint256", 1019 | "typeString": "uint256" 1020 | } 1021 | }, 1022 | "nodeType": "Assignment", 1023 | "operator": "=", 1024 | "rightHandSide": { 1025 | "argumentTypes": null, 1026 | "id": 75, 1027 | "name": "completed", 1028 | "nodeType": "Identifier", 1029 | "overloadedDeclarations": [], 1030 | "referencedDeclaration": 69, 1031 | "src": "320:9:1", 1032 | "typeDescriptions": { 1033 | "typeIdentifier": "t_uint256", 1034 | "typeString": "uint256" 1035 | } 1036 | }, 1037 | "src": "293:36:1", 1038 | "typeDescriptions": { 1039 | "typeIdentifier": "t_uint256", 1040 | "typeString": "uint256" 1041 | } 1042 | }, 1043 | "id": 77, 1044 | "nodeType": "ExpressionStatement", 1045 | "src": "293:36:1" 1046 | } 1047 | ] 1048 | }, 1049 | "documentation": null, 1050 | "id": 79, 1051 | "implemented": true, 1052 | "kind": "function", 1053 | "modifiers": [ 1054 | { 1055 | "arguments": null, 1056 | "id": 72, 1057 | "modifierName": { 1058 | "argumentTypes": null, 1059 | "id": 71, 1060 | "name": "restricted", 1061 | "nodeType": "Identifier", 1062 | "overloadedDeclarations": [], 1063 | "referencedDeclaration": 58, 1064 | "src": "276:10:1", 1065 | "typeDescriptions": { 1066 | "typeIdentifier": "t_modifier$__$", 1067 | "typeString": "modifier ()" 1068 | } 1069 | }, 1070 | "nodeType": "ModifierInvocation", 1071 | "src": "276:10:1" 1072 | } 1073 | ], 1074 | "name": "setCompleted", 1075 | "nodeType": "FunctionDefinition", 1076 | "parameters": { 1077 | "id": 70, 1078 | "nodeType": "ParameterList", 1079 | "parameters": [ 1080 | { 1081 | "constant": false, 1082 | "id": 69, 1083 | "name": "completed", 1084 | "nodeType": "VariableDeclaration", 1085 | "scope": 79, 1086 | "src": "253:14:1", 1087 | "stateVariable": false, 1088 | "storageLocation": "default", 1089 | "typeDescriptions": { 1090 | "typeIdentifier": "t_uint256", 1091 | "typeString": "uint256" 1092 | }, 1093 | "typeName": { 1094 | "id": 68, 1095 | "name": "uint", 1096 | "nodeType": "ElementaryTypeName", 1097 | "src": "253:4:1", 1098 | "typeDescriptions": { 1099 | "typeIdentifier": "t_uint256", 1100 | "typeString": "uint256" 1101 | } 1102 | }, 1103 | "value": null, 1104 | "visibility": "internal" 1105 | } 1106 | ], 1107 | "src": "252:16:1" 1108 | }, 1109 | "returnParameters": { 1110 | "id": 73, 1111 | "nodeType": "ParameterList", 1112 | "parameters": [], 1113 | "src": "287:0:1" 1114 | }, 1115 | "scope": 100, 1116 | "src": "231:103:1", 1117 | "stateMutability": "nonpayable", 1118 | "superFunction": null, 1119 | "visibility": "public" 1120 | }, 1121 | { 1122 | "body": { 1123 | "id": 98, 1124 | "nodeType": "Block", 1125 | "src": "394:109:1", 1126 | "statements": [ 1127 | { 1128 | "assignments": [ 1129 | 87 1130 | ], 1131 | "declarations": [ 1132 | { 1133 | "constant": false, 1134 | "id": 87, 1135 | "name": "upgraded", 1136 | "nodeType": "VariableDeclaration", 1137 | "scope": 98, 1138 | "src": "400:19:1", 1139 | "stateVariable": false, 1140 | "storageLocation": "default", 1141 | "typeDescriptions": { 1142 | "typeIdentifier": "t_contract$_Migrations_$100", 1143 | "typeString": "contract Migrations" 1144 | }, 1145 | "typeName": { 1146 | "contractScope": null, 1147 | "id": 86, 1148 | "name": "Migrations", 1149 | "nodeType": "UserDefinedTypeName", 1150 | "referencedDeclaration": 100, 1151 | "src": "400:10:1", 1152 | "typeDescriptions": { 1153 | "typeIdentifier": "t_contract$_Migrations_$100", 1154 | "typeString": "contract Migrations" 1155 | } 1156 | }, 1157 | "value": null, 1158 | "visibility": "internal" 1159 | } 1160 | ], 1161 | "id": 91, 1162 | "initialValue": { 1163 | "argumentTypes": null, 1164 | "arguments": [ 1165 | { 1166 | "argumentTypes": null, 1167 | "id": 89, 1168 | "name": "new_address", 1169 | "nodeType": "Identifier", 1170 | "overloadedDeclarations": [], 1171 | "referencedDeclaration": 81, 1172 | "src": "433:11:1", 1173 | "typeDescriptions": { 1174 | "typeIdentifier": "t_address", 1175 | "typeString": "address" 1176 | } 1177 | } 1178 | ], 1179 | "expression": { 1180 | "argumentTypes": [ 1181 | { 1182 | "typeIdentifier": "t_address", 1183 | "typeString": "address" 1184 | } 1185 | ], 1186 | "id": 88, 1187 | "name": "Migrations", 1188 | "nodeType": "Identifier", 1189 | "overloadedDeclarations": [], 1190 | "referencedDeclaration": 100, 1191 | "src": "422:10:1", 1192 | "typeDescriptions": { 1193 | "typeIdentifier": "t_type$_t_contract$_Migrations_$100_$", 1194 | "typeString": "type(contract Migrations)" 1195 | } 1196 | }, 1197 | "id": 90, 1198 | "isConstant": false, 1199 | "isLValue": false, 1200 | "isPure": false, 1201 | "kind": "typeConversion", 1202 | "lValueRequested": false, 1203 | "names": [], 1204 | "nodeType": "FunctionCall", 1205 | "src": "422:23:1", 1206 | "typeDescriptions": { 1207 | "typeIdentifier": "t_contract$_Migrations_$100", 1208 | "typeString": "contract Migrations" 1209 | } 1210 | }, 1211 | "nodeType": "VariableDeclarationStatement", 1212 | "src": "400:45:1" 1213 | }, 1214 | { 1215 | "expression": { 1216 | "argumentTypes": null, 1217 | "arguments": [ 1218 | { 1219 | "argumentTypes": null, 1220 | "id": 95, 1221 | "name": "last_completed_migration", 1222 | "nodeType": "Identifier", 1223 | "overloadedDeclarations": [], 1224 | "referencedDeclaration": 49, 1225 | "src": "473:24:1", 1226 | "typeDescriptions": { 1227 | "typeIdentifier": "t_uint256", 1228 | "typeString": "uint256" 1229 | } 1230 | } 1231 | ], 1232 | "expression": { 1233 | "argumentTypes": [ 1234 | { 1235 | "typeIdentifier": "t_uint256", 1236 | "typeString": "uint256" 1237 | } 1238 | ], 1239 | "expression": { 1240 | "argumentTypes": null, 1241 | "id": 92, 1242 | "name": "upgraded", 1243 | "nodeType": "Identifier", 1244 | "overloadedDeclarations": [], 1245 | "referencedDeclaration": 87, 1246 | "src": "451:8:1", 1247 | "typeDescriptions": { 1248 | "typeIdentifier": "t_contract$_Migrations_$100", 1249 | "typeString": "contract Migrations" 1250 | } 1251 | }, 1252 | "id": 94, 1253 | "isConstant": false, 1254 | "isLValue": false, 1255 | "isPure": false, 1256 | "lValueRequested": false, 1257 | "memberName": "setCompleted", 1258 | "nodeType": "MemberAccess", 1259 | "referencedDeclaration": 79, 1260 | "src": "451:21:1", 1261 | "typeDescriptions": { 1262 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", 1263 | "typeString": "function (uint256) external" 1264 | } 1265 | }, 1266 | "id": 96, 1267 | "isConstant": false, 1268 | "isLValue": false, 1269 | "isPure": false, 1270 | "kind": "functionCall", 1271 | "lValueRequested": false, 1272 | "names": [], 1273 | "nodeType": "FunctionCall", 1274 | "src": "451:47:1", 1275 | "typeDescriptions": { 1276 | "typeIdentifier": "t_tuple$__$", 1277 | "typeString": "tuple()" 1278 | } 1279 | }, 1280 | "id": 97, 1281 | "nodeType": "ExpressionStatement", 1282 | "src": "451:47:1" 1283 | } 1284 | ] 1285 | }, 1286 | "documentation": null, 1287 | "id": 99, 1288 | "implemented": true, 1289 | "kind": "function", 1290 | "modifiers": [ 1291 | { 1292 | "arguments": null, 1293 | "id": 84, 1294 | "modifierName": { 1295 | "argumentTypes": null, 1296 | "id": 83, 1297 | "name": "restricted", 1298 | "nodeType": "Identifier", 1299 | "overloadedDeclarations": [], 1300 | "referencedDeclaration": 58, 1301 | "src": "383:10:1", 1302 | "typeDescriptions": { 1303 | "typeIdentifier": "t_modifier$__$", 1304 | "typeString": "modifier ()" 1305 | } 1306 | }, 1307 | "nodeType": "ModifierInvocation", 1308 | "src": "383:10:1" 1309 | } 1310 | ], 1311 | "name": "upgrade", 1312 | "nodeType": "FunctionDefinition", 1313 | "parameters": { 1314 | "id": 82, 1315 | "nodeType": "ParameterList", 1316 | "parameters": [ 1317 | { 1318 | "constant": false, 1319 | "id": 81, 1320 | "name": "new_address", 1321 | "nodeType": "VariableDeclaration", 1322 | "scope": 99, 1323 | "src": "355:19:1", 1324 | "stateVariable": false, 1325 | "storageLocation": "default", 1326 | "typeDescriptions": { 1327 | "typeIdentifier": "t_address", 1328 | "typeString": "address" 1329 | }, 1330 | "typeName": { 1331 | "id": 80, 1332 | "name": "address", 1333 | "nodeType": "ElementaryTypeName", 1334 | "src": "355:7:1", 1335 | "stateMutability": "nonpayable", 1336 | "typeDescriptions": { 1337 | "typeIdentifier": "t_address", 1338 | "typeString": "address" 1339 | } 1340 | }, 1341 | "value": null, 1342 | "visibility": "internal" 1343 | } 1344 | ], 1345 | "src": "354:21:1" 1346 | }, 1347 | "returnParameters": { 1348 | "id": 85, 1349 | "nodeType": "ParameterList", 1350 | "parameters": [], 1351 | "src": "394:0:1" 1352 | }, 1353 | "scope": 100, 1354 | "src": "338:165:1", 1355 | "stateMutability": "nonpayable", 1356 | "superFunction": null, 1357 | "visibility": "public" 1358 | } 1359 | ], 1360 | "scope": 101, 1361 | "src": "25:480:1" 1362 | } 1363 | ], 1364 | "src": "0:506:1" 1365 | }, 1366 | "compiler": { 1367 | "name": "solc", 1368 | "version": "0.5.8+commit.23d335f2.Emscripten.clang" 1369 | }, 1370 | "networks": { 1371 | "5777": { 1372 | "events": {}, 1373 | "links": {}, 1374 | "address": "0xB82ACa22D8A6Cf036A40662B8f82418914833590", 1375 | "transactionHash": "0x35e65a16d76a9fc93c125437e47cd71dd491d4d905c173c84b34ba904047d719" 1376 | } 1377 | }, 1378 | "schemaVersion": "3.0.10", 1379 | "updatedAt": "2019-06-12T17:10:19.275Z", 1380 | "devdoc": { 1381 | "methods": {} 1382 | }, 1383 | "userdoc": { 1384 | "methods": {} 1385 | } 1386 | } --------------------------------------------------------------------------------