Skip to content
Snippets Groups Projects
Commit 7d444401 authored by Andrés Blanco's avatar Andrés Blanco
Browse files

se ignora api/dist y contract/build

parent a6d22399
No related branches found
No related tags found
No related merge requests found
node_modules
.env
*.swp
dist
"use strict";
require("dotenv/config");
var _web = _interopRequireDefault(require("web3"));
var _express = _interopRequireDefault(require("express"));
var _cors = _interopRequireDefault(require("cors"));
var _bodyParser = _interopRequireDefault(require("body-parser"));
var _expressBasicAuth = _interopRequireDefault(require("express-basic-auth"));
var _simpleStamperWrapper = _interopRequireDefault(require("./simpleStamperWrapper"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function setupWeb3Ganache() {
try {
let netIsListening = await web3.eth.net.isListening();
let netId = await web3.eth.net.getId();
web3.eth.defaultAccount = (await web3.eth.getAccounts())[0];
console.log(`Conectado exitosamente a Ganache:
> netId: ${netId}
> account: ${web3.eth.defaultAccount}
`);
} catch (e) {
console.error('Error de conexión');
console.error(e);
process.exit(1);
}
}
var web3 = web3;
if (typeof web3 !== 'undefined') {
console.log('Cargando web3 provider desde el entorno'); // Use Mist/MetaMask's provider
//conector.setWeb3Instance(new Web3(web3.currentProvider))
} else {
//console.warn(web3.eth.defaultAccount)
console.log('Conectando a Ganache');
web3 = new _web.default(new _web.default.providers.HttpProvider('http://localhost:7545'));
web3.eth.defaultAccount = web3.eth.accounts[0];
setupWeb3Ganache();
}
const app = (0, _express.default)();
app.use((0, _cors.default)());
app.use(_bodyParser.default.json());
if (process.env.AUTH_TYPE === 'basic') {
if (process.env.API_USER && process.env.API_PASS) {
var users = {};
users[process.env.API_USER] = process.env.API_PASS;
app.use((0, _expressBasicAuth.default)({
users: users,
challenge: true
}));
} else {
console.error("El servidor es PUBLICO");
}
}
app.post('/stamp', async (req, res) => {
let netId = await web3.eth.net.getId();
let ss = new _simpleStamperWrapper.default(web3, netId);
ss.setSender(web3.eth.defaultAccount);
if (!("hash" in req.body)) {
res.status(422);
res.send('No se incluyó la clave hash en el cuerpo del POST');
return;
}
var hash = req.body.hash;
if (!hash.startsWith('0x')) {
hash = '0x' + hash;
}
try {
let txHash = await ss.stamp(hash);
let fullUrl = req.protocol + '://' + req.get('host');
return res.json({
verifyUri: `${fullUrl}/verify/${hash}`,
hash: txHash
});
} catch (e) {
res.status(500);
res.send('Error interno. Chequee el log de la aplicación para más detalles');
}
});
app.get('/verify/:hash', async (req, res) => {
let netId = await web3.eth.net.getId();
let ss = new _simpleStamperWrapper.default(web3, netId);
ss.setSender(web3.eth.defaultAccount);
var value = req.params.hash;
if (!value.startsWith('0x')) {
value = '0x' + value;
}
try {
let info = await ss.verify(value);
return res.json(info);
} catch (e) {
console.error(e);
res.status(404);
res.send("No existe el hash en la base de datos");
}
}); // app.get('/status/:txHash', async (req, res) => {
// try {
// let info = await web3.eth.getTransaction(req.params.txHash, (e, f) => {
// console.log(e)
// console.log(f)
// })
// console.log(info)
// res.send(info)
// } catch (e) {
// res.send(e)
// }
// })
let port = process.env.PORT ? process.env.PORT : 3000;
app.listen(port, () => console.log(`TSA Api corriendo en ${port}!`));
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const simpleStamperInterface = require('../../contract/build/contracts/SimpleStamper.json');
class SimpleStamper {
constructor(web3, netId) {
this.web3 = web3;
let address = simpleStamperInterface.networks[netId].address;
this.contract = new web3.eth.Contract(simpleStamperInterface.abi, address);
}
setSender(fromAddress) {
this.from = fromAddress;
}
async stamp(hash) {
console.log(`${hash}: stamping`);
let txPromise = this.contract.methods.stamp(hash).send({
from: this.from
});
txPromise.then(receipt => {
console.log(`${hash}: stamped (bloque: ${receipt.blockNumber})`);
}).catch(error => {
console.error(error);
});
return new Promise((resolve, reject) => {
txPromise.on('transactionHash', txHash => {
resolve(txHash);
});
txPromise.catch(error => {
reject(error);
});
});
}
async verify(hash) {
try {
let blockNumber = await this.contract.methods.getBlockNumber(hash).call();
console.log(`${hash}: blockNmb (${blockNumber})`);
return {
verified: blockNumber > 0,
blockNumber: blockNumber
};
} catch (e) {
console.error(e);
throw e;
}
}
}
var _default = SimpleStamper;
exports.default = _default;
\ No newline at end of file
.DS_Store
build
{
"contractName": "Migrations",
"abi": [
{
"constant": true,
"inputs": [],
"name": "last_completed_migration",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0x445df0ac"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function",
"signature": "0x8da5cb5b"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor",
"signature": "constructor"
},
{
"constant": false,
"inputs": [
{
"name": "completed",
"type": "uint256"
}
],
"name": "setCompleted",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0xfdacd576"
},
{
"constant": false,
"inputs": [
{
"name": "new_address",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x0900f010"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.2+commit.1df8f40c\"},\"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/ablanco/proyectos/bfa/tsa/contract/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/ablanco/proyectos/bfa/tsa/contract/contracts/Migrations.sol\":{\"keccak256\":\"0xfdb731592344e2a2890faf03baec7b4bee7057ffba18ba6dbb6eec8db85f8f4c\",\"urls\":[\"bzzr://ddc8801d0a2a7220c2c9bf3881b4921817e72fdd96827ec8be4428fa009ace07\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102e7806100606000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c0100000000000000000000000000000000000000000000000000000000900480630900f0101461006e578063445df0ac146100b25780638da5cb5b146100d0578063fdacd5761461011a575b600080fd5b6100b06004803603602081101561008457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610148565b005b6100ba610230565b6040518082815260200191505060405180910390f35b6100d8610236565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101466004803603602081101561013057600080fd5b810190808035906020019092919050505061025b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561022d5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561021357600080fd5b505af1158015610227573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102b857806001819055505b5056fea165627a7a72305820d0bda2c762e942e8d7dd363f2f848d59f80abfeaf111d82acff55dffd072350b0029",
"deployedBytecode": "0x608060405234801561001057600080fd5b5060043610610069576000357c0100000000000000000000000000000000000000000000000000000000900480630900f0101461006e578063445df0ac146100b25780638da5cb5b146100d0578063fdacd5761461011a575b600080fd5b6100b06004803603602081101561008457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610148565b005b6100ba610230565b6040518082815260200191505060405180910390f35b6100d8610236565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101466004803603602081101561013057600080fd5b810190808035906020019092919050505061025b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561022d5760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561021357600080fd5b505af1158015610227573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102b857806001819055505b5056fea165627a7a72305820d0bda2c762e942e8d7dd363f2f848d59f80abfeaf111d82acff55dffd072350b0029",
"sourceMap": "34:480:0:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:0;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;",
"deployedSourceMap": "34:480:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:480:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;82:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;58:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;240:103:0;;;;;;;;;;;;;;;;;:::i;:::-;;347:165;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;409:19;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:0;;;;230:1;205:26;347:165;:::o;82:36::-;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o",
"source": "pragma solidity >=0.4.21 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n",
"sourcePath": "/home/ablanco/proyectos/bfa/tsa/contract/contracts/Migrations.sol",
"ast": {
"absolutePath": "/home/ablanco/proyectos/bfa/tsa/contract/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
56
]
},
"id": 57,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".21",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 56,
"linearizedBaseContracts": [
56
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 56,
"src": "58:20:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 56,
"src": "82:36:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "82:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 13,
"nodeType": "Block",
"src": "144:29:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 8,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "150:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "158:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "150:18:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 12,
"nodeType": "ExpressionStatement",
"src": "150:18:0"
}
]
},
"documentation": null,
"id": 14,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [],
"src": "134:2:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "144:0:0"
},
"scope": 56,
"src": "123:50:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 22,
"nodeType": "Block",
"src": "199:37:0",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 19,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 16,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "209:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "209:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 18,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "223:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "209:19:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 21,
"nodeType": "IfStatement",
"src": "205:26:0",
"trueBody": {
"id": 20,
"nodeType": "PlaceholderStatement",
"src": "230:1:0"
}
}
]
},
"documentation": null,
"id": 23,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 15,
"nodeType": "ParameterList",
"parameters": [],
"src": "196:2:0"
},
"src": "177:59:0",
"visibility": "internal"
},
{
"body": {
"id": 34,
"nodeType": "Block",
"src": "296:47:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 32,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 30,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "302:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 31,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25,
"src": "329:9:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "302:36:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 33,
"nodeType": "ExpressionStatement",
"src": "302:36:0"
}
]
},
"documentation": null,
"id": 35,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 28,
"modifierName": {
"argumentTypes": null,
"id": 27,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "285:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "285:10:0"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 26,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 35,
"src": "262:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "262:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "261:16:0"
},
"returnParameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [],
"src": "296:0:0"
},
"scope": 56,
"src": "240:103:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 54,
"nodeType": "Block",
"src": "403:109:0",
"statements": [
{
"assignments": [
43
],
"declarations": [
{
"constant": false,
"id": 43,
"name": "upgraded",
"nodeType": "VariableDeclaration",
"scope": 54,
"src": "409:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
},
"typeName": {
"contractScope": null,
"id": 42,
"name": "Migrations",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 56,
"src": "409:10:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 47,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 45,
"name": "new_address",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37,
"src": "442:11:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 44,
"name": "Migrations",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 56,
"src": "431:10:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Migrations_$56_$",
"typeString": "type(contract Migrations)"
}
},
"id": 46,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "431:23:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "409:45:0"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 51,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "482:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 48,
"name": "upgraded",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 43,
"src": "460:8:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"id": 50,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setCompleted",
"nodeType": "MemberAccess",
"referencedDeclaration": 35,
"src": "460:21:0",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 52,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "460:47:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 53,
"nodeType": "ExpressionStatement",
"src": "460:47:0"
}
]
},
"documentation": null,
"id": 55,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 40,
"modifierName": {
"argumentTypes": null,
"id": 39,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "392:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "392:10:0"
}
],
"name": "upgrade",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 38,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 37,
"name": "new_address",
"nodeType": "VariableDeclaration",
"scope": 55,
"src": "364:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 36,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "364:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "363:21:0"
},
"returnParameters": {
"id": 41,
"nodeType": "ParameterList",
"parameters": [],
"src": "403:0:0"
},
"scope": 56,
"src": "347:165:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 57,
"src": "34:480:0"
}
],
"src": "0:515:0"
},
"legacyAST": {
"absolutePath": "/home/ablanco/proyectos/bfa/tsa/contract/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
56
]
},
"id": 57,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".21",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 56,
"linearizedBaseContracts": [
56
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 3,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 56,
"src": "58:20:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 2,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 5,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 56,
"src": "82:36:0",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "82:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 13,
"nodeType": "Block",
"src": "144:29:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 11,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 8,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "150:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "158:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 10,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "150:18:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 12,
"nodeType": "ExpressionStatement",
"src": "150:18:0"
}
]
},
"documentation": null,
"id": 14,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [],
"src": "134:2:0"
},
"returnParameters": {
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "144:0:0"
},
"scope": 56,
"src": "123:50:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 22,
"nodeType": "Block",
"src": "199:37:0",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 19,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 16,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 379,
"src": "209:3:0",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 17,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "209:10:0",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 18,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "223:5:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "209:19:0",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 21,
"nodeType": "IfStatement",
"src": "205:26:0",
"trueBody": {
"id": 20,
"nodeType": "PlaceholderStatement",
"src": "230:1:0"
}
}
]
},
"documentation": null,
"id": 23,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 15,
"nodeType": "ParameterList",
"parameters": [],
"src": "196:2:0"
},
"src": "177:59:0",
"visibility": "internal"
},
{
"body": {
"id": 34,
"nodeType": "Block",
"src": "296:47:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 32,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 30,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "302:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 31,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 25,
"src": "329:9:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "302:36:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 33,
"nodeType": "ExpressionStatement",
"src": "302:36:0"
}
]
},
"documentation": null,
"id": 35,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 28,
"modifierName": {
"argumentTypes": null,
"id": 27,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "285:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "285:10:0"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 26,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 35,
"src": "262:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 24,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "262:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "261:16:0"
},
"returnParameters": {
"id": 29,
"nodeType": "ParameterList",
"parameters": [],
"src": "296:0:0"
},
"scope": 56,
"src": "240:103:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 54,
"nodeType": "Block",
"src": "403:109:0",
"statements": [
{
"assignments": [
43
],
"declarations": [
{
"constant": false,
"id": 43,
"name": "upgraded",
"nodeType": "VariableDeclaration",
"scope": 54,
"src": "409:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
},
"typeName": {
"contractScope": null,
"id": 42,
"name": "Migrations",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 56,
"src": "409:10:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 47,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 45,
"name": "new_address",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37,
"src": "442:11:0",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 44,
"name": "Migrations",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 56,
"src": "431:10:0",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Migrations_$56_$",
"typeString": "type(contract Migrations)"
}
},
"id": 46,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "431:23:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "409:45:0"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 51,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "482:24:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 48,
"name": "upgraded",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 43,
"src": "460:8:0",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$56",
"typeString": "contract Migrations"
}
},
"id": 50,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setCompleted",
"nodeType": "MemberAccess",
"referencedDeclaration": 35,
"src": "460:21:0",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 52,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "460:47:0",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 53,
"nodeType": "ExpressionStatement",
"src": "460:47:0"
}
]
},
"documentation": null,
"id": 55,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 40,
"modifierName": {
"argumentTypes": null,
"id": 39,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "392:10:0",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "392:10:0"
}
],
"name": "upgrade",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 38,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 37,
"name": "new_address",
"nodeType": "VariableDeclaration",
"scope": 55,
"src": "364:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 36,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "364:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "363:21:0"
},
"returnParameters": {
"id": 41,
"nodeType": "ParameterList",
"parameters": [],
"src": "403:0:0"
},
"scope": 56,
"src": "347:165:0",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 57,
"src": "34:480:0"
}
],
"src": "0:515:0"
},
"compiler": {
"name": "solc",
"version": "0.5.2+commit.1df8f40c.Emscripten.clang"
},
"networks": {
"5775": {
"events": {},
"links": {},
"address": "0x5175060BeFded5174677a70dfAfa92eDB865F918",
"transactionHash": "0x1643e6fe152db5ed8c644e3954bb79fd0cdc7e9cf04454f3e21395e11d940619"
},
"5777": {
"events": {},
"links": {},
"address": "0x165336346B122a90e986bB69a566930E19390CF2",
"transactionHash": "0x542353ae506883566064e83b5bb98dfe91b2454fdc0745607b74c4b7c6de10af"
}
},
"schemaVersion": "3.0.8",
"updatedAt": "2019-05-07T21:28:13.658Z",
"devdoc": {
"methods": {}
},
"userdoc": {
"methods": {}
}
}
\ No newline at end of file
source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment