├── src
├── components
│ ├── App.css
│ ├── Navbar.js
│ ├── Main.js
│ └── App.js
├── logo.png
├── index.js
├── contracts
│ ├── Migrations.sol
│ └── Marketplace.sol
├── serviceWorker.js
└── abis
│ └── Migrations.json
├── .babelrc
├── public
├── favicon.ico
├── manifest.json
└── index.html
├── migrations
├── 1_initial_migration.js
└── 2_deploy_contracts.js
├── .gitignore
├── truffle-config.js
├── package.json
└── test
└── Marketplace.test.js
/src/components/App.css:
--------------------------------------------------------------------------------
1 | /* Styles go here */
2 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "stage-2", "stage-3"]
3 | }
4 |
--------------------------------------------------------------------------------
/src/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwmccubbin/real-estate-market/HEAD/src/logo.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gwmccubbin/real-estate-market/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/migrations/1_initial_migration.js:
--------------------------------------------------------------------------------
1 | const Migrations = artifacts.require("Migrations");
2 |
3 | module.exports = function(deployer) {
4 | deployer.deploy(Migrations);
5 | };
6 |
--------------------------------------------------------------------------------
/migrations/2_deploy_contracts.js:
--------------------------------------------------------------------------------
1 | const Marketplace = artifacts.require("Marketplace");
2 |
3 | module.exports = function(deployer) {
4 | deployer.deploy(Marketplace);
5 | };
6 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Starter Kit",
3 | "name": "Dapp University Starter Kit",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": ".",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env
17 | .env.local
18 | .env.development.local
19 | .env.test.local
20 | .env.production.local
21 |
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
--------------------------------------------------------------------------------
/truffle-config.js:
--------------------------------------------------------------------------------
1 | require('babel-register');
2 | require('babel-polyfill');
3 |
4 | module.exports = {
5 | networks: {
6 | development: {
7 | host: "127.0.0.1",
8 | port: 7545,
9 | network_id: "*" // Match any network id
10 | },
11 | },
12 | contracts_directory: './src/contracts/',
13 | contracts_build_directory: './src/abis/',
14 | compilers: {
15 | solc: {
16 | optimizer: {
17 | enabled: true,
18 | runs: 200
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import 'bootstrap/dist/css/bootstrap.css'
4 | import App from './components/App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/src/contracts/Migrations.sol:
--------------------------------------------------------------------------------
1 | pragma solidity >=0.4.21 <0.6.0;
2 |
3 | contract Migrations {
4 | address public owner;
5 | uint public last_completed_migration;
6 |
7 | constructor() public {
8 | owner = msg.sender;
9 | }
10 |
11 | modifier restricted() {
12 | if (msg.sender == owner) _;
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 |
--------------------------------------------------------------------------------
/src/components/Navbar.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | class Navbar extends Component {
4 |
5 | render() {
6 | return (
7 |
22 | );
23 | }
24 | }
25 |
26 | export default Navbar;
27 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "eth-marketplace",
3 | "version": "0.1.0",
4 | "description": "An Ethereum Marketplace",
5 | "author": "gregory@dappuniversity.com",
6 | "dependencies": {
7 | "babel-polyfill": "6.26.0",
8 | "babel-preset-env": "1.7.0",
9 | "babel-preset-es2015": "6.24.1",
10 | "babel-preset-stage-2": "6.24.1",
11 | "babel-preset-stage-3": "6.24.1",
12 | "babel-register": "6.26.0",
13 | "bootstrap": "4.3.1",
14 | "chai": "4.2.0",
15 | "chai-as-promised": "7.1.1",
16 | "chai-bignumber": "3.0.0",
17 | "react": "16.8.4",
18 | "react-bootstrap": "1.0.0-beta.5",
19 | "react-dom": "16.8.4",
20 | "react-scripts": "2.1.3",
21 | "truffle": "5.0.5",
22 | "web3": "1.0.0-beta.55"
23 | },
24 | "scripts": {
25 | "start": "react-scripts start",
26 | "build": "react-scripts build",
27 | "test": "react-scripts test",
28 | "eject": "react-scripts eject"
29 | },
30 | "eslintConfig": {
31 | "extends": "react-app"
32 | },
33 | "browserslist": [
34 | ">0.2%",
35 | "not dead",
36 | "not ie <= 11",
37 | "not op_mini all"
38 | ]
39 | }
40 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
15 |
16 |
25 | Dapp University Starter Kit
26 |
27 |
28 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/contracts/Marketplace.sol:
--------------------------------------------------------------------------------
1 | pragma solidity ^0.5.0;
2 |
3 | contract Marketplace {
4 | string public name;
5 | uint public propertyCount = 0;
6 | mapping(uint => Property) public properties;
7 |
8 | struct Property {
9 | uint id;
10 | string streetAddress;
11 | uint price;
12 | address payable owner;
13 | bool purchased;
14 | }
15 |
16 | event PropertyCreated(
17 | uint id,
18 | string streetAddress,
19 | uint price,
20 | address payable owner,
21 | bool purchased
22 | );
23 |
24 | event PropertyPurchased(
25 | uint id,
26 | string streetAddress,
27 | uint price,
28 | address payable owner,
29 | bool purchased
30 | );
31 |
32 | constructor() public {
33 | name = "Real Estate Marketplace";
34 | }
35 |
36 | function createProperty(string memory _streetAddress, uint _price) public {
37 | // Require a valid address
38 | require(bytes(_streetAddress).length > 0);
39 | // Require a valid price
40 | require(_price > 0);
41 | // Increment property count
42 | propertyCount ++;
43 | // Create the property
44 | properties[propertyCount] = Property(propertyCount, _streetAddress, _price, msg.sender, false);
45 | // Trigger an event
46 | emit PropertyCreated(propertyCount, _streetAddress, _price, msg.sender, false);
47 | }
48 |
49 | function purchaseProperty(uint _id) public payable {
50 | // Fetch the property
51 | Property memory _property = properties[_id];
52 | // Fetch the owner
53 | address payable _seller = _property.owner;
54 | // Make sure the property has a valid id
55 | require(_property.id > 0 && _property.id <= propertyCount);
56 | // Require that there is enough Ether in the transaction
57 | require(msg.value >= _property.price);
58 | // Require that the property has not been purchased already
59 | require(!_property.purchased);
60 | // Require that the buyer is not the seller
61 | require(_seller != msg.sender);
62 | // Transfer ownership to the buyer
63 | _property.owner = msg.sender;
64 | // Mark as purchased
65 | _property.purchased = true;
66 | // Update the property
67 | properties[_id] = _property;
68 | // Pay the seller by sending them Ether
69 | address(_seller).transfer(msg.value);
70 | // Trigger an event
71 | emit PropertyPurchased(propertyCount, _property.streetAddress, _property.price, msg.sender, true);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/components/Main.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | class Main extends Component {
4 |
5 | render() {
6 | return (
7 |
8 |
Add Property
9 |
35 |
36 |
Buy Property
37 |
38 |
39 |
40 | | # |
41 | Address |
42 | Price |
43 | Owner |
44 | |
45 |
46 |
47 |
48 | { this.props.properties.map((property, key) => {
49 | return(
50 |
51 | | {property.id.toString()} |
52 | {property.streetAddress} |
53 | {window.web3.utils.fromWei(property.price.toString(), 'Ether')} Eth |
54 | {property.owner} |
55 |
56 | { !property.purchased
57 | ?
66 | : null
67 | }
68 | |
69 |
70 | )
71 | })}
72 |
73 |
74 |
75 | );
76 | }
77 | }
78 |
79 | export default Main;
80 |
--------------------------------------------------------------------------------
/src/components/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import Web3 from 'web3'
3 | import logo from '../logo.png';
4 | import './App.css';
5 | import Marketplace from '../abis/Marketplace.json'
6 | import Navbar from './Navbar'
7 | import Main from './Main'
8 |
9 | class App extends Component {
10 |
11 | async componentWillMount() {
12 | await this.loadWeb3()
13 | await this.loadBlockchainData()
14 | }
15 |
16 | async loadWeb3() {
17 | if (window.ethereum) {
18 | window.web3 = new Web3(window.ethereum)
19 | await window.ethereum.enable()
20 | }
21 | else if (window.web3) {
22 | window.web3 = new Web3(window.web3.currentProvider)
23 | }
24 | else {
25 | window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!')
26 | }
27 | }
28 |
29 | async loadBlockchainData() {
30 | const web3 = window.web3
31 | // Load account
32 | const accounts = await web3.eth.getAccounts()
33 | this.setState({ account: accounts[0] })
34 | const networkId = await web3.eth.net.getId()
35 | const networkData = Marketplace.networks[networkId]
36 | if(networkData) {
37 | const marketplace = web3.eth.Contract(Marketplace.abi, networkData.address)
38 | this.setState({ marketplace })
39 | const propertyCount = await marketplace.methods.propertyCount().call()
40 | this.setState({ propertyCount })
41 | // Load properties
42 | for (var i = 1; i <= propertyCount; i++) {
43 | const property = await marketplace.methods.properties(i).call()
44 | this.setState({
45 | properties: [...this.state.properties, property]
46 | })
47 | }
48 | this.setState({ loading: false})
49 | } else {
50 | window.alert('Marketplace contract not deployed to detected network.')
51 | }
52 | }
53 |
54 | constructor(props) {
55 | super(props)
56 | this.state = {
57 | account: '',
58 | propertyCount: 0,
59 | properties: [],
60 | loading: true
61 | }
62 |
63 | this.createProperty = this.createProperty.bind(this)
64 | this.purchaseProperty = this.purchaseProperty.bind(this)
65 | }
66 |
67 | createProperty(name, price) {
68 | this.setState({ loading: true })
69 | this.state.marketplace.methods.createProperty(name, price).send({ from: this.state.account })
70 | .once('receipt', (receipt) => {
71 | this.setState({ loading: false })
72 | })
73 | }
74 |
75 | purchaseProperty(id, price) {
76 | this.setState({ loading: true })
77 | this.state.marketplace.methods.purchaseProperty(id).send({ from: this.state.account, value: price })
78 | .once('receipt', (receipt) => {
79 | this.setState({ loading: false })
80 | })
81 | }
82 |
83 | render() {
84 | return (
85 |
86 |
87 |
88 |
89 |
90 | { this.state.loading
91 | ?
92 | :
96 | }
97 |
98 |
99 |
100 |
101 | );
102 | }
103 | }
104 |
105 | export default App;
106 |
--------------------------------------------------------------------------------
/test/Marketplace.test.js:
--------------------------------------------------------------------------------
1 | const Marketplace = artifacts.require('./Marketplace.sol')
2 |
3 | require('chai')
4 | .use(require('chai-as-promised'))
5 | .should()
6 |
7 | contract('Marketplace', ([deployer, seller, buyer]) => {
8 | let marketplace
9 |
10 | before(async () => {
11 | marketplace = await Marketplace.deployed()
12 | })
13 |
14 | describe('deployment', async () => {
15 | it('deploys successfully', async () => {
16 | const address = await marketplace.address
17 | assert.notEqual(address, 0x0)
18 | assert.notEqual(address, '')
19 | assert.notEqual(address, null)
20 | assert.notEqual(address, undefined)
21 | })
22 |
23 | it('has a name', async () => {
24 | const name = await marketplace.name()
25 | assert.equal(name, 'Real Estate Marketplace')
26 | })
27 | })
28 |
29 | describe('properties', async () => {
30 | let result, propertyCount
31 |
32 | before(async () => {
33 | result = await marketplace.createProperty('112 Main St', web3.utils.toWei('1', 'Ether'), { from: seller })
34 | propertyCount = await marketplace.propertyCount()
35 | })
36 |
37 | it('creates properties', async () => {
38 | // SUCCESS
39 | assert.equal(propertyCount, 1)
40 | const event = result.logs[0].args
41 | assert.equal(event.id.toNumber(), propertyCount.toNumber(), 'id is correct')
42 | assert.equal(event.streetAddress, '112 Main St', 'name is correct')
43 | assert.equal(event.price, '1000000000000000000', 'price is correct')
44 | assert.equal(event.owner, seller, 'owner is correct')
45 | assert.equal(event.purchased, false, 'purchased is correct')
46 |
47 | // FAILURE: Product must have a name
48 | await await marketplace.createProperty('', web3.utils.toWei('1', 'Ether'), { from: seller }).should.be.rejected;
49 | // FAILURE: Product must have a price
50 | await await marketplace.createProperty('112 Main St', 0, { from: seller }).should.be.rejected;
51 | })
52 |
53 | it('lists properties', async () => {
54 | const property = await marketplace.properties(propertyCount)
55 | assert.equal(property.id.toNumber(), propertyCount.toNumber(), 'id is correct')
56 | assert.equal(property.streetAddress, '112 Main St', 'name is correct')
57 | assert.equal(property.price, '1000000000000000000', 'price is correct')
58 | assert.equal(property.owner, seller, 'owner is correct')
59 | assert.equal(property.purchased, false, 'purchased is correct')
60 | })
61 |
62 | it('sells properties', async () => {
63 | // Track the seller balance before purchase
64 | let oldSellerBalance
65 | oldSellerBalance = await web3.eth.getBalance(seller)
66 | oldSellerBalance = new web3.utils.BN(oldSellerBalance)
67 |
68 | // SUCCESS: Buyer makes purchase
69 | result = await marketplace.purchaseProperty(propertyCount, { from: buyer, value: web3.utils.toWei('1', 'Ether')})
70 |
71 | // Check logs
72 | const event = result.logs[0].args
73 | assert.equal(event.id.toNumber(), propertyCount.toNumber(), 'id is correct')
74 | assert.equal(event.streetAddress, '112 Main St', 'name is correct')
75 | assert.equal(event.price, '1000000000000000000', 'price is correct')
76 | assert.equal(event.owner, buyer, 'owner is correct')
77 | assert.equal(event.purchased, true, 'purchased is correct')
78 |
79 | // Check that seller received funds
80 | let newSellerBalance
81 | newSellerBalance = await web3.eth.getBalance(seller)
82 | newSellerBalance = new web3.utils.BN(newSellerBalance)
83 |
84 | let price
85 | price = web3.utils.toWei('1', 'Ether')
86 | price = new web3.utils.BN(price)
87 |
88 | const exepectedBalance = oldSellerBalance.add(price)
89 |
90 | assert.equal(newSellerBalance.toString(), exepectedBalance.toString())
91 |
92 | // FAILURE: Tries to buy a product that does not exist, i.e., product must have valid id
93 | await marketplace.purchaseProperty(99, { from: buyer, value: web3.utils.toWei('1', 'Ether')}).should.be.rejected; // FAILURE: Buyer tries to buy without enough ether
94 | // FAILURE: Buyer tries to buy without enough ether
95 | await marketplace.purchaseProperty(propertyCount, { from: buyer, value: web3.utils.toWei('0.5', 'Ether') }).should.be.rejected;
96 | // FAILURE: Deployer tries to buy the product, i.e., product can't be purchased twice
97 | await marketplace.purchaseProperty(propertyCount, { from: deployer, value: web3.utils.toWei('1', 'Ether') }).should.be.rejected;
98 | // FAILURE: Buyer tries to buy again, i.e., buyer can't be the seller
99 | await marketplace.purchaseProperty(propertyCount, { from: buyer, value: web3.utils.toWei('1', 'Ether') }).should.be.rejected;
100 | })
101 |
102 | })
103 | })
104 |
--------------------------------------------------------------------------------
/src/serviceWorker.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://bit.ly/CRA-PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === 'localhost' ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === '[::1]' ||
17 | // 127.0.0.1/8 is considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 | )
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener('load', () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | 'This web app is being served cache-first by a service ' +
46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then(registration => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === 'installed') {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | 'New content is available and will be used when all ' +
74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log('Content is cached for offline use.');
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch(error => {
97 | console.error('Error during service worker registration:', error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl)
104 | .then(response => {
105 | // Ensure service worker exists, and that we really are getting a JS file.
106 | const contentType = response.headers.get('content-type');
107 | if (
108 | response.status === 404 ||
109 | (contentType != null && contentType.indexOf('javascript') === -1)
110 | ) {
111 | // No service worker found. Probably a different app. Reload the page.
112 | navigator.serviceWorker.ready.then(registration => {
113 | registration.unregister().then(() => {
114 | window.location.reload();
115 | });
116 | });
117 | } else {
118 | // Service worker found. Proceed as normal.
119 | registerValidSW(swUrl, config);
120 | }
121 | })
122 | .catch(() => {
123 | console.log(
124 | 'No internet connection found. App is running in offline mode.'
125 | );
126 | });
127 | }
128 |
129 | export function unregister() {
130 | if ('serviceWorker' in navigator) {
131 | navigator.serviceWorker.ready.then(registration => {
132 | registration.unregister();
133 | });
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/src/abis/Migrations.json:
--------------------------------------------------------------------------------
1 | {
2 | "contractName": "Migrations",
3 | "abi": [
4 | {
5 | "inputs": [],
6 | "payable": false,
7 | "stateMutability": "nonpayable",
8 | "type": "constructor"
9 | },
10 | {
11 | "constant": true,
12 | "inputs": [],
13 | "name": "last_completed_migration",
14 | "outputs": [
15 | {
16 | "internalType": "uint256",
17 | "name": "",
18 | "type": "uint256"
19 | }
20 | ],
21 | "payable": false,
22 | "stateMutability": "view",
23 | "type": "function"
24 | },
25 | {
26 | "constant": true,
27 | "inputs": [],
28 | "name": "owner",
29 | "outputs": [
30 | {
31 | "internalType": "address",
32 | "name": "",
33 | "type": "address"
34 | }
35 | ],
36 | "payable": false,
37 | "stateMutability": "view",
38 | "type": "function"
39 | },
40 | {
41 | "constant": false,
42 | "inputs": [
43 | {
44 | "internalType": "uint256",
45 | "name": "completed",
46 | "type": "uint256"
47 | }
48 | ],
49 | "name": "setCompleted",
50 | "outputs": [],
51 | "payable": false,
52 | "stateMutability": "nonpayable",
53 | "type": "function"
54 | },
55 | {
56 | "constant": false,
57 | "inputs": [
58 | {
59 | "internalType": "address",
60 | "name": "new_address",
61 | "type": "address"
62 | }
63 | ],
64 | "name": "upgrade",
65 | "outputs": [],
66 | "payable": false,
67 | "stateMutability": "nonpayable",
68 | "type": "function"
69 | }
70 | ],
71 | "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/gregory/code/real-estate-market/src/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/gregory/code/real-estate-market/src/contracts/Migrations.sol\":{\"keccak256\":\"0xfdb731592344e2a2890faf03baec7b4bee7057ffba18ba6dbb6eec8db85f8f4c\",\"urls\":[\"bzz-raw://f9b488bbb84816dd04c1b155e943319758db16ee943943648fb264bccecc9879\",\"dweb:/ipfs/QmbW34mYrj3uLteyHf3S46pnp9bnwovtCXHbdBHfzMkSZx\"]}},\"version\":1}",
72 | "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102b7806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a723158202da144fff848acb16a2af48b7e18633ec81624ac545d0f8fa663f0d99486826f64736f6c63430005100032",
73 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea265627a7a723158202da144fff848acb16a2af48b7e18633ec81624ac545d0f8fa663f0d99486826f64736f6c63430005100032",
74 | "sourceMap": "34:480:1:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:1;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;",
75 | "deployedSourceMap": "34:480:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:480:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:1;;;;;;;;;;;;;;;;;;;:::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:1;;;;;;;;;;;;;;;;;:::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:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:1;;;;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",
76 | "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",
77 | "sourcePath": "/Users/gregory/code/real-estate-market/src/contracts/Migrations.sol",
78 | "ast": {
79 | "absolutePath": "/Users/gregory/code/real-estate-market/src/contracts/Migrations.sol",
80 | "exportedSymbols": {
81 | "Migrations": [
82 | 247
83 | ]
84 | },
85 | "id": 248,
86 | "nodeType": "SourceUnit",
87 | "nodes": [
88 | {
89 | "id": 192,
90 | "literals": [
91 | "solidity",
92 | ">=",
93 | "0.4",
94 | ".21",
95 | "<",
96 | "0.6",
97 | ".0"
98 | ],
99 | "nodeType": "PragmaDirective",
100 | "src": "0:32:1"
101 | },
102 | {
103 | "baseContracts": [],
104 | "contractDependencies": [],
105 | "contractKind": "contract",
106 | "documentation": null,
107 | "fullyImplemented": true,
108 | "id": 247,
109 | "linearizedBaseContracts": [
110 | 247
111 | ],
112 | "name": "Migrations",
113 | "nodeType": "ContractDefinition",
114 | "nodes": [
115 | {
116 | "constant": false,
117 | "id": 194,
118 | "name": "owner",
119 | "nodeType": "VariableDeclaration",
120 | "scope": 247,
121 | "src": "58:20:1",
122 | "stateVariable": true,
123 | "storageLocation": "default",
124 | "typeDescriptions": {
125 | "typeIdentifier": "t_address",
126 | "typeString": "address"
127 | },
128 | "typeName": {
129 | "id": 193,
130 | "name": "address",
131 | "nodeType": "ElementaryTypeName",
132 | "src": "58:7:1",
133 | "stateMutability": "nonpayable",
134 | "typeDescriptions": {
135 | "typeIdentifier": "t_address",
136 | "typeString": "address"
137 | }
138 | },
139 | "value": null,
140 | "visibility": "public"
141 | },
142 | {
143 | "constant": false,
144 | "id": 196,
145 | "name": "last_completed_migration",
146 | "nodeType": "VariableDeclaration",
147 | "scope": 247,
148 | "src": "82:36:1",
149 | "stateVariable": true,
150 | "storageLocation": "default",
151 | "typeDescriptions": {
152 | "typeIdentifier": "t_uint256",
153 | "typeString": "uint256"
154 | },
155 | "typeName": {
156 | "id": 195,
157 | "name": "uint",
158 | "nodeType": "ElementaryTypeName",
159 | "src": "82:4:1",
160 | "typeDescriptions": {
161 | "typeIdentifier": "t_uint256",
162 | "typeString": "uint256"
163 | }
164 | },
165 | "value": null,
166 | "visibility": "public"
167 | },
168 | {
169 | "body": {
170 | "id": 204,
171 | "nodeType": "Block",
172 | "src": "144:29:1",
173 | "statements": [
174 | {
175 | "expression": {
176 | "argumentTypes": null,
177 | "id": 202,
178 | "isConstant": false,
179 | "isLValue": false,
180 | "isPure": false,
181 | "lValueRequested": false,
182 | "leftHandSide": {
183 | "argumentTypes": null,
184 | "id": 199,
185 | "name": "owner",
186 | "nodeType": "Identifier",
187 | "overloadedDeclarations": [],
188 | "referencedDeclaration": 194,
189 | "src": "150:5:1",
190 | "typeDescriptions": {
191 | "typeIdentifier": "t_address",
192 | "typeString": "address"
193 | }
194 | },
195 | "nodeType": "Assignment",
196 | "operator": "=",
197 | "rightHandSide": {
198 | "argumentTypes": null,
199 | "expression": {
200 | "argumentTypes": null,
201 | "id": 200,
202 | "name": "msg",
203 | "nodeType": "Identifier",
204 | "overloadedDeclarations": [],
205 | "referencedDeclaration": 262,
206 | "src": "158:3:1",
207 | "typeDescriptions": {
208 | "typeIdentifier": "t_magic_message",
209 | "typeString": "msg"
210 | }
211 | },
212 | "id": 201,
213 | "isConstant": false,
214 | "isLValue": false,
215 | "isPure": false,
216 | "lValueRequested": false,
217 | "memberName": "sender",
218 | "nodeType": "MemberAccess",
219 | "referencedDeclaration": null,
220 | "src": "158:10:1",
221 | "typeDescriptions": {
222 | "typeIdentifier": "t_address_payable",
223 | "typeString": "address payable"
224 | }
225 | },
226 | "src": "150:18:1",
227 | "typeDescriptions": {
228 | "typeIdentifier": "t_address",
229 | "typeString": "address"
230 | }
231 | },
232 | "id": 203,
233 | "nodeType": "ExpressionStatement",
234 | "src": "150:18:1"
235 | }
236 | ]
237 | },
238 | "documentation": null,
239 | "id": 205,
240 | "implemented": true,
241 | "kind": "constructor",
242 | "modifiers": [],
243 | "name": "",
244 | "nodeType": "FunctionDefinition",
245 | "parameters": {
246 | "id": 197,
247 | "nodeType": "ParameterList",
248 | "parameters": [],
249 | "src": "134:2:1"
250 | },
251 | "returnParameters": {
252 | "id": 198,
253 | "nodeType": "ParameterList",
254 | "parameters": [],
255 | "src": "144:0:1"
256 | },
257 | "scope": 247,
258 | "src": "123:50:1",
259 | "stateMutability": "nonpayable",
260 | "superFunction": null,
261 | "visibility": "public"
262 | },
263 | {
264 | "body": {
265 | "id": 213,
266 | "nodeType": "Block",
267 | "src": "199:37:1",
268 | "statements": [
269 | {
270 | "condition": {
271 | "argumentTypes": null,
272 | "commonType": {
273 | "typeIdentifier": "t_address",
274 | "typeString": "address"
275 | },
276 | "id": 210,
277 | "isConstant": false,
278 | "isLValue": false,
279 | "isPure": false,
280 | "lValueRequested": false,
281 | "leftExpression": {
282 | "argumentTypes": null,
283 | "expression": {
284 | "argumentTypes": null,
285 | "id": 207,
286 | "name": "msg",
287 | "nodeType": "Identifier",
288 | "overloadedDeclarations": [],
289 | "referencedDeclaration": 262,
290 | "src": "209:3:1",
291 | "typeDescriptions": {
292 | "typeIdentifier": "t_magic_message",
293 | "typeString": "msg"
294 | }
295 | },
296 | "id": 208,
297 | "isConstant": false,
298 | "isLValue": false,
299 | "isPure": false,
300 | "lValueRequested": false,
301 | "memberName": "sender",
302 | "nodeType": "MemberAccess",
303 | "referencedDeclaration": null,
304 | "src": "209:10:1",
305 | "typeDescriptions": {
306 | "typeIdentifier": "t_address_payable",
307 | "typeString": "address payable"
308 | }
309 | },
310 | "nodeType": "BinaryOperation",
311 | "operator": "==",
312 | "rightExpression": {
313 | "argumentTypes": null,
314 | "id": 209,
315 | "name": "owner",
316 | "nodeType": "Identifier",
317 | "overloadedDeclarations": [],
318 | "referencedDeclaration": 194,
319 | "src": "223:5:1",
320 | "typeDescriptions": {
321 | "typeIdentifier": "t_address",
322 | "typeString": "address"
323 | }
324 | },
325 | "src": "209:19:1",
326 | "typeDescriptions": {
327 | "typeIdentifier": "t_bool",
328 | "typeString": "bool"
329 | }
330 | },
331 | "falseBody": null,
332 | "id": 212,
333 | "nodeType": "IfStatement",
334 | "src": "205:26:1",
335 | "trueBody": {
336 | "id": 211,
337 | "nodeType": "PlaceholderStatement",
338 | "src": "230:1:1"
339 | }
340 | }
341 | ]
342 | },
343 | "documentation": null,
344 | "id": 214,
345 | "name": "restricted",
346 | "nodeType": "ModifierDefinition",
347 | "parameters": {
348 | "id": 206,
349 | "nodeType": "ParameterList",
350 | "parameters": [],
351 | "src": "196:2:1"
352 | },
353 | "src": "177:59:1",
354 | "visibility": "internal"
355 | },
356 | {
357 | "body": {
358 | "id": 225,
359 | "nodeType": "Block",
360 | "src": "296:47:1",
361 | "statements": [
362 | {
363 | "expression": {
364 | "argumentTypes": null,
365 | "id": 223,
366 | "isConstant": false,
367 | "isLValue": false,
368 | "isPure": false,
369 | "lValueRequested": false,
370 | "leftHandSide": {
371 | "argumentTypes": null,
372 | "id": 221,
373 | "name": "last_completed_migration",
374 | "nodeType": "Identifier",
375 | "overloadedDeclarations": [],
376 | "referencedDeclaration": 196,
377 | "src": "302:24:1",
378 | "typeDescriptions": {
379 | "typeIdentifier": "t_uint256",
380 | "typeString": "uint256"
381 | }
382 | },
383 | "nodeType": "Assignment",
384 | "operator": "=",
385 | "rightHandSide": {
386 | "argumentTypes": null,
387 | "id": 222,
388 | "name": "completed",
389 | "nodeType": "Identifier",
390 | "overloadedDeclarations": [],
391 | "referencedDeclaration": 216,
392 | "src": "329:9:1",
393 | "typeDescriptions": {
394 | "typeIdentifier": "t_uint256",
395 | "typeString": "uint256"
396 | }
397 | },
398 | "src": "302:36:1",
399 | "typeDescriptions": {
400 | "typeIdentifier": "t_uint256",
401 | "typeString": "uint256"
402 | }
403 | },
404 | "id": 224,
405 | "nodeType": "ExpressionStatement",
406 | "src": "302:36:1"
407 | }
408 | ]
409 | },
410 | "documentation": null,
411 | "id": 226,
412 | "implemented": true,
413 | "kind": "function",
414 | "modifiers": [
415 | {
416 | "arguments": null,
417 | "id": 219,
418 | "modifierName": {
419 | "argumentTypes": null,
420 | "id": 218,
421 | "name": "restricted",
422 | "nodeType": "Identifier",
423 | "overloadedDeclarations": [],
424 | "referencedDeclaration": 214,
425 | "src": "285:10:1",
426 | "typeDescriptions": {
427 | "typeIdentifier": "t_modifier$__$",
428 | "typeString": "modifier ()"
429 | }
430 | },
431 | "nodeType": "ModifierInvocation",
432 | "src": "285:10:1"
433 | }
434 | ],
435 | "name": "setCompleted",
436 | "nodeType": "FunctionDefinition",
437 | "parameters": {
438 | "id": 217,
439 | "nodeType": "ParameterList",
440 | "parameters": [
441 | {
442 | "constant": false,
443 | "id": 216,
444 | "name": "completed",
445 | "nodeType": "VariableDeclaration",
446 | "scope": 226,
447 | "src": "262:14:1",
448 | "stateVariable": false,
449 | "storageLocation": "default",
450 | "typeDescriptions": {
451 | "typeIdentifier": "t_uint256",
452 | "typeString": "uint256"
453 | },
454 | "typeName": {
455 | "id": 215,
456 | "name": "uint",
457 | "nodeType": "ElementaryTypeName",
458 | "src": "262:4:1",
459 | "typeDescriptions": {
460 | "typeIdentifier": "t_uint256",
461 | "typeString": "uint256"
462 | }
463 | },
464 | "value": null,
465 | "visibility": "internal"
466 | }
467 | ],
468 | "src": "261:16:1"
469 | },
470 | "returnParameters": {
471 | "id": 220,
472 | "nodeType": "ParameterList",
473 | "parameters": [],
474 | "src": "296:0:1"
475 | },
476 | "scope": 247,
477 | "src": "240:103:1",
478 | "stateMutability": "nonpayable",
479 | "superFunction": null,
480 | "visibility": "public"
481 | },
482 | {
483 | "body": {
484 | "id": 245,
485 | "nodeType": "Block",
486 | "src": "403:109:1",
487 | "statements": [
488 | {
489 | "assignments": [
490 | 234
491 | ],
492 | "declarations": [
493 | {
494 | "constant": false,
495 | "id": 234,
496 | "name": "upgraded",
497 | "nodeType": "VariableDeclaration",
498 | "scope": 245,
499 | "src": "409:19:1",
500 | "stateVariable": false,
501 | "storageLocation": "default",
502 | "typeDescriptions": {
503 | "typeIdentifier": "t_contract$_Migrations_$247",
504 | "typeString": "contract Migrations"
505 | },
506 | "typeName": {
507 | "contractScope": null,
508 | "id": 233,
509 | "name": "Migrations",
510 | "nodeType": "UserDefinedTypeName",
511 | "referencedDeclaration": 247,
512 | "src": "409:10:1",
513 | "typeDescriptions": {
514 | "typeIdentifier": "t_contract$_Migrations_$247",
515 | "typeString": "contract Migrations"
516 | }
517 | },
518 | "value": null,
519 | "visibility": "internal"
520 | }
521 | ],
522 | "id": 238,
523 | "initialValue": {
524 | "argumentTypes": null,
525 | "arguments": [
526 | {
527 | "argumentTypes": null,
528 | "id": 236,
529 | "name": "new_address",
530 | "nodeType": "Identifier",
531 | "overloadedDeclarations": [],
532 | "referencedDeclaration": 228,
533 | "src": "442:11:1",
534 | "typeDescriptions": {
535 | "typeIdentifier": "t_address",
536 | "typeString": "address"
537 | }
538 | }
539 | ],
540 | "expression": {
541 | "argumentTypes": [
542 | {
543 | "typeIdentifier": "t_address",
544 | "typeString": "address"
545 | }
546 | ],
547 | "id": 235,
548 | "name": "Migrations",
549 | "nodeType": "Identifier",
550 | "overloadedDeclarations": [],
551 | "referencedDeclaration": 247,
552 | "src": "431:10:1",
553 | "typeDescriptions": {
554 | "typeIdentifier": "t_type$_t_contract$_Migrations_$247_$",
555 | "typeString": "type(contract Migrations)"
556 | }
557 | },
558 | "id": 237,
559 | "isConstant": false,
560 | "isLValue": false,
561 | "isPure": false,
562 | "kind": "typeConversion",
563 | "lValueRequested": false,
564 | "names": [],
565 | "nodeType": "FunctionCall",
566 | "src": "431:23:1",
567 | "typeDescriptions": {
568 | "typeIdentifier": "t_contract$_Migrations_$247",
569 | "typeString": "contract Migrations"
570 | }
571 | },
572 | "nodeType": "VariableDeclarationStatement",
573 | "src": "409:45:1"
574 | },
575 | {
576 | "expression": {
577 | "argumentTypes": null,
578 | "arguments": [
579 | {
580 | "argumentTypes": null,
581 | "id": 242,
582 | "name": "last_completed_migration",
583 | "nodeType": "Identifier",
584 | "overloadedDeclarations": [],
585 | "referencedDeclaration": 196,
586 | "src": "482:24:1",
587 | "typeDescriptions": {
588 | "typeIdentifier": "t_uint256",
589 | "typeString": "uint256"
590 | }
591 | }
592 | ],
593 | "expression": {
594 | "argumentTypes": [
595 | {
596 | "typeIdentifier": "t_uint256",
597 | "typeString": "uint256"
598 | }
599 | ],
600 | "expression": {
601 | "argumentTypes": null,
602 | "id": 239,
603 | "name": "upgraded",
604 | "nodeType": "Identifier",
605 | "overloadedDeclarations": [],
606 | "referencedDeclaration": 234,
607 | "src": "460:8:1",
608 | "typeDescriptions": {
609 | "typeIdentifier": "t_contract$_Migrations_$247",
610 | "typeString": "contract Migrations"
611 | }
612 | },
613 | "id": 241,
614 | "isConstant": false,
615 | "isLValue": false,
616 | "isPure": false,
617 | "lValueRequested": false,
618 | "memberName": "setCompleted",
619 | "nodeType": "MemberAccess",
620 | "referencedDeclaration": 226,
621 | "src": "460:21:1",
622 | "typeDescriptions": {
623 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
624 | "typeString": "function (uint256) external"
625 | }
626 | },
627 | "id": 243,
628 | "isConstant": false,
629 | "isLValue": false,
630 | "isPure": false,
631 | "kind": "functionCall",
632 | "lValueRequested": false,
633 | "names": [],
634 | "nodeType": "FunctionCall",
635 | "src": "460:47:1",
636 | "typeDescriptions": {
637 | "typeIdentifier": "t_tuple$__$",
638 | "typeString": "tuple()"
639 | }
640 | },
641 | "id": 244,
642 | "nodeType": "ExpressionStatement",
643 | "src": "460:47:1"
644 | }
645 | ]
646 | },
647 | "documentation": null,
648 | "id": 246,
649 | "implemented": true,
650 | "kind": "function",
651 | "modifiers": [
652 | {
653 | "arguments": null,
654 | "id": 231,
655 | "modifierName": {
656 | "argumentTypes": null,
657 | "id": 230,
658 | "name": "restricted",
659 | "nodeType": "Identifier",
660 | "overloadedDeclarations": [],
661 | "referencedDeclaration": 214,
662 | "src": "392:10:1",
663 | "typeDescriptions": {
664 | "typeIdentifier": "t_modifier$__$",
665 | "typeString": "modifier ()"
666 | }
667 | },
668 | "nodeType": "ModifierInvocation",
669 | "src": "392:10:1"
670 | }
671 | ],
672 | "name": "upgrade",
673 | "nodeType": "FunctionDefinition",
674 | "parameters": {
675 | "id": 229,
676 | "nodeType": "ParameterList",
677 | "parameters": [
678 | {
679 | "constant": false,
680 | "id": 228,
681 | "name": "new_address",
682 | "nodeType": "VariableDeclaration",
683 | "scope": 246,
684 | "src": "364:19:1",
685 | "stateVariable": false,
686 | "storageLocation": "default",
687 | "typeDescriptions": {
688 | "typeIdentifier": "t_address",
689 | "typeString": "address"
690 | },
691 | "typeName": {
692 | "id": 227,
693 | "name": "address",
694 | "nodeType": "ElementaryTypeName",
695 | "src": "364:7:1",
696 | "stateMutability": "nonpayable",
697 | "typeDescriptions": {
698 | "typeIdentifier": "t_address",
699 | "typeString": "address"
700 | }
701 | },
702 | "value": null,
703 | "visibility": "internal"
704 | }
705 | ],
706 | "src": "363:21:1"
707 | },
708 | "returnParameters": {
709 | "id": 232,
710 | "nodeType": "ParameterList",
711 | "parameters": [],
712 | "src": "403:0:1"
713 | },
714 | "scope": 247,
715 | "src": "347:165:1",
716 | "stateMutability": "nonpayable",
717 | "superFunction": null,
718 | "visibility": "public"
719 | }
720 | ],
721 | "scope": 248,
722 | "src": "34:480:1"
723 | }
724 | ],
725 | "src": "0:515:1"
726 | },
727 | "legacyAST": {
728 | "absolutePath": "/Users/gregory/code/real-estate-market/src/contracts/Migrations.sol",
729 | "exportedSymbols": {
730 | "Migrations": [
731 | 247
732 | ]
733 | },
734 | "id": 248,
735 | "nodeType": "SourceUnit",
736 | "nodes": [
737 | {
738 | "id": 192,
739 | "literals": [
740 | "solidity",
741 | ">=",
742 | "0.4",
743 | ".21",
744 | "<",
745 | "0.6",
746 | ".0"
747 | ],
748 | "nodeType": "PragmaDirective",
749 | "src": "0:32:1"
750 | },
751 | {
752 | "baseContracts": [],
753 | "contractDependencies": [],
754 | "contractKind": "contract",
755 | "documentation": null,
756 | "fullyImplemented": true,
757 | "id": 247,
758 | "linearizedBaseContracts": [
759 | 247
760 | ],
761 | "name": "Migrations",
762 | "nodeType": "ContractDefinition",
763 | "nodes": [
764 | {
765 | "constant": false,
766 | "id": 194,
767 | "name": "owner",
768 | "nodeType": "VariableDeclaration",
769 | "scope": 247,
770 | "src": "58:20:1",
771 | "stateVariable": true,
772 | "storageLocation": "default",
773 | "typeDescriptions": {
774 | "typeIdentifier": "t_address",
775 | "typeString": "address"
776 | },
777 | "typeName": {
778 | "id": 193,
779 | "name": "address",
780 | "nodeType": "ElementaryTypeName",
781 | "src": "58:7:1",
782 | "stateMutability": "nonpayable",
783 | "typeDescriptions": {
784 | "typeIdentifier": "t_address",
785 | "typeString": "address"
786 | }
787 | },
788 | "value": null,
789 | "visibility": "public"
790 | },
791 | {
792 | "constant": false,
793 | "id": 196,
794 | "name": "last_completed_migration",
795 | "nodeType": "VariableDeclaration",
796 | "scope": 247,
797 | "src": "82:36:1",
798 | "stateVariable": true,
799 | "storageLocation": "default",
800 | "typeDescriptions": {
801 | "typeIdentifier": "t_uint256",
802 | "typeString": "uint256"
803 | },
804 | "typeName": {
805 | "id": 195,
806 | "name": "uint",
807 | "nodeType": "ElementaryTypeName",
808 | "src": "82:4:1",
809 | "typeDescriptions": {
810 | "typeIdentifier": "t_uint256",
811 | "typeString": "uint256"
812 | }
813 | },
814 | "value": null,
815 | "visibility": "public"
816 | },
817 | {
818 | "body": {
819 | "id": 204,
820 | "nodeType": "Block",
821 | "src": "144:29:1",
822 | "statements": [
823 | {
824 | "expression": {
825 | "argumentTypes": null,
826 | "id": 202,
827 | "isConstant": false,
828 | "isLValue": false,
829 | "isPure": false,
830 | "lValueRequested": false,
831 | "leftHandSide": {
832 | "argumentTypes": null,
833 | "id": 199,
834 | "name": "owner",
835 | "nodeType": "Identifier",
836 | "overloadedDeclarations": [],
837 | "referencedDeclaration": 194,
838 | "src": "150:5:1",
839 | "typeDescriptions": {
840 | "typeIdentifier": "t_address",
841 | "typeString": "address"
842 | }
843 | },
844 | "nodeType": "Assignment",
845 | "operator": "=",
846 | "rightHandSide": {
847 | "argumentTypes": null,
848 | "expression": {
849 | "argumentTypes": null,
850 | "id": 200,
851 | "name": "msg",
852 | "nodeType": "Identifier",
853 | "overloadedDeclarations": [],
854 | "referencedDeclaration": 262,
855 | "src": "158:3:1",
856 | "typeDescriptions": {
857 | "typeIdentifier": "t_magic_message",
858 | "typeString": "msg"
859 | }
860 | },
861 | "id": 201,
862 | "isConstant": false,
863 | "isLValue": false,
864 | "isPure": false,
865 | "lValueRequested": false,
866 | "memberName": "sender",
867 | "nodeType": "MemberAccess",
868 | "referencedDeclaration": null,
869 | "src": "158:10:1",
870 | "typeDescriptions": {
871 | "typeIdentifier": "t_address_payable",
872 | "typeString": "address payable"
873 | }
874 | },
875 | "src": "150:18:1",
876 | "typeDescriptions": {
877 | "typeIdentifier": "t_address",
878 | "typeString": "address"
879 | }
880 | },
881 | "id": 203,
882 | "nodeType": "ExpressionStatement",
883 | "src": "150:18:1"
884 | }
885 | ]
886 | },
887 | "documentation": null,
888 | "id": 205,
889 | "implemented": true,
890 | "kind": "constructor",
891 | "modifiers": [],
892 | "name": "",
893 | "nodeType": "FunctionDefinition",
894 | "parameters": {
895 | "id": 197,
896 | "nodeType": "ParameterList",
897 | "parameters": [],
898 | "src": "134:2:1"
899 | },
900 | "returnParameters": {
901 | "id": 198,
902 | "nodeType": "ParameterList",
903 | "parameters": [],
904 | "src": "144:0:1"
905 | },
906 | "scope": 247,
907 | "src": "123:50:1",
908 | "stateMutability": "nonpayable",
909 | "superFunction": null,
910 | "visibility": "public"
911 | },
912 | {
913 | "body": {
914 | "id": 213,
915 | "nodeType": "Block",
916 | "src": "199:37:1",
917 | "statements": [
918 | {
919 | "condition": {
920 | "argumentTypes": null,
921 | "commonType": {
922 | "typeIdentifier": "t_address",
923 | "typeString": "address"
924 | },
925 | "id": 210,
926 | "isConstant": false,
927 | "isLValue": false,
928 | "isPure": false,
929 | "lValueRequested": false,
930 | "leftExpression": {
931 | "argumentTypes": null,
932 | "expression": {
933 | "argumentTypes": null,
934 | "id": 207,
935 | "name": "msg",
936 | "nodeType": "Identifier",
937 | "overloadedDeclarations": [],
938 | "referencedDeclaration": 262,
939 | "src": "209:3:1",
940 | "typeDescriptions": {
941 | "typeIdentifier": "t_magic_message",
942 | "typeString": "msg"
943 | }
944 | },
945 | "id": 208,
946 | "isConstant": false,
947 | "isLValue": false,
948 | "isPure": false,
949 | "lValueRequested": false,
950 | "memberName": "sender",
951 | "nodeType": "MemberAccess",
952 | "referencedDeclaration": null,
953 | "src": "209:10:1",
954 | "typeDescriptions": {
955 | "typeIdentifier": "t_address_payable",
956 | "typeString": "address payable"
957 | }
958 | },
959 | "nodeType": "BinaryOperation",
960 | "operator": "==",
961 | "rightExpression": {
962 | "argumentTypes": null,
963 | "id": 209,
964 | "name": "owner",
965 | "nodeType": "Identifier",
966 | "overloadedDeclarations": [],
967 | "referencedDeclaration": 194,
968 | "src": "223:5:1",
969 | "typeDescriptions": {
970 | "typeIdentifier": "t_address",
971 | "typeString": "address"
972 | }
973 | },
974 | "src": "209:19:1",
975 | "typeDescriptions": {
976 | "typeIdentifier": "t_bool",
977 | "typeString": "bool"
978 | }
979 | },
980 | "falseBody": null,
981 | "id": 212,
982 | "nodeType": "IfStatement",
983 | "src": "205:26:1",
984 | "trueBody": {
985 | "id": 211,
986 | "nodeType": "PlaceholderStatement",
987 | "src": "230:1:1"
988 | }
989 | }
990 | ]
991 | },
992 | "documentation": null,
993 | "id": 214,
994 | "name": "restricted",
995 | "nodeType": "ModifierDefinition",
996 | "parameters": {
997 | "id": 206,
998 | "nodeType": "ParameterList",
999 | "parameters": [],
1000 | "src": "196:2:1"
1001 | },
1002 | "src": "177:59:1",
1003 | "visibility": "internal"
1004 | },
1005 | {
1006 | "body": {
1007 | "id": 225,
1008 | "nodeType": "Block",
1009 | "src": "296:47:1",
1010 | "statements": [
1011 | {
1012 | "expression": {
1013 | "argumentTypes": null,
1014 | "id": 223,
1015 | "isConstant": false,
1016 | "isLValue": false,
1017 | "isPure": false,
1018 | "lValueRequested": false,
1019 | "leftHandSide": {
1020 | "argumentTypes": null,
1021 | "id": 221,
1022 | "name": "last_completed_migration",
1023 | "nodeType": "Identifier",
1024 | "overloadedDeclarations": [],
1025 | "referencedDeclaration": 196,
1026 | "src": "302:24:1",
1027 | "typeDescriptions": {
1028 | "typeIdentifier": "t_uint256",
1029 | "typeString": "uint256"
1030 | }
1031 | },
1032 | "nodeType": "Assignment",
1033 | "operator": "=",
1034 | "rightHandSide": {
1035 | "argumentTypes": null,
1036 | "id": 222,
1037 | "name": "completed",
1038 | "nodeType": "Identifier",
1039 | "overloadedDeclarations": [],
1040 | "referencedDeclaration": 216,
1041 | "src": "329:9:1",
1042 | "typeDescriptions": {
1043 | "typeIdentifier": "t_uint256",
1044 | "typeString": "uint256"
1045 | }
1046 | },
1047 | "src": "302:36:1",
1048 | "typeDescriptions": {
1049 | "typeIdentifier": "t_uint256",
1050 | "typeString": "uint256"
1051 | }
1052 | },
1053 | "id": 224,
1054 | "nodeType": "ExpressionStatement",
1055 | "src": "302:36:1"
1056 | }
1057 | ]
1058 | },
1059 | "documentation": null,
1060 | "id": 226,
1061 | "implemented": true,
1062 | "kind": "function",
1063 | "modifiers": [
1064 | {
1065 | "arguments": null,
1066 | "id": 219,
1067 | "modifierName": {
1068 | "argumentTypes": null,
1069 | "id": 218,
1070 | "name": "restricted",
1071 | "nodeType": "Identifier",
1072 | "overloadedDeclarations": [],
1073 | "referencedDeclaration": 214,
1074 | "src": "285:10:1",
1075 | "typeDescriptions": {
1076 | "typeIdentifier": "t_modifier$__$",
1077 | "typeString": "modifier ()"
1078 | }
1079 | },
1080 | "nodeType": "ModifierInvocation",
1081 | "src": "285:10:1"
1082 | }
1083 | ],
1084 | "name": "setCompleted",
1085 | "nodeType": "FunctionDefinition",
1086 | "parameters": {
1087 | "id": 217,
1088 | "nodeType": "ParameterList",
1089 | "parameters": [
1090 | {
1091 | "constant": false,
1092 | "id": 216,
1093 | "name": "completed",
1094 | "nodeType": "VariableDeclaration",
1095 | "scope": 226,
1096 | "src": "262:14:1",
1097 | "stateVariable": false,
1098 | "storageLocation": "default",
1099 | "typeDescriptions": {
1100 | "typeIdentifier": "t_uint256",
1101 | "typeString": "uint256"
1102 | },
1103 | "typeName": {
1104 | "id": 215,
1105 | "name": "uint",
1106 | "nodeType": "ElementaryTypeName",
1107 | "src": "262:4:1",
1108 | "typeDescriptions": {
1109 | "typeIdentifier": "t_uint256",
1110 | "typeString": "uint256"
1111 | }
1112 | },
1113 | "value": null,
1114 | "visibility": "internal"
1115 | }
1116 | ],
1117 | "src": "261:16:1"
1118 | },
1119 | "returnParameters": {
1120 | "id": 220,
1121 | "nodeType": "ParameterList",
1122 | "parameters": [],
1123 | "src": "296:0:1"
1124 | },
1125 | "scope": 247,
1126 | "src": "240:103:1",
1127 | "stateMutability": "nonpayable",
1128 | "superFunction": null,
1129 | "visibility": "public"
1130 | },
1131 | {
1132 | "body": {
1133 | "id": 245,
1134 | "nodeType": "Block",
1135 | "src": "403:109:1",
1136 | "statements": [
1137 | {
1138 | "assignments": [
1139 | 234
1140 | ],
1141 | "declarations": [
1142 | {
1143 | "constant": false,
1144 | "id": 234,
1145 | "name": "upgraded",
1146 | "nodeType": "VariableDeclaration",
1147 | "scope": 245,
1148 | "src": "409:19:1",
1149 | "stateVariable": false,
1150 | "storageLocation": "default",
1151 | "typeDescriptions": {
1152 | "typeIdentifier": "t_contract$_Migrations_$247",
1153 | "typeString": "contract Migrations"
1154 | },
1155 | "typeName": {
1156 | "contractScope": null,
1157 | "id": 233,
1158 | "name": "Migrations",
1159 | "nodeType": "UserDefinedTypeName",
1160 | "referencedDeclaration": 247,
1161 | "src": "409:10:1",
1162 | "typeDescriptions": {
1163 | "typeIdentifier": "t_contract$_Migrations_$247",
1164 | "typeString": "contract Migrations"
1165 | }
1166 | },
1167 | "value": null,
1168 | "visibility": "internal"
1169 | }
1170 | ],
1171 | "id": 238,
1172 | "initialValue": {
1173 | "argumentTypes": null,
1174 | "arguments": [
1175 | {
1176 | "argumentTypes": null,
1177 | "id": 236,
1178 | "name": "new_address",
1179 | "nodeType": "Identifier",
1180 | "overloadedDeclarations": [],
1181 | "referencedDeclaration": 228,
1182 | "src": "442:11:1",
1183 | "typeDescriptions": {
1184 | "typeIdentifier": "t_address",
1185 | "typeString": "address"
1186 | }
1187 | }
1188 | ],
1189 | "expression": {
1190 | "argumentTypes": [
1191 | {
1192 | "typeIdentifier": "t_address",
1193 | "typeString": "address"
1194 | }
1195 | ],
1196 | "id": 235,
1197 | "name": "Migrations",
1198 | "nodeType": "Identifier",
1199 | "overloadedDeclarations": [],
1200 | "referencedDeclaration": 247,
1201 | "src": "431:10:1",
1202 | "typeDescriptions": {
1203 | "typeIdentifier": "t_type$_t_contract$_Migrations_$247_$",
1204 | "typeString": "type(contract Migrations)"
1205 | }
1206 | },
1207 | "id": 237,
1208 | "isConstant": false,
1209 | "isLValue": false,
1210 | "isPure": false,
1211 | "kind": "typeConversion",
1212 | "lValueRequested": false,
1213 | "names": [],
1214 | "nodeType": "FunctionCall",
1215 | "src": "431:23:1",
1216 | "typeDescriptions": {
1217 | "typeIdentifier": "t_contract$_Migrations_$247",
1218 | "typeString": "contract Migrations"
1219 | }
1220 | },
1221 | "nodeType": "VariableDeclarationStatement",
1222 | "src": "409:45:1"
1223 | },
1224 | {
1225 | "expression": {
1226 | "argumentTypes": null,
1227 | "arguments": [
1228 | {
1229 | "argumentTypes": null,
1230 | "id": 242,
1231 | "name": "last_completed_migration",
1232 | "nodeType": "Identifier",
1233 | "overloadedDeclarations": [],
1234 | "referencedDeclaration": 196,
1235 | "src": "482:24:1",
1236 | "typeDescriptions": {
1237 | "typeIdentifier": "t_uint256",
1238 | "typeString": "uint256"
1239 | }
1240 | }
1241 | ],
1242 | "expression": {
1243 | "argumentTypes": [
1244 | {
1245 | "typeIdentifier": "t_uint256",
1246 | "typeString": "uint256"
1247 | }
1248 | ],
1249 | "expression": {
1250 | "argumentTypes": null,
1251 | "id": 239,
1252 | "name": "upgraded",
1253 | "nodeType": "Identifier",
1254 | "overloadedDeclarations": [],
1255 | "referencedDeclaration": 234,
1256 | "src": "460:8:1",
1257 | "typeDescriptions": {
1258 | "typeIdentifier": "t_contract$_Migrations_$247",
1259 | "typeString": "contract Migrations"
1260 | }
1261 | },
1262 | "id": 241,
1263 | "isConstant": false,
1264 | "isLValue": false,
1265 | "isPure": false,
1266 | "lValueRequested": false,
1267 | "memberName": "setCompleted",
1268 | "nodeType": "MemberAccess",
1269 | "referencedDeclaration": 226,
1270 | "src": "460:21:1",
1271 | "typeDescriptions": {
1272 | "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
1273 | "typeString": "function (uint256) external"
1274 | }
1275 | },
1276 | "id": 243,
1277 | "isConstant": false,
1278 | "isLValue": false,
1279 | "isPure": false,
1280 | "kind": "functionCall",
1281 | "lValueRequested": false,
1282 | "names": [],
1283 | "nodeType": "FunctionCall",
1284 | "src": "460:47:1",
1285 | "typeDescriptions": {
1286 | "typeIdentifier": "t_tuple$__$",
1287 | "typeString": "tuple()"
1288 | }
1289 | },
1290 | "id": 244,
1291 | "nodeType": "ExpressionStatement",
1292 | "src": "460:47:1"
1293 | }
1294 | ]
1295 | },
1296 | "documentation": null,
1297 | "id": 246,
1298 | "implemented": true,
1299 | "kind": "function",
1300 | "modifiers": [
1301 | {
1302 | "arguments": null,
1303 | "id": 231,
1304 | "modifierName": {
1305 | "argumentTypes": null,
1306 | "id": 230,
1307 | "name": "restricted",
1308 | "nodeType": "Identifier",
1309 | "overloadedDeclarations": [],
1310 | "referencedDeclaration": 214,
1311 | "src": "392:10:1",
1312 | "typeDescriptions": {
1313 | "typeIdentifier": "t_modifier$__$",
1314 | "typeString": "modifier ()"
1315 | }
1316 | },
1317 | "nodeType": "ModifierInvocation",
1318 | "src": "392:10:1"
1319 | }
1320 | ],
1321 | "name": "upgrade",
1322 | "nodeType": "FunctionDefinition",
1323 | "parameters": {
1324 | "id": 229,
1325 | "nodeType": "ParameterList",
1326 | "parameters": [
1327 | {
1328 | "constant": false,
1329 | "id": 228,
1330 | "name": "new_address",
1331 | "nodeType": "VariableDeclaration",
1332 | "scope": 246,
1333 | "src": "364:19:1",
1334 | "stateVariable": false,
1335 | "storageLocation": "default",
1336 | "typeDescriptions": {
1337 | "typeIdentifier": "t_address",
1338 | "typeString": "address"
1339 | },
1340 | "typeName": {
1341 | "id": 227,
1342 | "name": "address",
1343 | "nodeType": "ElementaryTypeName",
1344 | "src": "364:7:1",
1345 | "stateMutability": "nonpayable",
1346 | "typeDescriptions": {
1347 | "typeIdentifier": "t_address",
1348 | "typeString": "address"
1349 | }
1350 | },
1351 | "value": null,
1352 | "visibility": "internal"
1353 | }
1354 | ],
1355 | "src": "363:21:1"
1356 | },
1357 | "returnParameters": {
1358 | "id": 232,
1359 | "nodeType": "ParameterList",
1360 | "parameters": [],
1361 | "src": "403:0:1"
1362 | },
1363 | "scope": 247,
1364 | "src": "347:165:1",
1365 | "stateMutability": "nonpayable",
1366 | "superFunction": null,
1367 | "visibility": "public"
1368 | }
1369 | ],
1370 | "scope": 248,
1371 | "src": "34:480:1"
1372 | }
1373 | ],
1374 | "src": "0:515:1"
1375 | },
1376 | "compiler": {
1377 | "name": "solc",
1378 | "version": "0.5.16+commit.9c3226ce.Emscripten.clang"
1379 | },
1380 | "networks": {
1381 | "5777": {
1382 | "events": {},
1383 | "links": {},
1384 | "address": "0xB34F1941d4dcC30BAb8F147AE551621CF1c2AafA",
1385 | "transactionHash": "0x3d4378b038b7c472ff4aeb25e926b45a1c002ccaec7dd3d6aaa2496749c8d8a3"
1386 | }
1387 | },
1388 | "schemaVersion": "3.0.23",
1389 | "updatedAt": "2020-04-23T20:36:55.209Z",
1390 | "networkType": "ethereum",
1391 | "devdoc": {
1392 | "methods": {}
1393 | },
1394 | "userdoc": {
1395 | "methods": {}
1396 | }
1397 | }
--------------------------------------------------------------------------------