Repository: RedSquirrelTech/hoscdev Branch: master Commit: 244df4090053 Files: 118 Total size: 1.7 MB Directory structure: gitextract_vendmhmg/ ├── .gitignore ├── chapter-10+11/ │ ├── LICENSE │ ├── client/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── FundraiserCard.js │ │ ├── Home.js │ │ ├── NewFundraiser.js │ │ ├── Receipts.js │ │ ├── contracts/ │ │ │ ├── Fundraiser.json │ │ │ ├── FundraiserFactory.json │ │ │ ├── Migrations.json │ │ │ ├── Ownable.json │ │ │ └── SafeMath.json │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── utils/ │ │ └── getWeb3.js │ ├── contracts/ │ │ ├── Fundraiser.sol │ │ ├── FundraiserFactory.sol │ │ └── Migrations.sol │ ├── migrations/ │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_fundraiser_factory.js │ ├── test/ │ │ ├── TestSimpleStorage.sol │ │ └── simplestorage.js │ └── truffle-config.js ├── chapter-4/ │ └── greeter/ │ ├── contracts/ │ │ ├── Greeter.sol │ │ └── Migrations.sol │ ├── migrations/ │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_greeter.js │ ├── test/ │ │ └── greeter_test.js │ └── truffle-config.js ├── chapter-5/ │ └── greeter/ │ ├── client/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── contracts/ │ │ │ ├── Context.json │ │ │ ├── Greeter.json │ │ │ ├── Migrations.json │ │ │ └── Ownable.json │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── utils/ │ │ └── getWeb3.js │ ├── contracts/ │ │ ├── Greeter.sol │ │ └── Migrations.sol │ ├── migrations/ │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_greeter.js │ ├── package.json │ ├── test/ │ │ └── greeter_test.js │ └── truffle-config.js ├── chapter-6/ │ └── fundraiser/ │ ├── LICENSE │ ├── client/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── utils/ │ │ └── getWeb3.js │ ├── contracts/ │ │ ├── Fundraiser.sol │ │ └── Migrations.sol │ ├── migrations/ │ │ └── 1_initial_migration.js │ ├── test/ │ │ └── fundraiser_test.js │ └── truffle-config.js ├── chapter-7/ │ └── fundraiser/ │ ├── LICENSE │ ├── client/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── src/ │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── index.css │ │ ├── index.js │ │ ├── serviceWorker.js │ │ └── utils/ │ │ └── getWeb3.js │ ├── contracts/ │ │ ├── Fundraiser.sol │ │ ├── FundraiserFactory.sol │ │ └── Migrations.sol │ ├── migrations/ │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_fundraiser_factory.js │ ├── test/ │ │ ├── fundraiser_factory_test.js │ │ └── fundraiser_test.js │ └── truffle-config.js └── chapter-9/ ├── README.md ├── package.json ├── public/ │ ├── index.html │ └── manifest.json └── src/ ├── App.css ├── App.js ├── App.test.js ├── FundraiserCard.js ├── Home.js ├── NewFundraiser.js ├── Receipts.js ├── contracts/ │ ├── Factory.json │ ├── Fundraiser.json │ ├── Migrations.json │ └── SimpleStorage.json ├── index.css ├── index.js ├── serviceWorker.js └── utils/ └── getWeb3.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store node_modules/ build/ ================================================ FILE: chapter-10+11/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2018 Truffle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: chapter-10+11/client/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: chapter-10+11/client/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: chapter-10+11/client/package.json ================================================ { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^4.3.1", "@openzeppelin/contracts": "^2.3.0", "bootstrap": "^4.3.1", "cryptocompare": "^1.0.0", "get-eth-price": "^1.0.0", "normalize.css": "^8.0.1", "react": "^16.8.0", "react-bootstrap": "^1.0.0-beta.10", "react-dom": "^16.9.0", "react-redux": "^7.1.1", "react-router-dom": "^5.0.1", "react-scripts": "2.1.1", "redux": "^4.0.4", "web3": "^1.2.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } ================================================ FILE: chapter-10+11/client/public/index.html ================================================ React App
================================================ FILE: chapter-10+11/client/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: chapter-10+11/client/src/App.css ================================================ body { margin: 0 !important; } .App { text-align: center; } .donation-input-container { display: flex; } .withdrawal-button { margin-left: 10px; } .receipt-header { border-bottom: 1px solid gray; } .receipt-container { text-align: center; } .receipt-info { display: flex; padding: 50px; justify-content: space-between; } .donation-receipt-link { color: inherit; text-decoration: none; } .main-container { margin: 20px; } .donation-list { margin-top: 10px; margin-bottom: 10px; display: flex; justify-content: space-between; } .fundraiser-card-container { display: inline-flex; width: 250px; height: 250px; margin: 20px; } .MuiTextField-root { display: block !important; } .MuiInputBase-root { width: 300px !important; margin-left: 3px; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .owner-actions-container { button { margin-left: 20px; } } .nav-link { color: inherit; text-decoration: none; margin-right: 15px; } .nav-link:hover, .nav-link:active, .nav-link:visited { color: black; text-decoration: none; } ================================================ FILE: chapter-10+11/client/src/App.js ================================================ import React, { useState, useEffect } from "react"; import FactoryContract from "./contracts/FundraiserFactory.json"; import getWeb3 from "./utils/getWeb3"; import { makeStyles } from '@material-ui/core/styles'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import { BrowserRouter as Router, Route, NavLink } from "react-router-dom"; import NewFundraiser from './NewFundraiser' import Home from './Home' import Receipts from './Receipts' import "./App.css"; const App = () => { const [state, setState] = useState({web3: null, accounts: null, contract: null}); useEffect(() => { const init = async() => { try { // Get network provider and web3 instance. const web3 = await getWeb3(); // Use web3 to get the user's accounts. const accounts = await web3.eth.getAccounts(); // Get the contract instance. const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); // Set web3, accounts, and contract to the state, and then proceed with an setState({web3, accounts, contract: instance}); } catch(error) { // Catch any errors for any of the above operations. alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } init(); }, []); const useStyles = makeStyles({ root: { flexGrow: 1, }, }); const runExample = async () => { const { accounts, contract } = state; }; return (
Home New
) } export default App; ================================================ FILE: chapter-10+11/client/src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); ================================================ FILE: chapter-10+11/client/src/FundraiserCard.js ================================================ import React, { useEffect, useState } from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Card from '@material-ui/core/Card'; import CardActionArea from '@material-ui/core/CardActionArea'; import CardActions from '@material-ui/core/CardActions'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; import FilledInput from '@material-ui/core/FilledInput'; import FormControl from '@material-ui/core/FormControl'; import FormHelperText from '@material-ui/core/FormHelperText'; import Input from '@material-ui/core/Input'; import InputLabel from '@material-ui/core/InputLabel'; import OutlinedInput from '@material-ui/core/OutlinedInput'; import getWeb3 from "./utils/getWeb3"; import FundraiserContract from "./contracts/Fundraiser.json"; import Web3 from 'web3' import { Link } from 'react-router-dom' const cc = require('cryptocompare') const getModalStyle =() => { const top = 50; const left = 50; return { top, left, }; } const useStyles = makeStyles(theme => ({ container: { display: 'flex', flexWrap: 'wrap', }, formControl: { margin: theme.spacing(1), display: 'table-cell' }, card: { maxWidth: 450, height: 400 }, media: { height: 140, }, paper: { position: 'absolute', width: 500, backgroundColor: theme.palette.background.paper, border: 'none', boxShadow: 'none', padding: 4, }, })); const FundraiserCard = (props) => { const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const [ fund, setFundraiser ] = useState(null) const [ fundName, setFundname ] = useState(null) const [ description, setDescription ] = useState(null) const [ totalDonations, setTotalDonations ] = useState(null) const [ imageURL, setImageURL ] = useState(null) const [ url, setURL ] = useState(null) const [ open, setOpen] = React.useState(false); const [ donationAmount, setDonationAmount] = useState(null) const [ exchangeRate, setExchangeRate ] = useState(null) const [ userDonations, setUserDonations ] = useState(null) const [ isOwner, setIsOwner ] = useState(false) const [ beneficiary, setNewBeneficiary ] = useState('') const ethAmount = (donationAmount / exchangeRate || 0).toFixed(4) const { fundraiser } = props const classes = useStyles(); useEffect(() => { if (fundraiser) { init(fundraiser) } }, [fundraiser]); const init = async (fundraiser) => { try { const fund = fundraiser const networkId = await web3.eth.net.getId(); const deployedNetwork = FundraiserContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FundraiserContract.abi, fund ); setContract(instance) setAccounts(accounts) const name = await instance.methods.name().call() const description = await instance.methods.description().call() const totalDonations = await instance.methods.totalDonations().call() const imageURL = await instance.methods.imageURL().call() const url = await instance.methods.url().call() const exchangeRate = await cc.price('ETH', ['USD']) setExchangeRate(exchangeRate.USD) const eth = web3.utils.fromWei(totalDonations, 'ether') const dollarDonationAmount = exchangeRate.USD * eth setTotalDonations(dollarDonationAmount.toFixed(2)) setFundname(name) setDescription(description) setImageURL(imageURL) setURL(url) const userDonations = await instance.methods.myDonations().call({ from: accounts[0]}) console.log(userDonations) setUserDonations(userDonations) const isUser = accounts[0] const isOwner = await instance.methods.owner().call() if (isOwner === accounts[0]) { setIsOwner(true) } } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } window.ethereum.on('accountsChanged', function (accounts) { window.location.reload() }) const handleOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; const submitFunds = async () => { const fundraisercontract = contract const ethRate = exchangeRate const ethTotal = donationAmount / ethRate const donation = web3.utils.toWei(ethTotal.toString()) await contract.methods.donate().send({ from: accounts[0], value: donation, gas: 650000 }) setOpen(false); } const renderDonationsList = () => { var donations = userDonations if (donations === null) {return null} const totalDonations = donations.values.length let donationList = [] var i for (i = 0; i < totalDonations; i++) { const ethAmount = web3.utils.fromWei(donations.values[i]) const userDonation = exchangeRate * ethAmount const donationDate = donations.dates[i] donationList.push({ donationAmount: userDonation.toFixed(2), date: donationDate}) } return donationList.map((donation) => { return (

${donation.donationAmount}

) }) } const withdrawalFunds = async () => { await contract.methods.withdraw().send({ from: accounts[0], }) alert('Funds Withdrawn!') } const setBeneficiary = async () => { await contract.methods.setBeneficiary(beneficiary).send({ from: accounts[0], }) alert(`Fundraiser Beneficiary Changed`) } return (
Donate to {fundName}

{description}

$ setDonationAmount(e.target.value)} placeholder="0.00" />

Eth: {ethAmount}

My donations

{renderDonationsList()}
{isOwner &&
Beneficiary: setNewBeneficiary(e.target.value)} placeholder="Set Beneficiary" />
}
{isOwner && }
{fundName}

{description}

Total Donations: ${totalDonations}

) } export default FundraiserCard; ================================================ FILE: chapter-10+11/client/src/Home.js ================================================ import React, { useState, useEffect } from "react"; import { makeStyles } from '@material-ui/core/styles'; import FundraiserCard from './FundraiserCard' import getWeb3 from "./utils/getWeb3"; import FactoryContract from "./contracts/FundraiserFactory.json"; import Web3 from 'web3' const useStyles = makeStyles(theme => ({ button: { margin: theme.spacing(1), }, input: { display: 'none', }, })); const Home = () => { const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const [ funds, setFunds ] = useState([]) const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) useEffect(() => { init() }, []); const init = async () => { try { const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); setContract(instance) setAccounts(accounts) const funds = await instance.methods.fundraisers(10, 0).call() setFunds(funds) } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } const displayFundraisers = () => { return funds.map((fundraiser) => { return ( ) }) } return (
{displayFundraisers()}
) } export default Home; ================================================ FILE: chapter-10+11/client/src/NewFundraiser.js ================================================ import React, { useState, useEffect } from "react"; import FormControl from '@material-ui/core/FormControl'; import { makeStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import MenuItem from '@material-ui/core/MenuItem'; import TextField from '@material-ui/core/TextField'; import getWeb3 from "./utils/getWeb3"; import FactoryContract from "./contracts/FundraiserFactory.json"; import Web3 from 'web3' const useStyles = makeStyles(theme => ({ container: { display: 'flex', flexWrap: 'wrap', }, textField: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), }, dense: { marginTop: theme.spacing(2), }, menu: { width: 200, }, })); const NewFundraiser = () => { const [labelWidth, setLabelWidth] = React.useState(0); const labelRef = React.useRef(null); const classes = useStyles(); const [ web3, setWeb3 ] = useState(null) useEffect(() => { const init = async() => { try { const web3 = await getWeb3(); const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); setWeb3(web3) setContract(instance) setAccounts(accounts) } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } init(); }, []); const [ name, setFundraiserName ] = useState(null) const [ website, setFundraiserWebsite ] = useState(null) const [ description, setFundraiserDescription ] = useState(null) const [ image, setImage ] = useState(null) const [ address, setAddress ] = useState(null) const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const handleSubmit = async () => { const imageURL = image const url = website const beneficiary = address const currentUser = await web3.currentProvider.selectedAddress const transaction = await contract.methods.createFundraiser( name, url, imageURL, description, beneficiary ).send({ from: accounts[0] }) alert('Successfully created fundraiser') } return (

Create A New Fundraiser

setFundraiserName(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setFundraiserWebsite(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setFundraiserDescription(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setImage(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setAddress(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} />
) } export default NewFundraiser; ================================================ FILE: chapter-10+11/client/src/Receipts.js ================================================ import React, { useState, useEffect } from "react"; const Receipts = (props) => { const [ donation, setDonation ] = useState(null) const [ fundName, setFundName ] = useState(null) const [ date, setDate ] = useState(null) useEffect(() => { const { donation, date, fund } = props.location.state const formattedDate = new Date(parseInt(date)) setDonation(donation) setDate(formattedDate.toString()) setFundName(fund) }, []); return (

Thank you for your donation to {fundName}

Date of Donation: {date}
Donation Value: ${donation}
) } export default Receipts; ================================================ FILE: chapter-10+11/client/src/contracts/Fundraiser.json ================================================ { "contractName": "Fundraiser", "abi": [ { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "donationsCount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "beneficiary", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "url", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "description", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "imageURL", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalDonations", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "name": "_name", "type": "string" }, { "name": "_url", "type": "string" }, { "name": "_imageURL", "type": "string" }, { "name": "_description", "type": "string" }, { "name": "_beneficiary", "type": "address" }, { "name": "_custodian", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "donor", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "DonationReceived", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "Withdraw", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": false, "inputs": [ { "name": "_beneficiary", "type": "address" } ], "name": "setBeneficiary", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "myDonationsCount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "donate", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [], "name": "myDonations", "outputs": [ { "name": "values", "type": "uint256[]" }, { "name": "dates", "type": "uint256[]" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"myDonationsCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"myDonations\",\"outputs\":[{\"name\":\"values\",\"type\":\"uint256[]\"},{\"name\":\"dates\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_beneficiary\",\"type\":\"address\"}],\"name\":\"setBeneficiary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"donationsCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"beneficiary\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"url\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"description\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"imageURL\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalDonations\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"donate\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_url\",\"type\":\"string\"},{\"name\":\"_imageURL\",\"type\":\"string\"},{\"name\":\"_description\",\"type\":\"string\"},{\"name\":\"_beneficiary\",\"type\":\"address\"},{\"name\":\"_custodian\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"donor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"DonationReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol\":\"Fundraiser\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol\":{\"keccak256\":\"0x4c71de6bd99f371b0ccbf390caa727bfe9429f7227ea476bef46921e7394235a\",\"urls\":[\"bzzr://e74b39014904a052c9d666edb293af447a25a9efe53b46489cbf6fa9f7c0e90e\"]},\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x4ccf2d7b51873db1ccfd54ca2adae5eac3b184f9699911ed4490438419f1c690\",\"urls\":[\"bzzr://1604f5b6d6e916c154efd8c6720cda069e5ba32dfa0a9dedf2b42e5b02d07f89\"]},\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]}},\"version\":1}", "bytecode": "0x60806040523480156200001157600080fd5b506040516200174338038062001743833981018060405260c08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b828101905060208101848111156200006757600080fd5b81518560018202830111640100000000821117156200008557600080fd5b50509291906020018051640100000000811115620000a257600080fd5b82810190506020810184811115620000b957600080fd5b8151856001820283011164010000000082111715620000d757600080fd5b50509291906020018051640100000000811115620000f457600080fd5b828101905060208101848111156200010b57600080fd5b81518560018202830111640100000000821117156200012957600080fd5b505092919060200180516401000000008111156200014657600080fd5b828101905060208101848111156200015d57600080fd5b81518560018202830111640100000000821117156200017b57600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600290805190602001906200026e9291906200045e565b508460039080519060200190620002879291906200045e565b508360049080519060200190620002a09291906200045e565b508260059080519060200190620002b99291906200045e565b5081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200030c816200031860201b60201c565b5050505050506200050d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806200171d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004a157805160ff1916838001178555620004d2565b82800160010185558215620004d2579182015b82811115620004d1578251825591602001919060010190620004b4565b5b509050620004e19190620004e5565b5090565b6200050a91905b8082111562000506576000816000905550600101620004ec565b5090565b90565b611200806200051d6000396000f3fe6080604052600436106100f35760003560e01c8063715018a61161008a578063b90497e011610059578063b90497e014610538578063de2ed893146105c8578063ed88c68e146105f3578063f2fde38b146105fd576100f3565b8063715018a61461040b5780637284e416146104225780638da5cb5b146104b25780638f32d59b14610509576100f3565b80631f522595116100c65780631f522595146102e257806338af3eed1461030d5780633ccfd60b146103645780635600f04f1461037b576100f3565b80630180b97c1461012257806306fdde031461014d5780631a57f7b4146101dd5780631c31f71014610291575b6101083460075461064e90919063ffffffff16565b600781905550600860008154809291906001019190505550005b34801561012e57600080fd5b506101376106d6565b6040518082815260200191505060405180910390f35b34801561015957600080fd5b50610162610720565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a2578082015181840152602081019050610187565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e957600080fd5b506101f26107be565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561023957808201518184015260208101905061021e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561027b578082015181840152602081019050610260565b5050505090500194505050505060405180910390f35b34801561029d57600080fd5b506102e0600480360360208110156102b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ef565b005b3480156102ee57600080fd5b506102f76109ad565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b506103226109b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037057600080fd5b506103796109d9565b005b34801561038757600080fd5b50610390610b12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d05780820151818401526020810190506103b5565b50505050905090810190601f1680156103fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041757600080fd5b50610420610bb0565b005b34801561042e57600080fd5b50610437610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104c7610d87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051557600080fd5b5061051e610db0565b604051808215151515815260200191505060405180910390f35b34801561054457600080fd5b5061054d610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058d578082015181840152602081019050610572565b50505050905090810190601f1680156105ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d457600080fd5b506105dd610ea5565b6040518082815260200191505060405180910390f35b6105fb610eab565b005b34801561060957600080fd5b5061064c6004803603602081101561062057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fca565b005b6000808284019050838110156106cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905090565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b505050505081565b60608060006107cb6106d6565b9050806040519080825280602002602001820160405280156107fc5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561082e5781602001602082028038833980820191505090505b50915060008090505b818110156108e3576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061088b57fe5b9060005260206000209060020201905080600001548583815181106108ac57fe5b60200260200101818152505080600101548483815181106108c957fe5b602002602001018181525050508080600101915050610837565b50828292509250509091565b6108f7610db0565b610969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e1610db0565b610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ad7573d6000803e3d6000fd5b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d816040518082815260200191505060405180910390a150565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ba85780601f10610b7d57610100808354040283529160200191610ba8565b820191906000526020600020905b815481529060010190602001808311610b8b57829003601f168201915b505050505081565b610bb8610db0565b610c2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e9d5780601f10610e7257610100808354040283529160200191610e9d565b820191906000526020600020905b815481529060010190602001808311610e8057829003601f168201915b505050505081565b60075481565b610eb3611194565b6040518060400160405280348152602001428152509050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010155505050610f613460075461064e90919063ffffffff16565b6007819055506008600081548092919060010191905055503373ffffffffffffffffffffffffffffffffffffffff167f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c52346040518082815260200191505060405180910390a250565b610fd2610db0565b611044576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61104d81611050565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111af6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058209fbfa484628b02babb980313ae79b77e708df8b0c46024caff44504889d7641100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "deployedBytecode": "0x6080604052600436106100f35760003560e01c8063715018a61161008a578063b90497e011610059578063b90497e014610538578063de2ed893146105c8578063ed88c68e146105f3578063f2fde38b146105fd576100f3565b8063715018a61461040b5780637284e416146104225780638da5cb5b146104b25780638f32d59b14610509576100f3565b80631f522595116100c65780631f522595146102e257806338af3eed1461030d5780633ccfd60b146103645780635600f04f1461037b576100f3565b80630180b97c1461012257806306fdde031461014d5780631a57f7b4146101dd5780631c31f71014610291575b6101083460075461064e90919063ffffffff16565b600781905550600860008154809291906001019190505550005b34801561012e57600080fd5b506101376106d6565b6040518082815260200191505060405180910390f35b34801561015957600080fd5b50610162610720565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a2578082015181840152602081019050610187565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e957600080fd5b506101f26107be565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561023957808201518184015260208101905061021e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561027b578082015181840152602081019050610260565b5050505090500194505050505060405180910390f35b34801561029d57600080fd5b506102e0600480360360208110156102b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ef565b005b3480156102ee57600080fd5b506102f76109ad565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b506103226109b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037057600080fd5b506103796109d9565b005b34801561038757600080fd5b50610390610b12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d05780820151818401526020810190506103b5565b50505050905090810190601f1680156103fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041757600080fd5b50610420610bb0565b005b34801561042e57600080fd5b50610437610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104c7610d87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051557600080fd5b5061051e610db0565b604051808215151515815260200191505060405180910390f35b34801561054457600080fd5b5061054d610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058d578082015181840152602081019050610572565b50505050905090810190601f1680156105ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d457600080fd5b506105dd610ea5565b6040518082815260200191505060405180910390f35b6105fb610eab565b005b34801561060957600080fd5b5061064c6004803603602081101561062057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fca565b005b6000808284019050838110156106cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905090565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b505050505081565b60608060006107cb6106d6565b9050806040519080825280602002602001820160405280156107fc5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561082e5781602001602082028038833980820191505090505b50915060008090505b818110156108e3576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061088b57fe5b9060005260206000209060020201905080600001548583815181106108ac57fe5b60200260200101818152505080600101548483815181106108c957fe5b602002602001018181525050508080600101915050610837565b50828292509250509091565b6108f7610db0565b610969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e1610db0565b610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ad7573d6000803e3d6000fd5b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d816040518082815260200191505060405180910390a150565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ba85780601f10610b7d57610100808354040283529160200191610ba8565b820191906000526020600020905b815481529060010190602001808311610b8b57829003601f168201915b505050505081565b610bb8610db0565b610c2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e9d5780601f10610e7257610100808354040283529160200191610e9d565b820191906000526020600020905b815481529060010190602001808311610e8057829003601f168201915b505050505081565b60075481565b610eb3611194565b6040518060400160405280348152602001428152509050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010155505050610f613460075461064e90919063ffffffff16565b6007819055506008600081548092919060010191905055503373ffffffffffffffffffffffffffffffffffffffff167f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c52346040518082815260200191505060405180910390a250565b610fd2610db0565b611044576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61104d81611050565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111af6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058209fbfa484628b02babb980313ae79b77e708df8b0c46024caff44504889d764110029", "sourceMap": "158:2312:0:-;;;679:420;8:9:-1;5:2;;;30:1;27;20:12;5:2;679:420:0;;;;;;;;;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;679:420:0;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;679:420:0;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;679:420:0;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;679:420:0;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;679:420:0;;;;;;;;;;;;;;;;;;;;;;;;;;666:10:4;657:6;;:19;;;;;;;;;;;;;;;;;;724:6;;;;;;;;;;;691:40;;720:1;691:40;;;;;;;;;;;;925:5:0;918:4;:12;;;;;;;;;;;;:::i;:::-;;946:4;940:3;:10;;;;;;;;;;;;:::i;:::-;;971:9;960:8;:20;;;;;;;;;;;;:::i;:::-;;1004:12;990:11;:26;;;;;;;;;;;;:::i;:::-;;1040:12;1026:11;;:26;;;;;;;;;;;;;;;;;;1062:30;1081:10;1062:18;;;:30;;:::i;:::-;679:420;;;;;;158:2312;;2093:225:4;2186:1;2166:22;;:8;:22;;;;2158:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2275:8;2246:38;;2267:6;;;;;;;;;;;2246:38;;;;;;;;;;;;2303:8;2294:6;;:17;;;;;;;;;;;;;;;;;;2093:225;:::o;158:2312:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", "deployedSourceMap": "158:2312:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2406:29;2425:9;2406:14;;:18;;:29;;;;:::i;:::-;2389:14;:46;;;;2445:14;;:16;;;;;;;;;;;;;158:2312;1225:110;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1225:110:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;460:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:18:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;460:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1693:481;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1693:481:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1693:481:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1693:481:0;;;;;;;;;;;;;;;;;;;1105:114;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1105:114:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1105:114:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;643:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;643:29:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;567:34;;8:9:-1;5:2;;;30:1;27;20:12;5:2;567:34:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2180:164;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2180:164:0;;;:::i;:::-;;484:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;484:17:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;484:17:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1599:137:4;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1599:137:4;;;:::i;:::-;;535:25:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;535:25:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;535:25:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;814:77:4;;8:9:-1;5:2;;;30:1;27;20:12;5:2;814:77:4;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1165:90;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1165:90:4;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;507:22:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;507:22:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;507:22:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;608:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;608:29:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1341:346;;;:::i;:::-;;1885:107:4;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1885:107:4;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1885:107:4;;;;;;;;;;;;;;;;;;;:::i;:::-;;834:176:3;892:7;911:9;927:1;923;:5;911:17;;951:1;946;:6;;938:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1002:1;995:8;;;834:176;;;;:::o;1225:110:0:-;1273:7;1299:10;:22;1310:10;1299:22;;;;;;;;;;;;;;;:29;;;;1292:36;;1225:110;:::o;460:18::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1693:481::-;1745:23;1778:22;1821:13;1837:18;:16;:18::i;:::-;1821:34;;1888:5;1874:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;1874:20:0;;;;1865:29;;1926:5;1912:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;1912:20:0;;;;1904:28;;1948:9;1960:1;1948:13;;1943:192;1967:5;1963:1;:9;1943:192;;;1993:25;2021:10;:22;2032:10;2021:22;;;;;;;;;;;;;;;2044:1;2021:25;;;;;;;;;;;;;;;;;;1993:53;;2072:8;:14;;;2060:6;2067:1;2060:9;;;;;;;;;;;;;:26;;;;;2111:8;:13;;;2100:5;2106:1;2100:8;;;;;;;;;;;;;:24;;;;;1943:192;1974:3;;;;;;;1943:192;;;;2153:6;2161:5;2145:22;;;;;1693:481;;:::o;1105:114::-;1018:9:4;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1200:12:0;1186:11;;:26;;;;;;;;;;;;;;;;;;1105:114;:::o;643:29::-;;;;:::o;567:34::-;;;;;;;;;;;;;:::o;2180:164::-;1018:9:4;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2227:15:0;2253:4;2245:21;;;2227:39;;2276:11;;;;;;;;;;;:20;;:29;2297:7;2276:29;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2276:29:0;2320:17;2329:7;2320:17;;;;;;;;;;;;;;;;;;1074:1:4;2180:164:0:o;484:17::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1599:137:4:-;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1697:1;1660:40;;1681:6;;;;;;;;;;;1660:40;;;;;;;;;;;;1727:1;1710:6;;:19;;;;;;;;;;;;;;;;;;1599:137::o;535:25:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;814:77:4:-;852:7;878:6;;;;;;;;;;;871:13;;814:77;:::o;1165:90::-;1205:4;1242:6;;;;;;;;;;;1228:20;;:10;:20;;;1221:27;;1165:90;:::o;507:22:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;608:29::-;;;;:::o;1341:346::-;1384:24;;:::i;:::-;1411:85;;;;;;;;1441:9;1411:85;;;;1470:15;1411:85;;;1384:112;;1506:10;:22;1517:10;1506:22;;;;;;;;;;;;;;;1534:8;1506:37;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1506:37:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1570:29;1589:9;1570:14;;:18;;:29;;;;:::i;:::-;1553:14;:46;;;;1609:14;;:16;;;;;;;;;;;;;1658:10;1641:39;;;1670:9;1641:39;;;;;;;;;;;;;;;;;;1341:346;:::o;1885:107:4:-;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1957:28;1976:8;1957:18;:28::i;:::-;1885:107;:::o;2093:225::-;2186:1;2166:22;;:8;:22;;;;2158:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2275:8;2246:38;;2267:6;;;;;;;;;;;2246:38;;;;;;;;;;;;2303:8;2294:6;;:17;;;;;;;;;;;;;;;;;;2093:225;:::o;158:2312:0:-;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity >0.4.23 <0.7.0;\n\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\nimport \"openzeppelin-solidity/contracts/math/SafeMath.sol\";\n\ncontract Fundraiser is Ownable {\n using SafeMath for uint256;\n\n struct Donation {\n uint256 value;\n uint256 date;\n }\n mapping(address => Donation[]) private _donations;\n\n event DonationReceived(address indexed donor, uint256 value);\n event Withdraw(uint256 amount);\n\n string public name;\n string public url;\n string public imageURL;\n string public description;\n\n address payable public beneficiary;\n\n uint256 public totalDonations;\n uint256 public donationsCount;\n\n constructor(\n string memory _name,\n string memory _url,\n string memory _imageURL,\n string memory _description,\n address payable _beneficiary,\n address _custodian\n )\n public\n {\n name = _name;\n url = _url;\n imageURL = _imageURL;\n description = _description;\n beneficiary = _beneficiary;\n _transferOwnership(_custodian);\n }\n\n function setBeneficiary(address payable _beneficiary) public onlyOwner {\n beneficiary = _beneficiary;\n }\n\n function myDonationsCount() public view returns(uint256) {\n return _donations[msg.sender].length;\n }\n\n function donate() public payable {\n Donation memory donation = Donation({\n value: msg.value,\n date: block.timestamp\n });\n _donations[msg.sender].push(donation);\n totalDonations = totalDonations.add(msg.value);\n donationsCount++;\n\n emit DonationReceived(msg.sender, msg.value);\n }\n\n function myDonations() public view returns(\n uint256[] memory values,\n uint256[] memory dates\n )\n {\n uint256 count = myDonationsCount();\n values = new uint256[](count);\n dates = new uint256[](count);\n\n for (uint256 i = 0; i < count; i++) {\n Donation storage donation = _donations[msg.sender][i];\n values[i] = donation.value;\n dates[i] = donation.date;\n }\n\n return (values, dates);\n }\n\n function withdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n beneficiary.transfer(balance);\n emit Withdraw(balance);\n }\n\n function () external payable {\n totalDonations = totalDonations.add(msg.value);\n donationsCount++;\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol", "exportedSymbols": { "Fundraiser": [ 254 ] }, "id": 255, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:0" }, { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "file": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "id": 2, "nodeType": "ImportDirective", "scope": 255, "sourceUnit": 696, "src": "33:63:0", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "file": "openzeppelin-solidity/contracts/math/SafeMath.sol", "id": 3, "nodeType": "ImportDirective", "scope": 255, "sourceUnit": 585, "src": "97:59:0", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 695, "src": "181:7:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$695", "typeString": "contract Ownable" } }, "id": 5, "nodeType": "InheritanceSpecifier", "src": "181:7:0" } ], "contractDependencies": [ 695 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 254, "linearizedBaseContracts": [ 254, 695 ], "name": "Fundraiser", "nodeType": "ContractDefinition", "nodes": [ { "id": 8, "libraryName": { "contractScope": null, "id": 6, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 584, "src": "201:8:0", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$584", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "195:27:0", "typeName": { "id": 7, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "214:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "canonicalName": "Fundraiser.Donation", "id": 13, "members": [ { "constant": false, "id": 10, "name": "value", "nodeType": "VariableDeclaration", "scope": 13, "src": "254:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "254:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 12, "name": "date", "nodeType": "VariableDeclaration", "scope": 13, "src": "277:12:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "277:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Donation", "nodeType": "StructDefinition", "scope": 254, "src": "228:68:0", "visibility": "public" }, { "constant": false, "id": 18, "name": "_donations", "nodeType": "VariableDeclaration", "scope": 254, "src": "301:49:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "typeName": { "id": 17, "keyType": { "id": 14, "name": "address", "nodeType": "ElementaryTypeName", "src": "309:7:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "301:30:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "valueType": { "baseType": { "contractScope": null, "id": 15, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "320:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "id": 16, "length": null, "nodeType": "ArrayTypeName", "src": "320:10:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage_ptr", "typeString": "struct Fundraiser.Donation[]" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 24, "name": "DonationReceived", "nodeType": "EventDefinition", "parameters": { "id": 23, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 20, "indexed": true, "name": "donor", "nodeType": "VariableDeclaration", "scope": 24, "src": "380:21:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 19, "name": "address", "nodeType": "ElementaryTypeName", "src": "380:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 24, "src": "403:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 21, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "403:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "379:38:0" }, "src": "357:61:0" }, { "anonymous": false, "documentation": null, "id": 28, "name": "Withdraw", "nodeType": "EventDefinition", "parameters": { "id": 27, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 26, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 28, "src": "438:14:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 25, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "438:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "437:16:0" }, "src": "423:31:0" }, { "constant": false, "id": 30, "name": "name", "nodeType": "VariableDeclaration", "scope": 254, "src": "460:18:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 29, "name": "string", "nodeType": "ElementaryTypeName", "src": "460:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 32, "name": "url", "nodeType": "VariableDeclaration", "scope": 254, "src": "484:17:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 31, "name": "string", "nodeType": "ElementaryTypeName", "src": "484:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 34, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 254, "src": "507:22:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 33, "name": "string", "nodeType": "ElementaryTypeName", "src": "507:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 36, "name": "description", "nodeType": "VariableDeclaration", "scope": 254, "src": "535:25:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 35, "name": "string", "nodeType": "ElementaryTypeName", "src": "535:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 38, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 254, "src": "567:34:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 37, "name": "address", "nodeType": "ElementaryTypeName", "src": "567:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 40, "name": "totalDonations", "nodeType": "VariableDeclaration", "scope": 254, "src": "608:29:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 39, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "608:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 42, "name": "donationsCount", "nodeType": "VariableDeclaration", "scope": 254, "src": "643:29:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 41, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "643:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 81, "nodeType": "Block", "src": "908:191:0", "statements": [ { "expression": { "argumentTypes": null, "id": 59, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 57, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30, "src": "918:4:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 58, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44, "src": "925:5:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "918:12:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 60, "nodeType": "ExpressionStatement", "src": "918:12:0" }, { "expression": { "argumentTypes": null, "id": 63, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 61, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "940:3:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 62, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 46, "src": "946:4:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "940:10:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 64, "nodeType": "ExpressionStatement", "src": "940:10:0" }, { "expression": { "argumentTypes": null, "id": 67, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 65, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "960:8:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 66, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 48, "src": "971:9:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "960:20:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 68, "nodeType": "ExpressionStatement", "src": "960:20:0" }, { "expression": { "argumentTypes": null, "id": 71, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 69, "name": "description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36, "src": "990:11:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 70, "name": "_description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 50, "src": "1004:12:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "990:26:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 72, "nodeType": "ExpressionStatement", "src": "990:26:0" }, { "expression": { "argumentTypes": null, "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 73, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1026:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 74, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "1040:12:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1026:26:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 76, "nodeType": "ExpressionStatement", "src": "1026:26:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 78, "name": "_custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 54, "src": "1081:10:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 77, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 694, "src": "1062:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 79, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1062:30:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 80, "nodeType": "ExpressionStatement", "src": "1062:30:0" } ] }, "documentation": null, "id": 82, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 55, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 44, "name": "_name", "nodeType": "VariableDeclaration", "scope": 82, "src": "700:19:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 43, "name": "string", "nodeType": "ElementaryTypeName", "src": "700:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 46, "name": "_url", "nodeType": "VariableDeclaration", "scope": 82, "src": "729:18:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 45, "name": "string", "nodeType": "ElementaryTypeName", "src": "729:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 48, "name": "_imageURL", "nodeType": "VariableDeclaration", "scope": 82, "src": "757:23:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 47, "name": "string", "nodeType": "ElementaryTypeName", "src": "757:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 50, "name": "_description", "nodeType": "VariableDeclaration", "scope": 82, "src": "790:26:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 49, "name": "string", "nodeType": "ElementaryTypeName", "src": "790:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 52, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 82, "src": "826:28:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 51, "name": "address", "nodeType": "ElementaryTypeName", "src": "826:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 54, "name": "_custodian", "nodeType": "VariableDeclaration", "scope": 82, "src": "864:18:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 53, "name": "address", "nodeType": "ElementaryTypeName", "src": "864:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "690:198:0" }, "returnParameters": { "id": 56, "nodeType": "ParameterList", "parameters": [], "src": "908:0:0" }, "scope": 254, "src": "679:420:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 93, "nodeType": "Block", "src": "1176:43:0", "statements": [ { "expression": { "argumentTypes": null, "id": 91, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 89, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1186:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 90, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 84, "src": "1200:12:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1186:26:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 92, "nodeType": "ExpressionStatement", "src": "1186:26:0" } ] }, "documentation": null, "id": 94, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 87, "modifierName": { "argumentTypes": null, "id": 86, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1166:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1166:9:0" } ], "name": "setBeneficiary", "nodeType": "FunctionDefinition", "parameters": { "id": 85, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 84, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 94, "src": "1129:28:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 83, "name": "address", "nodeType": "ElementaryTypeName", "src": "1129:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "1128:30:0" }, "returnParameters": { "id": 88, "nodeType": "ParameterList", "parameters": [], "src": "1176:0:0" }, "scope": 254, "src": "1105:114:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 105, "nodeType": "Block", "src": "1282:53:0", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 99, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "1299:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 102, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 100, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1310:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1310:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1299:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 103, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1299:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 98, "id": 104, "nodeType": "Return", "src": "1292:36:0" } ] }, "documentation": null, "id": 106, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonationsCount", "nodeType": "FunctionDefinition", "parameters": { "id": 95, "nodeType": "ParameterList", "parameters": [], "src": "1250:2:0" }, "returnParameters": { "id": 98, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 97, "name": "", "nodeType": "VariableDeclaration", "scope": 106, "src": "1273:7:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 96, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1273:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1272:9:0" }, "scope": 254, "src": "1225:110:0", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 144, "nodeType": "Block", "src": "1374:313:0", "statements": [ { "assignments": [ 110 ], "declarations": [ { "constant": false, "id": 110, "name": "donation", "nodeType": "VariableDeclaration", "scope": 144, "src": "1384:24:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 109, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "1384:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 117, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 112, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1441:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 113, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1441:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 114, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 700, "src": "1470:5:0", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 115, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "timestamp", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1470:15:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 111, "name": "Donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 13, "src": "1411:8:0", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Donation_$13_storage_ptr_$", "typeString": "type(struct Fundraiser.Donation storage pointer)" } }, "id": 116, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value", "date" ], "nodeType": "FunctionCall", "src": "1411:85:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory", "typeString": "struct Fundraiser.Donation memory" } }, "nodeType": "VariableDeclarationStatement", "src": "1384:112:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 123, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 110, "src": "1534:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 118, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "1506:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 121, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 119, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1517:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 120, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1517:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1506:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 122, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1506:27:0", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_Donation_$13_storage_$returns$_t_uint256_$", "typeString": "function (struct Fundraiser.Donation storage ref) returns (uint256)" } }, "id": 124, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1506:37:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 125, "nodeType": "ExpressionStatement", "src": "1506:37:0" }, { "expression": { "argumentTypes": null, "id": 132, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 126, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "1553:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 129, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1589:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 130, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1589:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 127, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "1570:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 128, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 478, "src": "1570:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 131, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1570:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1553:46:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 133, "nodeType": "ExpressionStatement", "src": "1553:46:0" }, { "expression": { "argumentTypes": null, "id": 135, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1609:16:0", "subExpression": { "argumentTypes": null, "id": 134, "name": "donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 42, "src": "1609:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 136, "nodeType": "ExpressionStatement", "src": "1609:16:0" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 138, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1658:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 139, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1658:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 140, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1670:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 141, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1670:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 137, "name": "DonationReceived", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24, "src": "1641:16:0", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256)" } }, "id": 142, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1641:39:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 143, "nodeType": "EmitStatement", "src": "1636:44:0" } ] }, "documentation": null, "id": 145, "implemented": true, "kind": "function", "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 107, "nodeType": "ParameterList", "parameters": [], "src": "1356:2:0" }, "returnParameters": { "id": 108, "nodeType": "ParameterList", "parameters": [], "src": "1374:0:0" }, "scope": 254, "src": "1341:346:0", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 214, "nodeType": "Block", "src": "1811:363:0", "statements": [ { "assignments": [ 155 ], "declarations": [ { "constant": false, "id": 155, "name": "count", "nodeType": "VariableDeclaration", "scope": 214, "src": "1821:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 154, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1821:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 158, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 156, "name": "myDonationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 106, "src": "1837:16:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 157, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1837:18:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1821:34:0" }, { "expression": { "argumentTypes": null, "id": 165, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 159, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "1865:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 163, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1888:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 162, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1874:13:0", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 160, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1878:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 161, "length": null, "nodeType": "ArrayTypeName", "src": "1878:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 164, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1874:20:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "1865:29:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 166, "nodeType": "ExpressionStatement", "src": "1865:29:0" }, { "expression": { "argumentTypes": null, "id": 173, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 167, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "1904:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 171, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1926:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 170, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1912:13:0", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 168, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1916:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 169, "length": null, "nodeType": "ArrayTypeName", "src": "1916:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 172, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1912:20:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "1904:28:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 174, "nodeType": "ExpressionStatement", "src": "1904:28:0" }, { "body": { "id": 208, "nodeType": "Block", "src": "1979:156:0", "statements": [ { "assignments": [ 186 ], "declarations": [ { "constant": false, "id": 186, "name": "donation", "nodeType": "VariableDeclaration", "scope": 208, "src": "1993:25:0", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 185, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "1993:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 193, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 187, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "2021:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 190, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 188, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "2032:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 189, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2032:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2021:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 192, "indexExpression": { "argumentTypes": null, "id": 191, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2044:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2021:25:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "nodeType": "VariableDeclarationStatement", "src": "1993:53:0" }, { "expression": { "argumentTypes": null, "id": 199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 194, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "2060:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 196, "indexExpression": { "argumentTypes": null, "id": 195, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2067:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2060:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 197, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 186, "src": "2072:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation storage pointer" } }, "id": 198, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": 10, "src": "2072:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2060:26:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 200, "nodeType": "ExpressionStatement", "src": "2060:26:0" }, { "expression": { "argumentTypes": null, "id": 206, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 201, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "2100:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 203, "indexExpression": { "argumentTypes": null, "id": 202, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2106:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2100:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 204, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 186, "src": "2111:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation storage pointer" } }, "id": 205, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 12, "src": "2111:13:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2100:24:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 207, "nodeType": "ExpressionStatement", "src": "2100:24:0" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 179, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1963:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 180, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1967:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1963:9:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 209, "initializationExpression": { "assignments": [ 176 ], "declarations": [ { "constant": false, "id": 176, "name": "i", "nodeType": "VariableDeclaration", "scope": 209, "src": "1948:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 175, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1948:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 178, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 177, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1960:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "1948:13:0" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1974:3:0", "subExpression": { "argumentTypes": null, "id": 182, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1974:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 184, "nodeType": "ExpressionStatement", "src": "1974:3:0" }, "nodeType": "ForStatement", "src": "1943:192:0" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 210, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "2153:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 211, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "2161:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } } ], "id": 212, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2152:15:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", "typeString": "tuple(uint256[] memory,uint256[] memory)" } }, "functionReturnParameters": 153, "id": 213, "nodeType": "Return", "src": "2145:22:0" } ] }, "documentation": null, "id": 215, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 146, "nodeType": "ParameterList", "parameters": [], "src": "1713:2:0" }, "returnParameters": { "id": 153, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 149, "name": "values", "nodeType": "VariableDeclaration", "scope": 215, "src": "1745:23:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 147, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1745:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 148, "length": null, "nodeType": "ArrayTypeName", "src": "1745:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 152, "name": "dates", "nodeType": "VariableDeclaration", "scope": 215, "src": "1778:22:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 150, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1778:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 151, "length": null, "nodeType": "ArrayTypeName", "src": "1778:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" } ], "src": "1735:71:0" }, "scope": 254, "src": "1693:481:0", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 237, "nodeType": "Block", "src": "2217:127:0", "statements": [ { "assignments": [ 221 ], "declarations": [ { "constant": false, "id": 221, "name": "balance", "nodeType": "VariableDeclaration", "scope": 237, "src": "2227:15:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 220, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2227:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 226, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 223, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 728, "src": "2253:4:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } ], "id": 222, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2245:7:0", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 224, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2245:13:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 225, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2245:21:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2227:39:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 230, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 221, "src": "2297:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 227, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "2276:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 229, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2276:20:0", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 231, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2276:29:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 232, "nodeType": "ExpressionStatement", "src": "2276:29:0" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 234, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 221, "src": "2329:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 233, "name": "Withdraw", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 28, "src": "2320:8:0", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 235, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2320:17:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 236, "nodeType": "EmitStatement", "src": "2315:22:0" } ] }, "documentation": null, "id": 238, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 218, "modifierName": { "argumentTypes": null, "id": 217, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "2207:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "2207:9:0" } ], "name": "withdraw", "nodeType": "FunctionDefinition", "parameters": { "id": 216, "nodeType": "ParameterList", "parameters": [], "src": "2197:2:0" }, "returnParameters": { "id": 219, "nodeType": "ParameterList", "parameters": [], "src": "2217:0:0" }, "scope": 254, "src": "2180:164:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 252, "nodeType": "Block", "src": "2379:89:0", "statements": [ { "expression": { "argumentTypes": null, "id": 247, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 241, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "2389:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 244, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "2425:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 245, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2425:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 242, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "2406:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 243, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 478, "src": "2406:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 246, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2406:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2389:46:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 248, "nodeType": "ExpressionStatement", "src": "2389:46:0" }, { "expression": { "argumentTypes": null, "id": 250, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "2445:16:0", "subExpression": { "argumentTypes": null, "id": 249, "name": "donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 42, "src": "2445:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 251, "nodeType": "ExpressionStatement", "src": "2445:16:0" } ] }, "documentation": null, "id": 253, "implemented": true, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 239, "nodeType": "ParameterList", "parameters": [], "src": "2359:2:0" }, "returnParameters": { "id": 240, "nodeType": "ParameterList", "parameters": [], "src": "2379:0:0" }, "scope": 254, "src": "2350:118:0", "stateMutability": "payable", "superFunction": null, "visibility": "external" } ], "scope": 255, "src": "158:2312:0" } ], "src": "0:2471:0" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol", "exportedSymbols": { "Fundraiser": [ 254 ] }, "id": 255, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:0" }, { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "file": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "id": 2, "nodeType": "ImportDirective", "scope": 255, "sourceUnit": 696, "src": "33:63:0", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "file": "openzeppelin-solidity/contracts/math/SafeMath.sol", "id": 3, "nodeType": "ImportDirective", "scope": 255, "sourceUnit": 585, "src": "97:59:0", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 695, "src": "181:7:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$695", "typeString": "contract Ownable" } }, "id": 5, "nodeType": "InheritanceSpecifier", "src": "181:7:0" } ], "contractDependencies": [ 695 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 254, "linearizedBaseContracts": [ 254, 695 ], "name": "Fundraiser", "nodeType": "ContractDefinition", "nodes": [ { "id": 8, "libraryName": { "contractScope": null, "id": 6, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 584, "src": "201:8:0", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$584", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "195:27:0", "typeName": { "id": 7, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "214:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "canonicalName": "Fundraiser.Donation", "id": 13, "members": [ { "constant": false, "id": 10, "name": "value", "nodeType": "VariableDeclaration", "scope": 13, "src": "254:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "254:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 12, "name": "date", "nodeType": "VariableDeclaration", "scope": 13, "src": "277:12:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "277:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Donation", "nodeType": "StructDefinition", "scope": 254, "src": "228:68:0", "visibility": "public" }, { "constant": false, "id": 18, "name": "_donations", "nodeType": "VariableDeclaration", "scope": 254, "src": "301:49:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "typeName": { "id": 17, "keyType": { "id": 14, "name": "address", "nodeType": "ElementaryTypeName", "src": "309:7:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "301:30:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "valueType": { "baseType": { "contractScope": null, "id": 15, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "320:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "id": 16, "length": null, "nodeType": "ArrayTypeName", "src": "320:10:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage_ptr", "typeString": "struct Fundraiser.Donation[]" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 24, "name": "DonationReceived", "nodeType": "EventDefinition", "parameters": { "id": 23, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 20, "indexed": true, "name": "donor", "nodeType": "VariableDeclaration", "scope": 24, "src": "380:21:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 19, "name": "address", "nodeType": "ElementaryTypeName", "src": "380:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 22, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 24, "src": "403:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 21, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "403:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "379:38:0" }, "src": "357:61:0" }, { "anonymous": false, "documentation": null, "id": 28, "name": "Withdraw", "nodeType": "EventDefinition", "parameters": { "id": 27, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 26, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 28, "src": "438:14:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 25, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "438:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "437:16:0" }, "src": "423:31:0" }, { "constant": false, "id": 30, "name": "name", "nodeType": "VariableDeclaration", "scope": 254, "src": "460:18:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 29, "name": "string", "nodeType": "ElementaryTypeName", "src": "460:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 32, "name": "url", "nodeType": "VariableDeclaration", "scope": 254, "src": "484:17:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 31, "name": "string", "nodeType": "ElementaryTypeName", "src": "484:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 34, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 254, "src": "507:22:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 33, "name": "string", "nodeType": "ElementaryTypeName", "src": "507:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 36, "name": "description", "nodeType": "VariableDeclaration", "scope": 254, "src": "535:25:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 35, "name": "string", "nodeType": "ElementaryTypeName", "src": "535:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 38, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 254, "src": "567:34:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 37, "name": "address", "nodeType": "ElementaryTypeName", "src": "567:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 40, "name": "totalDonations", "nodeType": "VariableDeclaration", "scope": 254, "src": "608:29:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 39, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "608:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 42, "name": "donationsCount", "nodeType": "VariableDeclaration", "scope": 254, "src": "643:29:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 41, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "643:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 81, "nodeType": "Block", "src": "908:191:0", "statements": [ { "expression": { "argumentTypes": null, "id": 59, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 57, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 30, "src": "918:4:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 58, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44, "src": "925:5:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "918:12:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 60, "nodeType": "ExpressionStatement", "src": "918:12:0" }, { "expression": { "argumentTypes": null, "id": 63, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 61, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "940:3:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 62, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 46, "src": "946:4:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "940:10:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 64, "nodeType": "ExpressionStatement", "src": "940:10:0" }, { "expression": { "argumentTypes": null, "id": 67, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 65, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "960:8:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 66, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 48, "src": "971:9:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "960:20:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 68, "nodeType": "ExpressionStatement", "src": "960:20:0" }, { "expression": { "argumentTypes": null, "id": 71, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 69, "name": "description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36, "src": "990:11:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 70, "name": "_description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 50, "src": "1004:12:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "990:26:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 72, "nodeType": "ExpressionStatement", "src": "990:26:0" }, { "expression": { "argumentTypes": null, "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 73, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1026:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 74, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "1040:12:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1026:26:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 76, "nodeType": "ExpressionStatement", "src": "1026:26:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 78, "name": "_custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 54, "src": "1081:10:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 77, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 694, "src": "1062:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 79, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1062:30:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 80, "nodeType": "ExpressionStatement", "src": "1062:30:0" } ] }, "documentation": null, "id": 82, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 55, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 44, "name": "_name", "nodeType": "VariableDeclaration", "scope": 82, "src": "700:19:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 43, "name": "string", "nodeType": "ElementaryTypeName", "src": "700:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 46, "name": "_url", "nodeType": "VariableDeclaration", "scope": 82, "src": "729:18:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 45, "name": "string", "nodeType": "ElementaryTypeName", "src": "729:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 48, "name": "_imageURL", "nodeType": "VariableDeclaration", "scope": 82, "src": "757:23:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 47, "name": "string", "nodeType": "ElementaryTypeName", "src": "757:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 50, "name": "_description", "nodeType": "VariableDeclaration", "scope": 82, "src": "790:26:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 49, "name": "string", "nodeType": "ElementaryTypeName", "src": "790:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 52, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 82, "src": "826:28:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 51, "name": "address", "nodeType": "ElementaryTypeName", "src": "826:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 54, "name": "_custodian", "nodeType": "VariableDeclaration", "scope": 82, "src": "864:18:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 53, "name": "address", "nodeType": "ElementaryTypeName", "src": "864:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "690:198:0" }, "returnParameters": { "id": 56, "nodeType": "ParameterList", "parameters": [], "src": "908:0:0" }, "scope": 254, "src": "679:420:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 93, "nodeType": "Block", "src": "1176:43:0", "statements": [ { "expression": { "argumentTypes": null, "id": 91, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 89, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1186:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 90, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 84, "src": "1200:12:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1186:26:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 92, "nodeType": "ExpressionStatement", "src": "1186:26:0" } ] }, "documentation": null, "id": 94, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 87, "modifierName": { "argumentTypes": null, "id": 86, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1166:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1166:9:0" } ], "name": "setBeneficiary", "nodeType": "FunctionDefinition", "parameters": { "id": 85, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 84, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 94, "src": "1129:28:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 83, "name": "address", "nodeType": "ElementaryTypeName", "src": "1129:15:0", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "1128:30:0" }, "returnParameters": { "id": 88, "nodeType": "ParameterList", "parameters": [], "src": "1176:0:0" }, "scope": 254, "src": "1105:114:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 105, "nodeType": "Block", "src": "1282:53:0", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 99, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "1299:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 102, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 100, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1310:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1310:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1299:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 103, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1299:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 98, "id": 104, "nodeType": "Return", "src": "1292:36:0" } ] }, "documentation": null, "id": 106, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonationsCount", "nodeType": "FunctionDefinition", "parameters": { "id": 95, "nodeType": "ParameterList", "parameters": [], "src": "1250:2:0" }, "returnParameters": { "id": 98, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 97, "name": "", "nodeType": "VariableDeclaration", "scope": 106, "src": "1273:7:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 96, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1273:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1272:9:0" }, "scope": 254, "src": "1225:110:0", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 144, "nodeType": "Block", "src": "1374:313:0", "statements": [ { "assignments": [ 110 ], "declarations": [ { "constant": false, "id": 110, "name": "donation", "nodeType": "VariableDeclaration", "scope": 144, "src": "1384:24:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 109, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "1384:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 117, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 112, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1441:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 113, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1441:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 114, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 700, "src": "1470:5:0", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 115, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "timestamp", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1470:15:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 111, "name": "Donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 13, "src": "1411:8:0", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Donation_$13_storage_ptr_$", "typeString": "type(struct Fundraiser.Donation storage pointer)" } }, "id": 116, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value", "date" ], "nodeType": "FunctionCall", "src": "1411:85:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory", "typeString": "struct Fundraiser.Donation memory" } }, "nodeType": "VariableDeclarationStatement", "src": "1384:112:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 123, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 110, "src": "1534:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_Donation_$13_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 118, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "1506:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 121, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 119, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1517:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 120, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1517:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1506:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 122, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1506:27:0", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_Donation_$13_storage_$returns$_t_uint256_$", "typeString": "function (struct Fundraiser.Donation storage ref) returns (uint256)" } }, "id": 124, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1506:37:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 125, "nodeType": "ExpressionStatement", "src": "1506:37:0" }, { "expression": { "argumentTypes": null, "id": 132, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 126, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "1553:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 129, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1589:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 130, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1589:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 127, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "1570:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 128, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 478, "src": "1570:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 131, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1570:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1553:46:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 133, "nodeType": "ExpressionStatement", "src": "1553:46:0" }, { "expression": { "argumentTypes": null, "id": 135, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1609:16:0", "subExpression": { "argumentTypes": null, "id": 134, "name": "donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 42, "src": "1609:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 136, "nodeType": "ExpressionStatement", "src": "1609:16:0" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 138, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1658:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 139, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1658:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 140, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1670:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 141, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1670:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 137, "name": "DonationReceived", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 24, "src": "1641:16:0", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256)" } }, "id": 142, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1641:39:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 143, "nodeType": "EmitStatement", "src": "1636:44:0" } ] }, "documentation": null, "id": 145, "implemented": true, "kind": "function", "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 107, "nodeType": "ParameterList", "parameters": [], "src": "1356:2:0" }, "returnParameters": { "id": 108, "nodeType": "ParameterList", "parameters": [], "src": "1374:0:0" }, "scope": 254, "src": "1341:346:0", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 214, "nodeType": "Block", "src": "1811:363:0", "statements": [ { "assignments": [ 155 ], "declarations": [ { "constant": false, "id": 155, "name": "count", "nodeType": "VariableDeclaration", "scope": 214, "src": "1821:13:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 154, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1821:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 158, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 156, "name": "myDonationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 106, "src": "1837:16:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 157, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1837:18:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1821:34:0" }, { "expression": { "argumentTypes": null, "id": 165, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 159, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "1865:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 163, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1888:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 162, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1874:13:0", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 160, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1878:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 161, "length": null, "nodeType": "ArrayTypeName", "src": "1878:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 164, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1874:20:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "1865:29:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 166, "nodeType": "ExpressionStatement", "src": "1865:29:0" }, { "expression": { "argumentTypes": null, "id": 173, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 167, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "1904:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 171, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1926:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 170, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1912:13:0", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 168, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1916:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 169, "length": null, "nodeType": "ArrayTypeName", "src": "1916:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 172, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1912:20:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "1904:28:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 174, "nodeType": "ExpressionStatement", "src": "1904:28:0" }, { "body": { "id": 208, "nodeType": "Block", "src": "1979:156:0", "statements": [ { "assignments": [ 186 ], "declarations": [ { "constant": false, "id": 186, "name": "donation", "nodeType": "VariableDeclaration", "scope": 208, "src": "1993:25:0", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 185, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13, "src": "1993:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 193, "initialValue": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 187, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18, "src": "2021:10:0", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$13_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 190, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 188, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "2032:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 189, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2032:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2021:22:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$13_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 192, "indexExpression": { "argumentTypes": null, "id": 191, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2044:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2021:25:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "nodeType": "VariableDeclarationStatement", "src": "1993:53:0" }, { "expression": { "argumentTypes": null, "id": 199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 194, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "2060:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 196, "indexExpression": { "argumentTypes": null, "id": 195, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2067:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2060:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 197, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 186, "src": "2072:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation storage pointer" } }, "id": 198, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": 10, "src": "2072:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2060:26:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 200, "nodeType": "ExpressionStatement", "src": "2060:26:0" }, { "expression": { "argumentTypes": null, "id": 206, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 201, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "2100:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 203, "indexExpression": { "argumentTypes": null, "id": 202, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "2106:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2100:8:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 204, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 186, "src": "2111:8:0", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$13_storage_ptr", "typeString": "struct Fundraiser.Donation storage pointer" } }, "id": 205, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 12, "src": "2111:13:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2100:24:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 207, "nodeType": "ExpressionStatement", "src": "2100:24:0" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 179, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1963:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 180, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 155, "src": "1967:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1963:9:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 209, "initializationExpression": { "assignments": [ 176 ], "declarations": [ { "constant": false, "id": 176, "name": "i", "nodeType": "VariableDeclaration", "scope": 209, "src": "1948:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 175, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1948:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 178, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 177, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1960:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "1948:13:0" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1974:3:0", "subExpression": { "argumentTypes": null, "id": 182, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1974:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 184, "nodeType": "ExpressionStatement", "src": "1974:3:0" }, "nodeType": "ForStatement", "src": "1943:192:0" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 210, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 149, "src": "2153:6:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 211, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 152, "src": "2161:5:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } } ], "id": 212, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2152:15:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", "typeString": "tuple(uint256[] memory,uint256[] memory)" } }, "functionReturnParameters": 153, "id": 213, "nodeType": "Return", "src": "2145:22:0" } ] }, "documentation": null, "id": 215, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 146, "nodeType": "ParameterList", "parameters": [], "src": "1713:2:0" }, "returnParameters": { "id": 153, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 149, "name": "values", "nodeType": "VariableDeclaration", "scope": 215, "src": "1745:23:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 147, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1745:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 148, "length": null, "nodeType": "ArrayTypeName", "src": "1745:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 152, "name": "dates", "nodeType": "VariableDeclaration", "scope": 215, "src": "1778:22:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 150, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1778:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 151, "length": null, "nodeType": "ArrayTypeName", "src": "1778:9:0", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" } ], "src": "1735:71:0" }, "scope": 254, "src": "1693:481:0", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 237, "nodeType": "Block", "src": "2217:127:0", "statements": [ { "assignments": [ 221 ], "declarations": [ { "constant": false, "id": 221, "name": "balance", "nodeType": "VariableDeclaration", "scope": 237, "src": "2227:15:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 220, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2227:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 226, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 223, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 728, "src": "2253:4:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } ], "id": 222, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2245:7:0", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 224, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2245:13:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 225, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2245:21:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2227:39:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 230, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 221, "src": "2297:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 227, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "2276:11:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 229, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2276:20:0", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 231, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2276:29:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 232, "nodeType": "ExpressionStatement", "src": "2276:29:0" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 234, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 221, "src": "2329:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 233, "name": "Withdraw", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 28, "src": "2320:8:0", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 235, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2320:17:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 236, "nodeType": "EmitStatement", "src": "2315:22:0" } ] }, "documentation": null, "id": 238, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 218, "modifierName": { "argumentTypes": null, "id": 217, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "2207:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "2207:9:0" } ], "name": "withdraw", "nodeType": "FunctionDefinition", "parameters": { "id": 216, "nodeType": "ParameterList", "parameters": [], "src": "2197:2:0" }, "returnParameters": { "id": 219, "nodeType": "ParameterList", "parameters": [], "src": "2217:0:0" }, "scope": 254, "src": "2180:164:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 252, "nodeType": "Block", "src": "2379:89:0", "statements": [ { "expression": { "argumentTypes": null, "id": 247, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 241, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "2389:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 244, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "2425:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 245, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2425:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 242, "name": "totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40, "src": "2406:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 243, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "add", "nodeType": "MemberAccess", "referencedDeclaration": 478, "src": "2406:18:0", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 246, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2406:29:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2389:46:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 248, "nodeType": "ExpressionStatement", "src": "2389:46:0" }, { "expression": { "argumentTypes": null, "id": 250, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "2445:16:0", "subExpression": { "argumentTypes": null, "id": 249, "name": "donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 42, "src": "2445:14:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 251, "nodeType": "ExpressionStatement", "src": "2445:16:0" } ] }, "documentation": null, "id": 253, "implemented": true, "kind": "fallback", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 239, "nodeType": "ParameterList", "parameters": [], "src": "2359:2:0" }, "returnParameters": { "id": 240, "nodeType": "ParameterList", "parameters": [], "src": "2379:0:0" }, "scope": 254, "src": "2350:118:0", "stateMutability": "payable", "superFunction": null, "visibility": "external" } ], "scope": 255, "src": "158:2312:0" } ], "src": "0:2471:0" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.16", "updatedAt": "2019-10-10T05:34:34.817Z", "devdoc": { "methods": { "isOwner()": { "details": "Returns true if the caller is the current owner." }, "owner()": { "details": "Returns the address of the current owner." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } } }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-10+11/client/src/contracts/FundraiserFactory.json ================================================ { "contractName": "FundraiserFactory", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "name": "fundraiser", "type": "address" }, { "indexed": true, "name": "owner", "type": "address" } ], "name": "FundraiserCreated", "type": "event" }, { "constant": false, "inputs": [ { "name": "name", "type": "string" }, { "name": "url", "type": "string" }, { "name": "imageURL", "type": "string" }, { "name": "description", "type": "string" }, { "name": "beneficiary", "type": "address" } ], "name": "createFundraiser", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "fundraisersCount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "limit", "type": "uint256" }, { "name": "offset", "type": "uint256" } ], "name": "fundraisers", "outputs": [ { "name": "coll", "type": "address[]" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"imageURL\",\"type\":\"string\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"createFundraiser\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"limit\",\"type\":\"uint256\"},{\"name\":\"offset\",\"type\":\"uint256\"}],\"name\":\"fundraisers\",\"outputs\":[{\"name\":\"coll\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"fundraisersCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"fundraiser\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"FundraiserCreated\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/FundraiserFactory.sol\":\"FundraiserFactory\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol\":{\"keccak256\":\"0x4c71de6bd99f371b0ccbf390caa727bfe9429f7227ea476bef46921e7394235a\",\"urls\":[\"bzzr://e74b39014904a052c9d666edb293af447a25a9efe53b46489cbf6fa9f7c0e90e\"]},\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/FundraiserFactory.sol\":{\"keccak256\":\"0xc0bbdd93a55e2ce339a67bf2bd0b419ec723d730d05eea7d10d6573961c57c82\",\"urls\":[\"bzzr://e9bc315adceb848fbe94b86633f5052e7b76b5474c92570fdbb2707398d18573\"]},\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x4ccf2d7b51873db1ccfd54ca2adae5eac3b184f9699911ed4490438419f1c690\",\"urls\":[\"bzzr://1604f5b6d6e916c154efd8c6720cda069e5ba32dfa0a9dedf2b42e5b02d07f89\"]},\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50611fef806100206000396000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c806311d752ad146200004b578063704914f814620002fa5780639d3b4355146200038c575b600080fd5b620002f8600480360360a08110156200006357600080fd5b81019080803590602001906401000000008111156200008157600080fd5b8201836020820111156200009457600080fd5b80359060200191846001830284011164010000000083111715620000b757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200011b57600080fd5b8201836020820111156200012e57600080fd5b803590602001918460018302840111640100000000831117156200015157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115620001b557600080fd5b820183602082011115620001c857600080fd5b80359060200191846001830284011164010000000083111715620001eb57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200024f57600080fd5b8201836020820111156200026257600080fd5b803590602001918460018302840111640100000000831117156200028557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050620003ac565b005b62000333600480360360408110156200031257600080fd5b810190808035906020019092919080359060200190929190505050620006cf565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015620003785780820151818401526020810190506200035b565b505050509050019250505060405180910390f35b6200039662000866565b6040518082815260200191505060405180910390f35b6000858585858533604051620003c29062000872565b80806020018060200180602001806020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185810385528b818151815260200191508051906020019080838360005b838110156200047157808201518184015260208101905062000454565b50505050905090810190601f1680156200049f5780820380516001836020036101000a031916815260200191505b5085810384528a818151815260200191508051906020019080838360005b83811015620004da578082015181840152602081019050620004bd565b50505050905090810190601f168015620005085780820380516001836020036101000a031916815260200191505b50858103835289818151815260200191508051906020019080838360005b838110156200054357808201518184015260208101905062000526565b50505050905090810190601f168015620005715780820380516001836020036101000a031916815260200191505b50858103825288818151815260200191508051906020019080838360005b83811015620005ac5780820151818401526020810190506200058f565b50505050905090810190601f168015620005da5780820380516001836020036101000a031916815260200191505b509a5050505050505050505050604051809103906000f08015801562000604573d6000803e3d6000fd5b50905060008190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fa2398daac0c8053a1e3c0280916c2ec6bc884f0959c27e639a4db829b7eabfb160405160405180910390a3505050505050565b6060620006db62000866565b82111562000751576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f6666736574206f7574206f6620626f756e647300000000000000000000000081525060200191505060405180910390fd5b6000826200075e62000866565b03905083811062000770578362000772565b805b9050601481106200078557601462000787565b805b905080604051908082528060200260200182016040528015620007b95781602001602082028038833980820191505090505b50915060008090505b818110156200085b57600081850181548110620007db57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168382815181106200081357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050620007c2565b508191505092915050565b60008080549050905090565b61174380620008818339019056fe60806040523480156200001157600080fd5b506040516200174338038062001743833981018060405260c08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b828101905060208101848111156200006757600080fd5b81518560018202830111640100000000821117156200008557600080fd5b50509291906020018051640100000000811115620000a257600080fd5b82810190506020810184811115620000b957600080fd5b8151856001820283011164010000000082111715620000d757600080fd5b50509291906020018051640100000000811115620000f457600080fd5b828101905060208101848111156200010b57600080fd5b81518560018202830111640100000000821117156200012957600080fd5b505092919060200180516401000000008111156200014657600080fd5b828101905060208101848111156200015d57600080fd5b81518560018202830111640100000000821117156200017b57600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600290805190602001906200026e9291906200045e565b508460039080519060200190620002879291906200045e565b508360049080519060200190620002a09291906200045e565b508260059080519060200190620002b99291906200045e565b5081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200030c816200031860201b60201c565b5050505050506200050d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806200171d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004a157805160ff1916838001178555620004d2565b82800160010185558215620004d2579182015b82811115620004d1578251825591602001919060010190620004b4565b5b509050620004e19190620004e5565b5090565b6200050a91905b8082111562000506576000816000905550600101620004ec565b5090565b90565b611200806200051d6000396000f3fe6080604052600436106100f35760003560e01c8063715018a61161008a578063b90497e011610059578063b90497e014610538578063de2ed893146105c8578063ed88c68e146105f3578063f2fde38b146105fd576100f3565b8063715018a61461040b5780637284e416146104225780638da5cb5b146104b25780638f32d59b14610509576100f3565b80631f522595116100c65780631f522595146102e257806338af3eed1461030d5780633ccfd60b146103645780635600f04f1461037b576100f3565b80630180b97c1461012257806306fdde031461014d5780631a57f7b4146101dd5780631c31f71014610291575b6101083460075461064e90919063ffffffff16565b600781905550600860008154809291906001019190505550005b34801561012e57600080fd5b506101376106d6565b6040518082815260200191505060405180910390f35b34801561015957600080fd5b50610162610720565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a2578082015181840152602081019050610187565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e957600080fd5b506101f26107be565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561023957808201518184015260208101905061021e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561027b578082015181840152602081019050610260565b5050505090500194505050505060405180910390f35b34801561029d57600080fd5b506102e0600480360360208110156102b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ef565b005b3480156102ee57600080fd5b506102f76109ad565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b506103226109b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037057600080fd5b506103796109d9565b005b34801561038757600080fd5b50610390610b12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d05780820151818401526020810190506103b5565b50505050905090810190601f1680156103fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041757600080fd5b50610420610bb0565b005b34801561042e57600080fd5b50610437610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104c7610d87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051557600080fd5b5061051e610db0565b604051808215151515815260200191505060405180910390f35b34801561054457600080fd5b5061054d610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058d578082015181840152602081019050610572565b50505050905090810190601f1680156105ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d457600080fd5b506105dd610ea5565b6040518082815260200191505060405180910390f35b6105fb610eab565b005b34801561060957600080fd5b5061064c6004803603602081101561062057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fca565b005b6000808284019050838110156106cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905090565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b505050505081565b60608060006107cb6106d6565b9050806040519080825280602002602001820160405280156107fc5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561082e5781602001602082028038833980820191505090505b50915060008090505b818110156108e3576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061088b57fe5b9060005260206000209060020201905080600001548583815181106108ac57fe5b60200260200101818152505080600101548483815181106108c957fe5b602002602001018181525050508080600101915050610837565b50828292509250509091565b6108f7610db0565b610969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e1610db0565b610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ad7573d6000803e3d6000fd5b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d816040518082815260200191505060405180910390a150565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ba85780601f10610b7d57610100808354040283529160200191610ba8565b820191906000526020600020905b815481529060010190602001808311610b8b57829003601f168201915b505050505081565b610bb8610db0565b610c2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e9d5780601f10610e7257610100808354040283529160200191610e9d565b820191906000526020600020905b815481529060010190602001808311610e8057829003601f168201915b505050505081565b60075481565b610eb3611194565b6040518060400160405280348152602001428152509050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010155505050610f613460075461064e90919063ffffffff16565b6007819055506008600081548092919060010191905055503373ffffffffffffffffffffffffffffffffffffffff167f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c52346040518082815260200191505060405180910390a250565b610fd2610db0565b611044576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61104d81611050565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111af6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058209fbfa484628b02babb980313ae79b77e708df8b0c46024caff44504889d7641100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582074970f9039947bd68280c4890eda25eea22b3196e45bb676de7fe01d9e4f4feb0029", "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c806311d752ad146200004b578063704914f814620002fa5780639d3b4355146200038c575b600080fd5b620002f8600480360360a08110156200006357600080fd5b81019080803590602001906401000000008111156200008157600080fd5b8201836020820111156200009457600080fd5b80359060200191846001830284011164010000000083111715620000b757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200011b57600080fd5b8201836020820111156200012e57600080fd5b803590602001918460018302840111640100000000831117156200015157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115620001b557600080fd5b820183602082011115620001c857600080fd5b80359060200191846001830284011164010000000083111715620001eb57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200024f57600080fd5b8201836020820111156200026257600080fd5b803590602001918460018302840111640100000000831117156200028557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050620003ac565b005b62000333600480360360408110156200031257600080fd5b810190808035906020019092919080359060200190929190505050620006cf565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015620003785780820151818401526020810190506200035b565b505050509050019250505060405180910390f35b6200039662000866565b6040518082815260200191505060405180910390f35b6000858585858533604051620003c29062000872565b80806020018060200180602001806020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185810385528b818151815260200191508051906020019080838360005b838110156200047157808201518184015260208101905062000454565b50505050905090810190601f1680156200049f5780820380516001836020036101000a031916815260200191505b5085810384528a818151815260200191508051906020019080838360005b83811015620004da578082015181840152602081019050620004bd565b50505050905090810190601f168015620005085780820380516001836020036101000a031916815260200191505b50858103835289818151815260200191508051906020019080838360005b838110156200054357808201518184015260208101905062000526565b50505050905090810190601f168015620005715780820380516001836020036101000a031916815260200191505b50858103825288818151815260200191508051906020019080838360005b83811015620005ac5780820151818401526020810190506200058f565b50505050905090810190601f168015620005da5780820380516001836020036101000a031916815260200191505b509a5050505050505050505050604051809103906000f08015801562000604573d6000803e3d6000fd5b50905060008190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fa2398daac0c8053a1e3c0280916c2ec6bc884f0959c27e639a4db829b7eabfb160405160405180910390a3505050505050565b6060620006db62000866565b82111562000751576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6f6666736574206f7574206f6620626f756e647300000000000000000000000081525060200191505060405180910390fd5b6000826200075e62000866565b03905083811062000770578362000772565b805b9050601481106200078557601462000787565b805b905080604051908082528060200260200182016040528015620007b95781602001602082028038833980820191505090505b50915060008090505b818110156200085b57600081850181548110620007db57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168382815181106200081357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050620007c2565b508191505092915050565b60008080549050905090565b61174380620008818339019056fe60806040523480156200001157600080fd5b506040516200174338038062001743833981018060405260c08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b828101905060208101848111156200006757600080fd5b81518560018202830111640100000000821117156200008557600080fd5b50509291906020018051640100000000811115620000a257600080fd5b82810190506020810184811115620000b957600080fd5b8151856001820283011164010000000082111715620000d757600080fd5b50509291906020018051640100000000811115620000f457600080fd5b828101905060208101848111156200010b57600080fd5b81518560018202830111640100000000821117156200012957600080fd5b505092919060200180516401000000008111156200014657600080fd5b828101905060208101848111156200015d57600080fd5b81518560018202830111640100000000821117156200017b57600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600290805190602001906200026e9291906200045e565b508460039080519060200190620002879291906200045e565b508360049080519060200190620002a09291906200045e565b508260059080519060200190620002b99291906200045e565b5081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200030c816200031860201b60201c565b5050505050506200050d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806200171d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004a157805160ff1916838001178555620004d2565b82800160010185558215620004d2579182015b82811115620004d1578251825591602001919060010190620004b4565b5b509050620004e19190620004e5565b5090565b6200050a91905b8082111562000506576000816000905550600101620004ec565b5090565b90565b611200806200051d6000396000f3fe6080604052600436106100f35760003560e01c8063715018a61161008a578063b90497e011610059578063b90497e014610538578063de2ed893146105c8578063ed88c68e146105f3578063f2fde38b146105fd576100f3565b8063715018a61461040b5780637284e416146104225780638da5cb5b146104b25780638f32d59b14610509576100f3565b80631f522595116100c65780631f522595146102e257806338af3eed1461030d5780633ccfd60b146103645780635600f04f1461037b576100f3565b80630180b97c1461012257806306fdde031461014d5780631a57f7b4146101dd5780631c31f71014610291575b6101083460075461064e90919063ffffffff16565b600781905550600860008154809291906001019190505550005b34801561012e57600080fd5b506101376106d6565b6040518082815260200191505060405180910390f35b34801561015957600080fd5b50610162610720565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a2578082015181840152602081019050610187565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e957600080fd5b506101f26107be565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561023957808201518184015260208101905061021e565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561027b578082015181840152602081019050610260565b5050505090500194505050505060405180910390f35b34801561029d57600080fd5b506102e0600480360360208110156102b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ef565b005b3480156102ee57600080fd5b506102f76109ad565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b506103226109b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037057600080fd5b506103796109d9565b005b34801561038757600080fd5b50610390610b12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d05780820151818401526020810190506103b5565b50505050905090810190601f1680156103fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041757600080fd5b50610420610bb0565b005b34801561042e57600080fd5b50610437610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104c7610d87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051557600080fd5b5061051e610db0565b604051808215151515815260200191505060405180910390f35b34801561054457600080fd5b5061054d610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058d578082015181840152602081019050610572565b50505050905090810190601f1680156105ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d457600080fd5b506105dd610ea5565b6040518082815260200191505060405180910390f35b6105fb610eab565b005b34801561060957600080fd5b5061064c6004803603602081101561062057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fca565b005b6000808284019050838110156106cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905090565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b505050505081565b60608060006107cb6106d6565b9050806040519080825280602002602001820160405280156107fc5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561082e5781602001602082028038833980820191505090505b50915060008090505b818110156108e3576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061088b57fe5b9060005260206000209060020201905080600001548583815181106108ac57fe5b60200260200101818152505080600101548483815181106108c957fe5b602002602001018181525050508080600101915050610837565b50828292509250509091565b6108f7610db0565b610969576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e1610db0565b610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ad7573d6000803e3d6000fd5b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d816040518082815260200191505060405180910390a150565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ba85780601f10610b7d57610100808354040283529160200191610ba8565b820191906000526020600020905b815481529060010190602001808311610b8b57829003601f168201915b505050505081565b610bb8610db0565b610c2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e9d5780601f10610e7257610100808354040283529160200191610e9d565b820191906000526020600020905b815481529060010190602001808311610e8057829003601f168201915b505050505081565b60075481565b610eb3611194565b6040518060400160405280348152602001428152509050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010155505050610f613460075461064e90919063ffffffff16565b6007819055506008600081548092919060010191905055503373ffffffffffffffffffffffffffffffffffffffff167f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c52346040518082815260200191505060405180910390a250565b610fd2610db0565b611044576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61104d81611050565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111af6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60405180604001604052806000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058209fbfa484628b02babb980313ae79b77e708df8b0c46024caff44504889d7641100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582074970f9039947bd68280c4890eda25eea22b3196e45bb676de7fe01d9e4f4feb0029", "sourceMap": "61:1320:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;61:1320:1;;;;;;;", "deployedSourceMap": "61:1320:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;61:1320:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;251:501;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;251:501:1;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;251:501:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;251:501:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;251:501:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;251:501:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;251:501:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;251:501:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;251:501:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;251:501:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;251:501:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;251:501:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;251:501:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;251:501:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;251:501:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;251:501:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;251:501:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;251:501:1;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;864:515;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;864:515:1;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;864:515:1;;;;;;;;;;;;;;;;;758:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;;251:501;471:21;523:4;541:3;558:8;580:11;605;630:10;495:155;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;495:155:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;495:155:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;495:155:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;495:155:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;495:155:1;471:179;;660:12;678:10;660:29;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;660:29:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;734:10;704:41;;722:10;704:41;;;;;;;;;;;;251:501;;;;;;:::o;864:515::-;960:24;1018:18;:16;:18::i;:::-;1008:6;:28;;1000:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1072:12;1108:6;1087:18;:16;:18::i;:::-;:27;1072:42;;1138:5;1131:4;:12;:27;;1153:5;1131:27;;;1146:4;1131:27;1124:34;;121:2;1175:4;:15;:33;;121:2;1175:33;;;1193:4;1175:33;1168:40;;1242:4;1225:22;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;1225:22:1;;;;1218:29;;1262:9;1274:1;1262:13;;1258:93;1281:4;1277:1;:8;1258:93;;;1316:12;1338:1;1329:6;:10;1316:24;;;;;;;;;;;;;;;;;;;;;;;;;1306:4;1311:1;1306:7;;;;;;;;;;;;;:34;;;;;;;;;;;1287:3;;;;;;;1258:93;;;;1368:4;1361:11;;;864:515;;;;:::o;758:100::-;806:7;832:12;:19;;;;825:26;;758:100;:::o;61:1320::-;;;;;;;;:::o", "source": "pragma solidity >0.4.23 <0.7.0;\n\nimport \"./Fundraiser.sol\";\n\ncontract FundraiserFactory {\n uint256 constant maxLimit = 20;\n Fundraiser[] private _fundraisers;\n\n event FundraiserCreated(Fundraiser indexed fundraiser, address indexed owner);\n\n function createFundraiser(\n string memory name,\n string memory url,\n string memory imageURL,\n string memory description,\n address payable beneficiary\n )\n public\n {\n Fundraiser fundraiser = new Fundraiser(\n name,\n url,\n imageURL,\n description,\n beneficiary,\n msg.sender\n );\n _fundraisers.push(fundraiser);\n emit FundraiserCreated(fundraiser, msg.sender);\n }\n\n function fundraisersCount() public view returns(uint256) {\n return _fundraisers.length;\n }\n\n function fundraisers(uint256 limit, uint256 offset)\n public\n view\n returns(Fundraiser[] memory coll)\n {\n require(offset <= fundraisersCount(), \"offset out of bounds\");\n\n uint256 size = fundraisersCount() - offset;\n size = size < limit ? size : limit;\n size = size < maxLimit ? size : maxLimit;\n coll = new Fundraiser[](size);\n\n for(uint256 i = 0; i < size; i++) {\n coll[i] = _fundraisers[offset + i];\n }\n\n return coll;\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/FundraiserFactory.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/FundraiserFactory.sol", "exportedSymbols": { "FundraiserFactory": [ 394 ] }, "id": 395, "nodeType": "SourceUnit", "nodes": [ { "id": 256, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:1" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol", "file": "./Fundraiser.sol", "id": 257, "nodeType": "ImportDirective", "scope": 395, "sourceUnit": 255, "src": "33:26:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [ 254 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 394, "linearizedBaseContracts": [ 394 ], "name": "FundraiserFactory", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 260, "name": "maxLimit", "nodeType": "VariableDeclaration", "scope": 394, "src": "93:30:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 258, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "93:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3230", "id": 259, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "121:2:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_20_by_1", "typeString": "int_const 20" }, "value": "20" }, "visibility": "internal" }, { "constant": false, "id": 263, "name": "_fundraisers", "nodeType": "VariableDeclaration", "scope": 394, "src": "128:33:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 261, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "128:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 262, "length": null, "nodeType": "ArrayTypeName", "src": "128:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 269, "name": "FundraiserCreated", "nodeType": "EventDefinition", "parameters": { "id": 268, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 265, "indexed": true, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 269, "src": "191:29:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 264, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "191:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 267, "indexed": true, "name": "owner", "nodeType": "VariableDeclaration", "scope": 269, "src": "222:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 266, "name": "address", "nodeType": "ElementaryTypeName", "src": "222:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "190:54:1" }, "src": "167:78:1" }, { "body": { "id": 307, "nodeType": "Block", "src": "461:291:1", "statements": [ { "assignments": [ 283 ], "declarations": [ { "constant": false, "id": 283, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 307, "src": "471:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 282, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "471:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" } ], "id": 294, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 286, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 271, "src": "523:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 287, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 273, "src": "541:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 288, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 275, "src": "558:8:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 289, "name": "description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 277, "src": "580:11:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 290, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 279, "src": "605:11:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 291, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "630:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 292, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "630:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 285, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "NewExpression", "src": "495:14:1", "typeDescriptions": { "typeIdentifier": "t_function_creation_nonpayable$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_address_payable_$_t_address_$returns$_t_contract$_Fundraiser_$254_$", "typeString": "function (string memory,string memory,string memory,string memory,address payable,address) returns (contract Fundraiser)" }, "typeName": { "contractScope": null, "id": 284, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "499:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } }, "id": 293, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "495:155:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "nodeType": "VariableDeclarationStatement", "src": "471:179:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 298, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 283, "src": "678:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } ], "expression": { "argumentTypes": null, "id": 295, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "660:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 297, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "660:17:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_contract$_Fundraiser_$254_$returns$_t_uint256_$", "typeString": "function (contract Fundraiser) returns (uint256)" } }, "id": 299, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "660:29:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 300, "nodeType": "ExpressionStatement", "src": "660:29:1" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 302, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 283, "src": "722:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 303, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "734:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 304, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "734:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 301, "name": "FundraiserCreated", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 269, "src": "704:17:1", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_contract$_Fundraiser_$254_$_t_address_$returns$__$", "typeString": "function (contract Fundraiser,address)" } }, "id": 305, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "704:41:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 306, "nodeType": "EmitStatement", "src": "699:46:1" } ] }, "documentation": null, "id": 308, "implemented": true, "kind": "function", "modifiers": [], "name": "createFundraiser", "nodeType": "FunctionDefinition", "parameters": { "id": 280, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 271, "name": "name", "nodeType": "VariableDeclaration", "scope": 308, "src": "286:18:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 270, "name": "string", "nodeType": "ElementaryTypeName", "src": "286:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 273, "name": "url", "nodeType": "VariableDeclaration", "scope": 308, "src": "314:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 272, "name": "string", "nodeType": "ElementaryTypeName", "src": "314:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 275, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 308, "src": "341:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 274, "name": "string", "nodeType": "ElementaryTypeName", "src": "341:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 277, "name": "description", "nodeType": "VariableDeclaration", "scope": 308, "src": "373:25:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 276, "name": "string", "nodeType": "ElementaryTypeName", "src": "373:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 279, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 308, "src": "408:27:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 278, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:15:1", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "276:165:1" }, "returnParameters": { "id": 281, "nodeType": "ParameterList", "parameters": [], "src": "461:0:1" }, "scope": 394, "src": "251:501:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 316, "nodeType": "Block", "src": "815:43:1", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 313, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "832:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 314, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "832:19:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 312, "id": 315, "nodeType": "Return", "src": "825:26:1" } ] }, "documentation": null, "id": 317, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisersCount", "nodeType": "FunctionDefinition", "parameters": { "id": 309, "nodeType": "ParameterList", "parameters": [], "src": "783:2:1" }, "returnParameters": { "id": 312, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 311, "name": "", "nodeType": "VariableDeclaration", "scope": 317, "src": "806:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 310, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "806:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "805:9:1" }, "scope": 394, "src": "758:100:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 392, "nodeType": "Block", "src": "990:389:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 331, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 328, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1008:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 329, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 317, "src": "1018:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 330, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1008:28:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "6f6666736574206f7574206f6620626f756e6473", "id": 332, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1038:22:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_31439bfe95e1d4cf2fd9196e5b66ee2df2a4a2a9519de09bc7c634808a9e727e", "typeString": "literal_string \"offset out of bounds\"" }, "value": "offset out of bounds" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_31439bfe95e1d4cf2fd9196e5b66ee2df2a4a2a9519de09bc7c634808a9e727e", "typeString": "literal_string \"offset out of bounds\"" } ], "id": 327, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1000:7:1", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 333, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1000:61:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 334, "nodeType": "ExpressionStatement", "src": "1000:61:1" }, { "assignments": [ 336 ], "declarations": [ { "constant": false, "id": 336, "name": "size", "nodeType": "VariableDeclaration", "scope": 392, "src": "1072:12:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 335, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1072:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 341, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 340, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 337, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 317, "src": "1087:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 338, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1087:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 339, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1108:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1087:27:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1072:42:1" }, { "expression": { "argumentTypes": null, "id": 349, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 342, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1124:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 345, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 343, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1131:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 344, "name": "limit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 319, "src": "1138:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1131:12:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 347, "name": "limit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 319, "src": "1153:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 348, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "1131:27:1", "trueExpression": { "argumentTypes": null, "id": 346, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1146:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1124:34:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 350, "nodeType": "ExpressionStatement", "src": "1124:34:1" }, { "expression": { "argumentTypes": null, "id": 358, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 351, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1168:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 354, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 352, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1175:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 353, "name": "maxLimit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "1182:8:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1175:15:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 356, "name": "maxLimit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "1200:8:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 357, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "1175:33:1", "trueExpression": { "argumentTypes": null, "id": 355, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1193:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1168:40:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 359, "nodeType": "ExpressionStatement", "src": "1168:40:1" }, { "expression": { "argumentTypes": null, "id": 366, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 360, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1218:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 364, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1242:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 363, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1225:16:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_contract$_Fundraiser_$254_$dyn_memory_$", "typeString": "function (uint256) pure returns (contract Fundraiser[] memory)" }, "typeName": { "baseType": { "contractScope": null, "id": 361, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "1229:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 362, "length": null, "nodeType": "ArrayTypeName", "src": "1229:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } } }, "id": 365, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1225:22:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory", "typeString": "contract Fundraiser[] memory" } }, "src": "1218:29:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 367, "nodeType": "ExpressionStatement", "src": "1218:29:1" }, { "body": { "id": 388, "nodeType": "Block", "src": "1292:59:1", "statements": [ { "expression": { "argumentTypes": null, "id": 386, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 378, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1306:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 380, "indexExpression": { "argumentTypes": null, "id": 379, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1311:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1306:7:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 381, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "1316:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 385, "indexExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 384, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 382, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1329:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 383, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1338:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1329:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1316:24:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "src": "1306:34:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 387, "nodeType": "ExpressionStatement", "src": "1306:34:1" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 374, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 372, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1277:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 373, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1281:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1277:8:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 389, "initializationExpression": { "assignments": [ 369 ], "declarations": [ { "constant": false, "id": 369, "name": "i", "nodeType": "VariableDeclaration", "scope": 389, "src": "1262:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 368, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1262:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 371, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 370, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1274:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "1262:13:1" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 376, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1287:3:1", "subExpression": { "argumentTypes": null, "id": 375, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1287:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 377, "nodeType": "ExpressionStatement", "src": "1287:3:1" }, "nodeType": "ForStatement", "src": "1258:93:1" }, { "expression": { "argumentTypes": null, "id": 390, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1368:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "functionReturnParameters": 326, "id": 391, "nodeType": "Return", "src": "1361:11:1" } ] }, "documentation": null, "id": 393, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisers", "nodeType": "FunctionDefinition", "parameters": { "id": 322, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 319, "name": "limit", "nodeType": "VariableDeclaration", "scope": 393, "src": "885:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 318, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "885:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 321, "name": "offset", "nodeType": "VariableDeclaration", "scope": 393, "src": "900:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 320, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "900:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "884:31:1" }, "returnParameters": { "id": 326, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 325, "name": "coll", "nodeType": "VariableDeclaration", "scope": 393, "src": "960:24:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 323, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "960:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 324, "length": null, "nodeType": "ArrayTypeName", "src": "960:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "internal" } ], "src": "959:26:1" }, "scope": 394, "src": "864:515:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 395, "src": "61:1320:1" } ], "src": "0:1382:1" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/FundraiserFactory.sol", "exportedSymbols": { "FundraiserFactory": [ 394 ] }, "id": 395, "nodeType": "SourceUnit", "nodes": [ { "id": 256, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:1" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Fundraiser.sol", "file": "./Fundraiser.sol", "id": 257, "nodeType": "ImportDirective", "scope": 395, "sourceUnit": 255, "src": "33:26:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [ 254 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 394, "linearizedBaseContracts": [ 394 ], "name": "FundraiserFactory", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 260, "name": "maxLimit", "nodeType": "VariableDeclaration", "scope": 394, "src": "93:30:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 258, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "93:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3230", "id": 259, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "121:2:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_20_by_1", "typeString": "int_const 20" }, "value": "20" }, "visibility": "internal" }, { "constant": false, "id": 263, "name": "_fundraisers", "nodeType": "VariableDeclaration", "scope": 394, "src": "128:33:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 261, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "128:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 262, "length": null, "nodeType": "ArrayTypeName", "src": "128:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 269, "name": "FundraiserCreated", "nodeType": "EventDefinition", "parameters": { "id": 268, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 265, "indexed": true, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 269, "src": "191:29:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 264, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "191:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 267, "indexed": true, "name": "owner", "nodeType": "VariableDeclaration", "scope": 269, "src": "222:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 266, "name": "address", "nodeType": "ElementaryTypeName", "src": "222:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "190:54:1" }, "src": "167:78:1" }, { "body": { "id": 307, "nodeType": "Block", "src": "461:291:1", "statements": [ { "assignments": [ 283 ], "declarations": [ { "constant": false, "id": 283, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 307, "src": "471:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 282, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "471:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" } ], "id": 294, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 286, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 271, "src": "523:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 287, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 273, "src": "541:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 288, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 275, "src": "558:8:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 289, "name": "description", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 277, "src": "580:11:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 290, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 279, "src": "605:11:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 291, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "630:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 292, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "630:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 285, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "NewExpression", "src": "495:14:1", "typeDescriptions": { "typeIdentifier": "t_function_creation_nonpayable$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_address_payable_$_t_address_$returns$_t_contract$_Fundraiser_$254_$", "typeString": "function (string memory,string memory,string memory,string memory,address payable,address) returns (contract Fundraiser)" }, "typeName": { "contractScope": null, "id": 284, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "499:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } }, "id": 293, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "495:155:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "nodeType": "VariableDeclarationStatement", "src": "471:179:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 298, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 283, "src": "678:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } ], "expression": { "argumentTypes": null, "id": 295, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "660:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 297, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "660:17:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_contract$_Fundraiser_$254_$returns$_t_uint256_$", "typeString": "function (contract Fundraiser) returns (uint256)" } }, "id": 299, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "660:29:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 300, "nodeType": "ExpressionStatement", "src": "660:29:1" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 302, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 283, "src": "722:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 303, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "734:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 304, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "734:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 301, "name": "FundraiserCreated", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 269, "src": "704:17:1", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_contract$_Fundraiser_$254_$_t_address_$returns$__$", "typeString": "function (contract Fundraiser,address)" } }, "id": 305, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "704:41:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 306, "nodeType": "EmitStatement", "src": "699:46:1" } ] }, "documentation": null, "id": 308, "implemented": true, "kind": "function", "modifiers": [], "name": "createFundraiser", "nodeType": "FunctionDefinition", "parameters": { "id": 280, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 271, "name": "name", "nodeType": "VariableDeclaration", "scope": 308, "src": "286:18:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 270, "name": "string", "nodeType": "ElementaryTypeName", "src": "286:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 273, "name": "url", "nodeType": "VariableDeclaration", "scope": 308, "src": "314:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 272, "name": "string", "nodeType": "ElementaryTypeName", "src": "314:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 275, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 308, "src": "341:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 274, "name": "string", "nodeType": "ElementaryTypeName", "src": "341:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 277, "name": "description", "nodeType": "VariableDeclaration", "scope": 308, "src": "373:25:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 276, "name": "string", "nodeType": "ElementaryTypeName", "src": "373:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 279, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 308, "src": "408:27:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 278, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:15:1", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "276:165:1" }, "returnParameters": { "id": 281, "nodeType": "ParameterList", "parameters": [], "src": "461:0:1" }, "scope": 394, "src": "251:501:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 316, "nodeType": "Block", "src": "815:43:1", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 313, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "832:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 314, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "832:19:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 312, "id": 315, "nodeType": "Return", "src": "825:26:1" } ] }, "documentation": null, "id": 317, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisersCount", "nodeType": "FunctionDefinition", "parameters": { "id": 309, "nodeType": "ParameterList", "parameters": [], "src": "783:2:1" }, "returnParameters": { "id": 312, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 311, "name": "", "nodeType": "VariableDeclaration", "scope": 317, "src": "806:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 310, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "806:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "805:9:1" }, "scope": 394, "src": "758:100:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 392, "nodeType": "Block", "src": "990:389:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 331, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 328, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1008:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 329, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 317, "src": "1018:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 330, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1008:28:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "6f6666736574206f7574206f6620626f756e6473", "id": 332, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1038:22:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_31439bfe95e1d4cf2fd9196e5b66ee2df2a4a2a9519de09bc7c634808a9e727e", "typeString": "literal_string \"offset out of bounds\"" }, "value": "offset out of bounds" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_31439bfe95e1d4cf2fd9196e5b66ee2df2a4a2a9519de09bc7c634808a9e727e", "typeString": "literal_string \"offset out of bounds\"" } ], "id": 327, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1000:7:1", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 333, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1000:61:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 334, "nodeType": "ExpressionStatement", "src": "1000:61:1" }, { "assignments": [ 336 ], "declarations": [ { "constant": false, "id": 336, "name": "size", "nodeType": "VariableDeclaration", "scope": 392, "src": "1072:12:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 335, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1072:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 341, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 340, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 337, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 317, "src": "1087:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 338, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1087:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 339, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1108:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1087:27:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1072:42:1" }, { "expression": { "argumentTypes": null, "id": 349, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 342, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1124:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 345, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 343, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1131:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 344, "name": "limit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 319, "src": "1138:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1131:12:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 347, "name": "limit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 319, "src": "1153:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 348, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "1131:27:1", "trueExpression": { "argumentTypes": null, "id": 346, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1146:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1124:34:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 350, "nodeType": "ExpressionStatement", "src": "1124:34:1" }, { "expression": { "argumentTypes": null, "id": 358, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 351, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1168:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 354, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 352, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1175:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 353, "name": "maxLimit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "1182:8:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1175:15:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseExpression": { "argumentTypes": null, "id": 356, "name": "maxLimit", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "1200:8:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 357, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "Conditional", "src": "1175:33:1", "trueExpression": { "argumentTypes": null, "id": 355, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1193:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1168:40:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 359, "nodeType": "ExpressionStatement", "src": "1168:40:1" }, { "expression": { "argumentTypes": null, "id": 366, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 360, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1218:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 364, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1242:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 363, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1225:16:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_contract$_Fundraiser_$254_$dyn_memory_$", "typeString": "function (uint256) pure returns (contract Fundraiser[] memory)" }, "typeName": { "baseType": { "contractScope": null, "id": 361, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "1229:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 362, "length": null, "nodeType": "ArrayTypeName", "src": "1229:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } } }, "id": 365, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1225:22:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory", "typeString": "contract Fundraiser[] memory" } }, "src": "1218:29:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 367, "nodeType": "ExpressionStatement", "src": "1218:29:1" }, { "body": { "id": 388, "nodeType": "Block", "src": "1292:59:1", "statements": [ { "expression": { "argumentTypes": null, "id": 386, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 378, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1306:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 380, "indexExpression": { "argumentTypes": null, "id": 379, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1311:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1306:7:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 381, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 263, "src": "1316:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 385, "indexExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 384, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 382, "name": "offset", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 321, "src": "1329:6:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 383, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1338:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1329:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1316:24:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "src": "1306:34:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 387, "nodeType": "ExpressionStatement", "src": "1306:34:1" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 374, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 372, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1277:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 373, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 336, "src": "1281:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1277:8:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 389, "initializationExpression": { "assignments": [ 369 ], "declarations": [ { "constant": false, "id": 369, "name": "i", "nodeType": "VariableDeclaration", "scope": 389, "src": "1262:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 368, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1262:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 371, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 370, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1274:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "1262:13:1" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 376, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1287:3:1", "subExpression": { "argumentTypes": null, "id": 375, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 369, "src": "1287:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 377, "nodeType": "ExpressionStatement", "src": "1287:3:1" }, "nodeType": "ForStatement", "src": "1258:93:1" }, { "expression": { "argumentTypes": null, "id": 390, "name": "coll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 325, "src": "1368:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "functionReturnParameters": 326, "id": 391, "nodeType": "Return", "src": "1361:11:1" } ] }, "documentation": null, "id": 393, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisers", "nodeType": "FunctionDefinition", "parameters": { "id": 322, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 319, "name": "limit", "nodeType": "VariableDeclaration", "scope": 393, "src": "885:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 318, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "885:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 321, "name": "offset", "nodeType": "VariableDeclaration", "scope": 393, "src": "900:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 320, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "900:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "884:31:1" }, "returnParameters": { "id": 326, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 325, "name": "coll", "nodeType": "VariableDeclaration", "scope": 393, "src": "960:24:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_memory_ptr", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 323, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 254, "src": "960:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$254", "typeString": "contract Fundraiser" } }, "id": 324, "length": null, "nodeType": "ArrayTypeName", "src": "960:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$254_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "internal" } ], "src": "959:26:1" }, "scope": 394, "src": "864:515:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 395, "src": "61:1320:1" } ], "src": "0:1382:1" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "5777": { "events": { "0xa2398daac0c8053a1e3c0280916c2ec6bc884f0959c27e639a4db829b7eabfb1": { "anonymous": false, "inputs": [ { "indexed": true, "name": "fundraiser", "type": "address" }, { "indexed": true, "name": "owner", "type": "address" } ], "name": "FundraiserCreated", "type": "event", "signature": "0xa2398daac0c8053a1e3c0280916c2ec6bc884f0959c27e639a4db829b7eabfb1" } }, "links": {}, "address": "0x044d2473E5e4346e2e183DEae925A6963E1a3640", "transactionHash": "0x0e1b12fc622eabb457e59a480564deab151c64c39072caa77f53420ec266b960" } }, "schemaVersion": "3.0.16", "updatedAt": "2019-10-10T05:34:38.086Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-10+11/client/src/contracts/Migrations.json ================================================ { "contractName": "Migrations", "abi": [ { "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" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": false, "inputs": [ { "name": "completed", "type": "uint256" } ], "name": "setCompleted", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "new_address", "type": "address" } ], "name": "upgrade", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Migrations.sol\":{\"keccak256\":\"0xf65fcb01f4b8ef6909f55bccf7f05ab483d953e671e205d9ce8ea6a9adc3c653\",\"urls\":[\"bzzr://ea0687984a75ca6b8aa89a3ba439fa3123a53421a5b5474320c74ad1174583fc\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820a53fe5b964624d5e7a9902782b7acf85b45a9394624f5028b3c3d47da62a61b90029", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820a53fe5b964624d5e7a9902782b7acf85b45a9394624f5028b3c3d47da62a61b90029", "sourceMap": "25:480:2:-;;;177:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;177:50:2;212:10;204:5;;:18;;;;;;;;;;;;;;;;;;25:480;;;;;;", "deployedSourceMap": "25:480:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:480:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;338:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;338:165:2;;;;;;;;;;;;;;;;;;;:::i;:::-;;73:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;49:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;231:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;231:103:2;;;;;;;;;;;;;;;;;:::i;:::-;;338:165;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;400:19;433:11;400:45;;451:8;:21;;;473:24;;451:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;451:47:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;451:47:2;;;;167:1;142:26;338:165;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;231:103::-;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;320:9;293:24;:36;;;;142:26;231:103;:::o", "source": "pragma solidity ^0.5.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Migrations.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 451 ] }, "id": 452, "nodeType": "SourceUnit", "nodes": [ { "id": 396, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:2" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 451, "linearizedBaseContracts": [ 451 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 398, "name": "owner", "nodeType": "VariableDeclaration", "scope": 451, "src": "49:20:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 397, "name": "address", "nodeType": "ElementaryTypeName", "src": "49:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 400, "name": "last_completed_migration", "nodeType": "VariableDeclaration", "scope": 451, "src": "73:36:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 399, "name": "uint", "nodeType": "ElementaryTypeName", "src": "73:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 408, "nodeType": "Block", "src": "136:37:2", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 405, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 402, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "146:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 403, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "146:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 404, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 398, "src": "160:5:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "146:19:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 407, "nodeType": "IfStatement", "src": "142:26:2", "trueBody": { "id": 406, "nodeType": "PlaceholderStatement", "src": "167:1:2" } } ] }, "documentation": null, "id": 409, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 401, "nodeType": "ParameterList", "parameters": [], "src": "133:2:2" }, "src": "114:59:2", "visibility": "internal" }, { "body": { "id": 417, "nodeType": "Block", "src": "198:29:2", "statements": [ { "expression": { "argumentTypes": null, "id": 415, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 412, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 398, "src": "204:5:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 413, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "212:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 414, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "212:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "204:18:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 416, "nodeType": "ExpressionStatement", "src": "204:18:2" } ] }, "documentation": null, "id": 418, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 410, "nodeType": "ParameterList", "parameters": [], "src": "188:2:2" }, "returnParameters": { "id": 411, "nodeType": "ParameterList", "parameters": [], "src": "198:0:2" }, "scope": 451, "src": "177:50:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 429, "nodeType": "Block", "src": "287:47:2", "statements": [ { "expression": { "argumentTypes": null, "id": 427, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 425, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 400, "src": "293:24:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 426, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 420, "src": "320:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "293:36:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 428, "nodeType": "ExpressionStatement", "src": "293:36:2" } ] }, "documentation": null, "id": 430, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 423, "modifierName": { "argumentTypes": null, "id": 422, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 409, "src": "276:10:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "276:10:2" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 421, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 420, "name": "completed", "nodeType": "VariableDeclaration", "scope": 430, "src": "253:14:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 419, "name": "uint", "nodeType": "ElementaryTypeName", "src": "253:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "252:16:2" }, "returnParameters": { "id": 424, "nodeType": "ParameterList", "parameters": [], "src": "287:0:2" }, "scope": 451, "src": "231:103:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 449, "nodeType": "Block", "src": "394:109:2", "statements": [ { "assignments": [ 438 ], "declarations": [ { "constant": false, "id": 438, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 449, "src": "400:19:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, "id": 437, "name": "Migrations", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 451, "src": "400:10:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "value": null, "visibility": "internal" } ], "id": 442, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 440, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 432, "src": "433:11:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 439, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 451, "src": "422:10:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Migrations_$451_$", "typeString": "type(contract Migrations)" } }, "id": 441, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "422:23:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "400:45:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 446, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 400, "src": "473:24:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 443, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 438, "src": "451:8:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "id": 445, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", "referencedDeclaration": 430, "src": "451:21:2", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, "id": 447, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "451:47:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 448, "nodeType": "ExpressionStatement", "src": "451:47:2" } ] }, "documentation": null, "id": 450, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 435, "modifierName": { "argumentTypes": null, "id": 434, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 409, "src": "383:10:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "383:10:2" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 433, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 432, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 450, "src": "355:19:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 431, "name": "address", "nodeType": "ElementaryTypeName", "src": "355:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "354:21:2" }, "returnParameters": { "id": 436, "nodeType": "ParameterList", "parameters": [], "src": "394:0:2" }, "scope": 451, "src": "338:165:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 452, "src": "25:480:2" } ], "src": "0:506:2" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/hoscdev/chapter-10+11/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 451 ] }, "id": 452, "nodeType": "SourceUnit", "nodes": [ { "id": 396, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:2" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 451, "linearizedBaseContracts": [ 451 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 398, "name": "owner", "nodeType": "VariableDeclaration", "scope": 451, "src": "49:20:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 397, "name": "address", "nodeType": "ElementaryTypeName", "src": "49:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 400, "name": "last_completed_migration", "nodeType": "VariableDeclaration", "scope": 451, "src": "73:36:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 399, "name": "uint", "nodeType": "ElementaryTypeName", "src": "73:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 408, "nodeType": "Block", "src": "136:37:2", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 405, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 402, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "146:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 403, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "146:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 404, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 398, "src": "160:5:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "146:19:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 407, "nodeType": "IfStatement", "src": "142:26:2", "trueBody": { "id": 406, "nodeType": "PlaceholderStatement", "src": "167:1:2" } } ] }, "documentation": null, "id": 409, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 401, "nodeType": "ParameterList", "parameters": [], "src": "133:2:2" }, "src": "114:59:2", "visibility": "internal" }, { "body": { "id": 417, "nodeType": "Block", "src": "198:29:2", "statements": [ { "expression": { "argumentTypes": null, "id": 415, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 412, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 398, "src": "204:5:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 413, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "212:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 414, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "212:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "204:18:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 416, "nodeType": "ExpressionStatement", "src": "204:18:2" } ] }, "documentation": null, "id": 418, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 410, "nodeType": "ParameterList", "parameters": [], "src": "188:2:2" }, "returnParameters": { "id": 411, "nodeType": "ParameterList", "parameters": [], "src": "198:0:2" }, "scope": 451, "src": "177:50:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 429, "nodeType": "Block", "src": "287:47:2", "statements": [ { "expression": { "argumentTypes": null, "id": 427, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 425, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 400, "src": "293:24:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 426, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 420, "src": "320:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "293:36:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 428, "nodeType": "ExpressionStatement", "src": "293:36:2" } ] }, "documentation": null, "id": 430, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 423, "modifierName": { "argumentTypes": null, "id": 422, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 409, "src": "276:10:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "276:10:2" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 421, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 420, "name": "completed", "nodeType": "VariableDeclaration", "scope": 430, "src": "253:14:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 419, "name": "uint", "nodeType": "ElementaryTypeName", "src": "253:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "252:16:2" }, "returnParameters": { "id": 424, "nodeType": "ParameterList", "parameters": [], "src": "287:0:2" }, "scope": 451, "src": "231:103:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 449, "nodeType": "Block", "src": "394:109:2", "statements": [ { "assignments": [ 438 ], "declarations": [ { "constant": false, "id": 438, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 449, "src": "400:19:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, "id": 437, "name": "Migrations", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 451, "src": "400:10:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "value": null, "visibility": "internal" } ], "id": 442, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 440, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 432, "src": "433:11:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 439, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 451, "src": "422:10:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Migrations_$451_$", "typeString": "type(contract Migrations)" } }, "id": 441, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "422:23:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "400:45:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 446, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 400, "src": "473:24:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 443, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 438, "src": "451:8:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$451", "typeString": "contract Migrations" } }, "id": 445, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", "referencedDeclaration": 430, "src": "451:21:2", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, "id": 447, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "451:47:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 448, "nodeType": "ExpressionStatement", "src": "451:47:2" } ] }, "documentation": null, "id": 450, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 435, "modifierName": { "argumentTypes": null, "id": 434, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 409, "src": "383:10:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "383:10:2" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 433, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 432, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 450, "src": "355:19:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 431, "name": "address", "nodeType": "ElementaryTypeName", "src": "355:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "354:21:2" }, "returnParameters": { "id": 436, "nodeType": "ParameterList", "parameters": [], "src": "394:0:2" }, "scope": 451, "src": "338:165:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 452, "src": "25:480:2" } ], "src": "0:506:2" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, "address": "0x5736072ebAeC61cf47a7E3399BA8cAC23C4ac984", "transactionHash": "0xcd71a19f1b2d7613ea8992829556b529e0b3da40e74e58894f37cadb6ee4e50c" } }, "schemaVersion": "3.0.16", "updatedAt": "2019-10-10T05:34:38.087Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-10+11/client/src/contracts/Ownable.json ================================================ { "contractName": "Ownable", "abi": [ { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"details\":\"Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. * This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be aplied to your functions to restrict their use to the owner.\",\"methods\":{\"constructor\":{\"details\":\"Initializes the contract setting the deployer as the initial owner.\"},\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity ^0.5.0;\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be aplied to your functions to restrict their use to\n * the owner.\n */\ncontract Ownable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n _owner = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(isOwner(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Returns true if the caller is the current owner.\n */\n function isOwner() public view returns (bool) {\n return msg.sender == _owner;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * > Note: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address newOwner) internal {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n", "sourcePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "ast": { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "exportedSymbols": { "Ownable": [ 695 ] }, "id": 696, "nodeType": "SourceUnit", "nodes": [ { "id": 586, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:4" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@dev Contract module which provides a basic access control mechanism, where\nthere is an account (an owner) that can be granted exclusive access to\nspecific functions.\n * This module is used through inheritance. It will make available the modifier\n`onlyOwner`, which can be aplied to your functions to restrict their use to\nthe owner.", "fullyImplemented": true, "id": 695, "linearizedBaseContracts": [ 695 ], "name": "Ownable", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 588, "name": "_owner", "nodeType": "VariableDeclaration", "scope": 695, "src": "408:22:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 587, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 594, "name": "OwnershipTransferred", "nodeType": "EventDefinition", "parameters": { "id": 593, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 590, "indexed": true, "name": "previousOwner", "nodeType": "VariableDeclaration", "scope": 594, "src": "464:29:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 589, "name": "address", "nodeType": "ElementaryTypeName", "src": "464:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 592, "indexed": true, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 594, "src": "495:24:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 591, "name": "address", "nodeType": "ElementaryTypeName", "src": "495:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "463:57:4" }, "src": "437:84:4" }, { "body": { "id": 609, "nodeType": "Block", "src": "647:91:4", "statements": [ { "expression": { "argumentTypes": null, "id": 600, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 597, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "657:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 598, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "666:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 599, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "666:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "657:19:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 601, "nodeType": "ExpressionStatement", "src": "657:19:4" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 604, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "720:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 603, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "712:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 605, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "712:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 606, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "724:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 602, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "691:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 607, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:40:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 608, "nodeType": "EmitStatement", "src": "686:45:4" } ] }, "documentation": "@dev Initializes the contract setting the deployer as the initial owner.", "id": 610, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 595, "nodeType": "ParameterList", "parameters": [], "src": "635:2:4" }, "returnParameters": { "id": 596, "nodeType": "ParameterList", "parameters": [], "src": "647:0:4" }, "scope": 695, "src": "623:115:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 617, "nodeType": "Block", "src": "861:30:4", "statements": [ { "expression": { "argumentTypes": null, "id": 615, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "878:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 614, "id": 616, "nodeType": "Return", "src": "871:13:4" } ] }, "documentation": "@dev Returns the address of the current owner.", "id": 618, "implemented": true, "kind": "function", "modifiers": [], "name": "owner", "nodeType": "FunctionDefinition", "parameters": { "id": 611, "nodeType": "ParameterList", "parameters": [], "src": "828:2:4" }, "returnParameters": { "id": 614, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 613, "name": "", "nodeType": "VariableDeclaration", "scope": 618, "src": "852:7:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 612, "name": "address", "nodeType": "ElementaryTypeName", "src": "852:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "851:9:4" }, "scope": 695, "src": "814:77:4", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 627, "nodeType": "Block", "src": "1000:82:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 621, "name": "isOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 639, "src": "1018:7:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, "id": 622, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:9:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572", "id": 623, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1029:34:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" }, "value": "Ownable: caller is not the owner" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" } ], "id": 620, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1010:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 624, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1010:54:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 625, "nodeType": "ExpressionStatement", "src": "1010:54:4" }, { "id": 626, "nodeType": "PlaceholderStatement", "src": "1074:1:4" } ] }, "documentation": "@dev Throws if called by any account other than the owner.", "id": 628, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 619, "nodeType": "ParameterList", "parameters": [], "src": "997:2:4" }, "src": "979:103:4", "visibility": "internal" }, { "body": { "id": 638, "nodeType": "Block", "src": "1211:44:4", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 636, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 633, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1228:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 634, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1228:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 635, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1242:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1228:20:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 632, "id": 637, "nodeType": "Return", "src": "1221:27:4" } ] }, "documentation": "@dev Returns true if the caller is the current owner.", "id": 639, "implemented": true, "kind": "function", "modifiers": [], "name": "isOwner", "nodeType": "FunctionDefinition", "parameters": { "id": 629, "nodeType": "ParameterList", "parameters": [], "src": "1181:2:4" }, "returnParameters": { "id": 632, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 631, "name": "", "nodeType": "VariableDeclaration", "scope": 639, "src": "1205:4:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 630, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1205:4:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1204:6:4" }, "scope": 695, "src": "1165:90:4", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 657, "nodeType": "Block", "src": "1645:91:4", "statements": [ { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 645, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1681:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 647, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1697:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 646, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1689:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 648, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1689:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 644, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "1660:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 649, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1660:40:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 650, "nodeType": "EmitStatement", "src": "1655:45:4" }, { "expression": { "argumentTypes": null, "id": 655, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 651, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1710:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 653, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1727:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 652, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1719:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 654, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1719:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1710:19:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 656, "nodeType": "ExpressionStatement", "src": "1710:19:4" } ] }, "documentation": "@dev Leaves the contract without owner. It will not be possible to call\n`onlyOwner` functions anymore. Can only be called by the current owner.\n * > Note: Renouncing ownership will leave the contract without an owner,\nthereby removing any functionality that is only available to the owner.", "id": 658, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 642, "modifierName": { "argumentTypes": null, "id": 641, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1635:9:4", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1635:9:4" } ], "name": "renounceOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 640, "nodeType": "ParameterList", "parameters": [], "src": "1625:2:4" }, "returnParameters": { "id": 643, "nodeType": "ParameterList", "parameters": [], "src": "1645:0:4" }, "scope": 695, "src": "1599:137:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 669, "nodeType": "Block", "src": "1947:45:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 666, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 660, "src": "1976:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 665, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 694, "src": "1957:18:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 667, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1957:28:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 668, "nodeType": "ExpressionStatement", "src": "1957:28:4" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).\nCan only be called by the current owner.", "id": 670, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 663, "modifierName": { "argumentTypes": null, "id": 662, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1937:9:4", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1937:9:4" } ], "name": "transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 661, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 660, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 670, "src": "1912:16:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 659, "name": "address", "nodeType": "ElementaryTypeName", "src": "1912:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1911:18:4" }, "returnParameters": { "id": 664, "nodeType": "ParameterList", "parameters": [], "src": "1947:0:4" }, "scope": 695, "src": "1885:107:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 693, "nodeType": "Block", "src": "2148:170:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 680, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 676, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2166:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 678, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2186:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 677, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2178:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 679, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2178:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "2166:22:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "id": 681, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2190:40:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" }, "value": "Ownable: new owner is the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" } ], "id": 675, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2158:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 682, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2158:73:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 683, "nodeType": "ExpressionStatement", "src": "2158:73:4" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 685, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "2267:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 686, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2275:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 684, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "2246:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 687, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2246:38:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 688, "nodeType": "EmitStatement", "src": "2241:43:4" }, { "expression": { "argumentTypes": null, "id": 691, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 689, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "2294:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 690, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2303:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2294:17:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 692, "nodeType": "ExpressionStatement", "src": "2294:17:4" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).", "id": 694, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 673, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 672, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 694, "src": "2121:16:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 671, "name": "address", "nodeType": "ElementaryTypeName", "src": "2121:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2120:18:4" }, "returnParameters": { "id": 674, "nodeType": "ParameterList", "parameters": [], "src": "2148:0:4" }, "scope": 695, "src": "2093:225:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 696, "src": "385:1935:4" } ], "src": "0:2321:4" }, "legacyAST": { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "exportedSymbols": { "Ownable": [ 695 ] }, "id": 696, "nodeType": "SourceUnit", "nodes": [ { "id": 586, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:4" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@dev Contract module which provides a basic access control mechanism, where\nthere is an account (an owner) that can be granted exclusive access to\nspecific functions.\n * This module is used through inheritance. It will make available the modifier\n`onlyOwner`, which can be aplied to your functions to restrict their use to\nthe owner.", "fullyImplemented": true, "id": 695, "linearizedBaseContracts": [ 695 ], "name": "Ownable", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 588, "name": "_owner", "nodeType": "VariableDeclaration", "scope": 695, "src": "408:22:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 587, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 594, "name": "OwnershipTransferred", "nodeType": "EventDefinition", "parameters": { "id": 593, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 590, "indexed": true, "name": "previousOwner", "nodeType": "VariableDeclaration", "scope": 594, "src": "464:29:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 589, "name": "address", "nodeType": "ElementaryTypeName", "src": "464:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 592, "indexed": true, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 594, "src": "495:24:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 591, "name": "address", "nodeType": "ElementaryTypeName", "src": "495:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "463:57:4" }, "src": "437:84:4" }, { "body": { "id": 609, "nodeType": "Block", "src": "647:91:4", "statements": [ { "expression": { "argumentTypes": null, "id": 600, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 597, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "657:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 598, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "666:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 599, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "666:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "657:19:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 601, "nodeType": "ExpressionStatement", "src": "657:19:4" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 604, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "720:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 603, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "712:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 605, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "712:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 606, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "724:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 602, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "691:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 607, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:40:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 608, "nodeType": "EmitStatement", "src": "686:45:4" } ] }, "documentation": "@dev Initializes the contract setting the deployer as the initial owner.", "id": 610, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 595, "nodeType": "ParameterList", "parameters": [], "src": "635:2:4" }, "returnParameters": { "id": 596, "nodeType": "ParameterList", "parameters": [], "src": "647:0:4" }, "scope": 695, "src": "623:115:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 617, "nodeType": "Block", "src": "861:30:4", "statements": [ { "expression": { "argumentTypes": null, "id": 615, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "878:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 614, "id": 616, "nodeType": "Return", "src": "871:13:4" } ] }, "documentation": "@dev Returns the address of the current owner.", "id": 618, "implemented": true, "kind": "function", "modifiers": [], "name": "owner", "nodeType": "FunctionDefinition", "parameters": { "id": 611, "nodeType": "ParameterList", "parameters": [], "src": "828:2:4" }, "returnParameters": { "id": 614, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 613, "name": "", "nodeType": "VariableDeclaration", "scope": 618, "src": "852:7:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 612, "name": "address", "nodeType": "ElementaryTypeName", "src": "852:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "851:9:4" }, "scope": 695, "src": "814:77:4", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 627, "nodeType": "Block", "src": "1000:82:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 621, "name": "isOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 639, "src": "1018:7:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, "id": 622, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:9:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572", "id": 623, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1029:34:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" }, "value": "Ownable: caller is not the owner" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" } ], "id": 620, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1010:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 624, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1010:54:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 625, "nodeType": "ExpressionStatement", "src": "1010:54:4" }, { "id": 626, "nodeType": "PlaceholderStatement", "src": "1074:1:4" } ] }, "documentation": "@dev Throws if called by any account other than the owner.", "id": 628, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 619, "nodeType": "ParameterList", "parameters": [], "src": "997:2:4" }, "src": "979:103:4", "visibility": "internal" }, { "body": { "id": 638, "nodeType": "Block", "src": "1211:44:4", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 636, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 633, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 710, "src": "1228:3:4", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 634, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1228:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 635, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1242:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1228:20:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 632, "id": 637, "nodeType": "Return", "src": "1221:27:4" } ] }, "documentation": "@dev Returns true if the caller is the current owner.", "id": 639, "implemented": true, "kind": "function", "modifiers": [], "name": "isOwner", "nodeType": "FunctionDefinition", "parameters": { "id": 629, "nodeType": "ParameterList", "parameters": [], "src": "1181:2:4" }, "returnParameters": { "id": 632, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 631, "name": "", "nodeType": "VariableDeclaration", "scope": 639, "src": "1205:4:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 630, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1205:4:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1204:6:4" }, "scope": 695, "src": "1165:90:4", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 657, "nodeType": "Block", "src": "1645:91:4", "statements": [ { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 645, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1681:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 647, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1697:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 646, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1689:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 648, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1689:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 644, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "1660:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 649, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1660:40:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 650, "nodeType": "EmitStatement", "src": "1655:45:4" }, { "expression": { "argumentTypes": null, "id": 655, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 651, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "1710:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 653, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1727:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 652, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1719:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 654, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1719:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1710:19:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 656, "nodeType": "ExpressionStatement", "src": "1710:19:4" } ] }, "documentation": "@dev Leaves the contract without owner. It will not be possible to call\n`onlyOwner` functions anymore. Can only be called by the current owner.\n * > Note: Renouncing ownership will leave the contract without an owner,\nthereby removing any functionality that is only available to the owner.", "id": 658, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 642, "modifierName": { "argumentTypes": null, "id": 641, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1635:9:4", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1635:9:4" } ], "name": "renounceOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 640, "nodeType": "ParameterList", "parameters": [], "src": "1625:2:4" }, "returnParameters": { "id": 643, "nodeType": "ParameterList", "parameters": [], "src": "1645:0:4" }, "scope": 695, "src": "1599:137:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 669, "nodeType": "Block", "src": "1947:45:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 666, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 660, "src": "1976:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 665, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 694, "src": "1957:18:4", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 667, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1957:28:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 668, "nodeType": "ExpressionStatement", "src": "1957:28:4" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).\nCan only be called by the current owner.", "id": 670, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 663, "modifierName": { "argumentTypes": null, "id": 662, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 628, "src": "1937:9:4", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1937:9:4" } ], "name": "transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 661, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 660, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 670, "src": "1912:16:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 659, "name": "address", "nodeType": "ElementaryTypeName", "src": "1912:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1911:18:4" }, "returnParameters": { "id": 664, "nodeType": "ParameterList", "parameters": [], "src": "1947:0:4" }, "scope": 695, "src": "1885:107:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 693, "nodeType": "Block", "src": "2148:170:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 680, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 676, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2166:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 678, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2186:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 677, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2178:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 679, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2178:10:4", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "2166:22:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "id": 681, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2190:40:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" }, "value": "Ownable: new owner is the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" } ], "id": 675, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2158:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 682, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2158:73:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 683, "nodeType": "ExpressionStatement", "src": "2158:73:4" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 685, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "2267:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 686, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2275:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 684, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 594, "src": "2246:20:4", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 687, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2246:38:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 688, "nodeType": "EmitStatement", "src": "2241:43:4" }, { "expression": { "argumentTypes": null, "id": 691, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 689, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 588, "src": "2294:6:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 690, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 672, "src": "2303:8:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2294:17:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 692, "nodeType": "ExpressionStatement", "src": "2294:17:4" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).", "id": 694, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 673, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 672, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 694, "src": "2121:16:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 671, "name": "address", "nodeType": "ElementaryTypeName", "src": "2121:7:4", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2120:18:4" }, "returnParameters": { "id": 674, "nodeType": "ParameterList", "parameters": [], "src": "2148:0:4" }, "scope": 695, "src": "2093:225:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 696, "src": "385:1935:4" } ], "src": "0:2321:4" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.16", "updatedAt": "2019-10-10T05:34:34.824Z", "devdoc": { "details": "Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. * This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be aplied to your functions to restrict their use to the owner.", "methods": { "constructor": { "details": "Initializes the contract setting the deployer as the initial owner." }, "isOwner()": { "details": "Returns true if the caller is the current owner." }, "owner()": { "details": "Returns the address of the current owner." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } } }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-10+11/client/src/contracts/SafeMath.json ================================================ { "contractName": "SafeMath", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Wrappers over Solidity's arithmetic operations with added overflow checks. * Arithmetic operations in Solidity wrap on overflow. This can easily result in bugs, because programmers usually assume that an overflow raises an error, which is the standard behavior in high level programming languages. `SafeMath` restores this intuition by reverting the transaction when an operation overflows. * Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"openzeppelin-solidity/contracts/math/SafeMath.sol\":\"SafeMath\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x4ccf2d7b51873db1ccfd54ca2adae5eac3b184f9699911ed4490438419f1c690\",\"urls\":[\"bzzr://1604f5b6d6e916c154efd8c6720cda069e5ba32dfa0a9dedf2b42e5b02d07f89\"]}},\"version\":1}", "bytecode": "0x604c6023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a7230582046e13f71506be81d0cb6f4f96e627809fff89874ff20814d03a785f7e5c5940a0029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a7230582046e13f71506be81d0cb6f4f96e627809fff89874ff20814d03a785f7e5c5940a0029", "sourceMap": "589:2938:3:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", "deployedSourceMap": "589:2938:3:-;;;;;;;;", "source": "pragma solidity ^0.5.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0, \"SafeMath: division by zero\");\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n}\n", "sourcePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "ast": { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 584 ] }, "id": 585, "nodeType": "SourceUnit", "nodes": [ { "id": 453, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:3" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev Wrappers over Solidity's arithmetic operations with added overflow\nchecks.\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\nin bugs, because programmers usually assume that an overflow raises an\nerror, which is the standard behavior in high level programming languages.\n`SafeMath` restores this intuition by reverting the transaction when an\noperation overflows.\n * Using this library instead of the unchecked operations eliminates an entire\nclass of bugs, so it's recommended to use it always.", "fullyImplemented": true, "id": 584, "linearizedBaseContracts": [ 584 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 477, "nodeType": "Block", "src": "901:109:3", "statements": [ { "assignments": [ 463 ], "declarations": [ { "constant": false, "id": 463, "name": "c", "nodeType": "VariableDeclaration", "scope": 477, "src": "911:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 462, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "911:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 467, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 466, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 464, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 455, "src": "923:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 465, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 457, "src": "927:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "923:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "911:17:3" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 471, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 469, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 463, "src": "946:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 470, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 455, "src": "951:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "946:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206164646974696f6e206f766572666c6f77", "id": 472, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "954:29:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a", "typeString": "literal_string \"SafeMath: addition overflow\"" }, "value": "SafeMath: addition overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a", "typeString": "literal_string \"SafeMath: addition overflow\"" } ], "id": 468, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "938:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 473, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "938:46:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 474, "nodeType": "ExpressionStatement", "src": "938:46:3" }, { "expression": { "argumentTypes": null, "id": 475, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 463, "src": "1002:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 461, "id": 476, "nodeType": "Return", "src": "995:8:3" } ] }, "documentation": "@dev Returns the addition of two unsigned integers, reverting on\noverflow.\n * Counterpart to Solidity's `+` operator.\n * Requirements:\n- Addition cannot overflow.", "id": 478, "implemented": true, "kind": "function", "modifiers": [], "name": "add", "nodeType": "FunctionDefinition", "parameters": { "id": 458, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 455, "name": "a", "nodeType": "VariableDeclaration", "scope": 478, "src": "847:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 454, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "847:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 457, "name": "b", "nodeType": "VariableDeclaration", "scope": 478, "src": "858:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 456, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "858:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "846:22:3" }, "returnParameters": { "id": 461, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 460, "name": "", "nodeType": "VariableDeclaration", "scope": 478, "src": "892:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 459, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "892:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "891:9:3" }, "scope": 584, "src": "834:176:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 502, "nodeType": "Block", "src": "1341:112:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 490, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 488, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 482, "src": "1359:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 489, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 480, "src": "1364:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1359:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a207375627472616374696f6e206f766572666c6f77", "id": 491, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1367:32:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_50b058e9b5320e58880d88223c9801cd9eecdcf90323d5c2318bc1b6b916e862", "typeString": "literal_string \"SafeMath: subtraction overflow\"" }, "value": "SafeMath: subtraction overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_50b058e9b5320e58880d88223c9801cd9eecdcf90323d5c2318bc1b6b916e862", "typeString": "literal_string \"SafeMath: subtraction overflow\"" } ], "id": 487, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1351:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 492, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1351:49:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 493, "nodeType": "ExpressionStatement", "src": "1351:49:3" }, { "assignments": [ 495 ], "declarations": [ { "constant": false, "id": 495, "name": "c", "nodeType": "VariableDeclaration", "scope": 502, "src": "1410:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 494, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1410:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 499, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 498, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 496, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 480, "src": "1422:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 497, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 482, "src": "1426:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1422:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1410:17:3" }, { "expression": { "argumentTypes": null, "id": 500, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 495, "src": "1445:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 486, "id": 501, "nodeType": "Return", "src": "1438:8:3" } ] }, "documentation": "@dev Returns the subtraction of two unsigned integers, reverting on\noverflow (when the result is negative).\n * Counterpart to Solidity's `-` operator.\n * Requirements:\n- Subtraction cannot overflow.", "id": 503, "implemented": true, "kind": "function", "modifiers": [], "name": "sub", "nodeType": "FunctionDefinition", "parameters": { "id": 483, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 480, "name": "a", "nodeType": "VariableDeclaration", "scope": 503, "src": "1287:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 479, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1287:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 482, "name": "b", "nodeType": "VariableDeclaration", "scope": 503, "src": "1298:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 481, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1298:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1286:22:3" }, "returnParameters": { "id": 486, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 485, "name": "", "nodeType": "VariableDeclaration", "scope": 503, "src": "1332:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 484, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1332:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1331:9:3" }, "scope": 584, "src": "1274:179:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 536, "nodeType": "Block", "src": "1760:391:3", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 514, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 512, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "1991:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 513, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1996:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1991:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 518, "nodeType": "IfStatement", "src": "1987:45:3", "trueBody": { "id": 517, "nodeType": "Block", "src": "1999:33:3", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 515, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2020:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 511, "id": 516, "nodeType": "Return", "src": "2013:8:3" } ] } }, { "assignments": [ 520 ], "declarations": [ { "constant": false, "id": 520, "name": "c", "nodeType": "VariableDeclaration", "scope": 536, "src": "2042:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 519, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2042:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 524, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 523, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 521, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "2054:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 522, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 507, "src": "2058:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2054:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2042:17:3" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 530, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 528, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 526, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 520, "src": "2077:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 527, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "2081:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2077:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 529, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 507, "src": "2086:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2077:10:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77", "id": 531, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2089:35:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9113bb53c2876a3805b2c9242029423fc540a728243ce887ab24c82cf119fba3", "typeString": "literal_string \"SafeMath: multiplication overflow\"" }, "value": "SafeMath: multiplication overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9113bb53c2876a3805b2c9242029423fc540a728243ce887ab24c82cf119fba3", "typeString": "literal_string \"SafeMath: multiplication overflow\"" } ], "id": 525, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2069:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 532, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2069:56:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 533, "nodeType": "ExpressionStatement", "src": "2069:56:3" }, { "expression": { "argumentTypes": null, "id": 534, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 520, "src": "2143:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 511, "id": 535, "nodeType": "Return", "src": "2136:8:3" } ] }, "documentation": "@dev Returns the multiplication of two unsigned integers, reverting on\noverflow.\n * Counterpart to Solidity's `*` operator.\n * Requirements:\n- Multiplication cannot overflow.", "id": 537, "implemented": true, "kind": "function", "modifiers": [], "name": "mul", "nodeType": "FunctionDefinition", "parameters": { "id": 508, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 505, "name": "a", "nodeType": "VariableDeclaration", "scope": 537, "src": "1706:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 504, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1706:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 507, "name": "b", "nodeType": "VariableDeclaration", "scope": 537, "src": "1717:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 506, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1717:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1705:22:3" }, "returnParameters": { "id": 511, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 510, "name": "", "nodeType": "VariableDeclaration", "scope": 537, "src": "1751:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 509, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1751:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1750:9:3" }, "scope": 584, "src": "1693:458:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 561, "nodeType": "Block", "src": "2673:259:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 549, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 547, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 541, "src": "2757:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 548, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2761:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "2757:5:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206469766973696f6e206279207a65726f", "id": 550, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2764:28:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_5b7cc70dda4dc2143e5adb63bd5d1f349504f461dbdfd9bc76fac1f8ca6d019f", "typeString": "literal_string \"SafeMath: division by zero\"" }, "value": "SafeMath: division by zero" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_5b7cc70dda4dc2143e5adb63bd5d1f349504f461dbdfd9bc76fac1f8ca6d019f", "typeString": "literal_string \"SafeMath: division by zero\"" } ], "id": 546, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2749:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 551, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2749:44:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 552, "nodeType": "ExpressionStatement", "src": "2749:44:3" }, { "assignments": [ 554 ], "declarations": [ { "constant": false, "id": 554, "name": "c", "nodeType": "VariableDeclaration", "scope": 561, "src": "2803:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 553, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2803:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 558, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 557, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 555, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 539, "src": "2815:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 556, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 541, "src": "2819:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2815:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2803:17:3" }, { "expression": { "argumentTypes": null, "id": 559, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 554, "src": "2924:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 545, "id": 560, "nodeType": "Return", "src": "2917:8:3" } ] }, "documentation": "@dev Returns the integer division of two unsigned integers. Reverts on\ndivision by zero. The result is rounded towards zero.\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n`revert` opcode (which leaves remaining gas untouched) while Solidity\nuses an invalid opcode to revert (consuming all remaining gas).\n * Requirements:\n- The divisor cannot be zero.", "id": 562, "implemented": true, "kind": "function", "modifiers": [], "name": "div", "nodeType": "FunctionDefinition", "parameters": { "id": 542, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 539, "name": "a", "nodeType": "VariableDeclaration", "scope": 562, "src": "2619:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 538, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2619:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 541, "name": "b", "nodeType": "VariableDeclaration", "scope": 562, "src": "2630:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 540, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2630:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2618:22:3" }, "returnParameters": { "id": 545, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 544, "name": "", "nodeType": "VariableDeclaration", "scope": 562, "src": "2664:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 543, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2664:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2663:9:3" }, "scope": 584, "src": "2606:326:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 582, "nodeType": "Block", "src": "3443:82:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 574, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 572, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 566, "src": "3461:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 573, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3466:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "3461:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206d6f64756c6f206279207a65726f", "id": 575, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "3469:26:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_726e51f7b81fce0a68f5f214f445e275313b20b1633f08ce954ee39abf8d7832", "typeString": "literal_string \"SafeMath: modulo by zero\"" }, "value": "SafeMath: modulo by zero" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_726e51f7b81fce0a68f5f214f445e275313b20b1633f08ce954ee39abf8d7832", "typeString": "literal_string \"SafeMath: modulo by zero\"" } ], "id": 571, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "3453:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 576, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3453:43:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 577, "nodeType": "ExpressionStatement", "src": "3453:43:3" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 580, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 578, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 564, "src": "3513:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "id": 579, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 566, "src": "3517:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "3513:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 570, "id": 581, "nodeType": "Return", "src": "3506:12:3" } ] }, "documentation": "@dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\nReverts when dividing by zero.\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\nopcode (which leaves remaining gas untouched) while Solidity uses an\ninvalid opcode to revert (consuming all remaining gas).\n * Requirements:\n- The divisor cannot be zero.", "id": 583, "implemented": true, "kind": "function", "modifiers": [], "name": "mod", "nodeType": "FunctionDefinition", "parameters": { "id": 567, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 564, "name": "a", "nodeType": "VariableDeclaration", "scope": 583, "src": "3389:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 563, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3389:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 566, "name": "b", "nodeType": "VariableDeclaration", "scope": 583, "src": "3400:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 565, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3400:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3388:22:3" }, "returnParameters": { "id": 570, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 569, "name": "", "nodeType": "VariableDeclaration", "scope": 583, "src": "3434:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 568, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3434:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3433:9:3" }, "scope": 584, "src": "3376:149:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 585, "src": "589:2938:3" } ], "src": "0:3528:3" }, "legacyAST": { "absolutePath": "openzeppelin-solidity/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 584 ] }, "id": 585, "nodeType": "SourceUnit", "nodes": [ { "id": 453, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:3" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@dev Wrappers over Solidity's arithmetic operations with added overflow\nchecks.\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\nin bugs, because programmers usually assume that an overflow raises an\nerror, which is the standard behavior in high level programming languages.\n`SafeMath` restores this intuition by reverting the transaction when an\noperation overflows.\n * Using this library instead of the unchecked operations eliminates an entire\nclass of bugs, so it's recommended to use it always.", "fullyImplemented": true, "id": 584, "linearizedBaseContracts": [ 584 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 477, "nodeType": "Block", "src": "901:109:3", "statements": [ { "assignments": [ 463 ], "declarations": [ { "constant": false, "id": 463, "name": "c", "nodeType": "VariableDeclaration", "scope": 477, "src": "911:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 462, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "911:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 467, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 466, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 464, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 455, "src": "923:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 465, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 457, "src": "927:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "923:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "911:17:3" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 471, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 469, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 463, "src": "946:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 470, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 455, "src": "951:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "946:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206164646974696f6e206f766572666c6f77", "id": 472, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "954:29:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a", "typeString": "literal_string \"SafeMath: addition overflow\"" }, "value": "SafeMath: addition overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_30cc447bcc13b3e22b45cef0dd9b0b514842d836dd9b6eb384e20dedfb47723a", "typeString": "literal_string \"SafeMath: addition overflow\"" } ], "id": 468, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "938:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 473, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "938:46:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 474, "nodeType": "ExpressionStatement", "src": "938:46:3" }, { "expression": { "argumentTypes": null, "id": 475, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 463, "src": "1002:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 461, "id": 476, "nodeType": "Return", "src": "995:8:3" } ] }, "documentation": "@dev Returns the addition of two unsigned integers, reverting on\noverflow.\n * Counterpart to Solidity's `+` operator.\n * Requirements:\n- Addition cannot overflow.", "id": 478, "implemented": true, "kind": "function", "modifiers": [], "name": "add", "nodeType": "FunctionDefinition", "parameters": { "id": 458, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 455, "name": "a", "nodeType": "VariableDeclaration", "scope": 478, "src": "847:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 454, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "847:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 457, "name": "b", "nodeType": "VariableDeclaration", "scope": 478, "src": "858:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 456, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "858:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "846:22:3" }, "returnParameters": { "id": 461, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 460, "name": "", "nodeType": "VariableDeclaration", "scope": 478, "src": "892:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 459, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "892:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "891:9:3" }, "scope": 584, "src": "834:176:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 502, "nodeType": "Block", "src": "1341:112:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 490, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 488, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 482, "src": "1359:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 489, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 480, "src": "1364:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1359:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a207375627472616374696f6e206f766572666c6f77", "id": 491, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1367:32:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_50b058e9b5320e58880d88223c9801cd9eecdcf90323d5c2318bc1b6b916e862", "typeString": "literal_string \"SafeMath: subtraction overflow\"" }, "value": "SafeMath: subtraction overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_50b058e9b5320e58880d88223c9801cd9eecdcf90323d5c2318bc1b6b916e862", "typeString": "literal_string \"SafeMath: subtraction overflow\"" } ], "id": 487, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "1351:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 492, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1351:49:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 493, "nodeType": "ExpressionStatement", "src": "1351:49:3" }, { "assignments": [ 495 ], "declarations": [ { "constant": false, "id": 495, "name": "c", "nodeType": "VariableDeclaration", "scope": 502, "src": "1410:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 494, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1410:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 499, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 498, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 496, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 480, "src": "1422:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 497, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 482, "src": "1426:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1422:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1410:17:3" }, { "expression": { "argumentTypes": null, "id": 500, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 495, "src": "1445:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 486, "id": 501, "nodeType": "Return", "src": "1438:8:3" } ] }, "documentation": "@dev Returns the subtraction of two unsigned integers, reverting on\noverflow (when the result is negative).\n * Counterpart to Solidity's `-` operator.\n * Requirements:\n- Subtraction cannot overflow.", "id": 503, "implemented": true, "kind": "function", "modifiers": [], "name": "sub", "nodeType": "FunctionDefinition", "parameters": { "id": 483, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 480, "name": "a", "nodeType": "VariableDeclaration", "scope": 503, "src": "1287:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 479, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1287:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 482, "name": "b", "nodeType": "VariableDeclaration", "scope": 503, "src": "1298:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 481, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1298:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1286:22:3" }, "returnParameters": { "id": 486, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 485, "name": "", "nodeType": "VariableDeclaration", "scope": 503, "src": "1332:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 484, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1332:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1331:9:3" }, "scope": 584, "src": "1274:179:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 536, "nodeType": "Block", "src": "1760:391:3", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 514, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 512, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "1991:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 513, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1996:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1991:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 518, "nodeType": "IfStatement", "src": "1987:45:3", "trueBody": { "id": 517, "nodeType": "Block", "src": "1999:33:3", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 515, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2020:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 511, "id": 516, "nodeType": "Return", "src": "2013:8:3" } ] } }, { "assignments": [ 520 ], "declarations": [ { "constant": false, "id": 520, "name": "c", "nodeType": "VariableDeclaration", "scope": 536, "src": "2042:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 519, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2042:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 524, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 523, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 521, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "2054:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 522, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 507, "src": "2058:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2054:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2042:17:3" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 530, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 528, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 526, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 520, "src": "2077:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 527, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 505, "src": "2081:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2077:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 529, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 507, "src": "2086:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2077:10:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77", "id": 531, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2089:35:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9113bb53c2876a3805b2c9242029423fc540a728243ce887ab24c82cf119fba3", "typeString": "literal_string \"SafeMath: multiplication overflow\"" }, "value": "SafeMath: multiplication overflow" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9113bb53c2876a3805b2c9242029423fc540a728243ce887ab24c82cf119fba3", "typeString": "literal_string \"SafeMath: multiplication overflow\"" } ], "id": 525, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2069:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 532, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2069:56:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 533, "nodeType": "ExpressionStatement", "src": "2069:56:3" }, { "expression": { "argumentTypes": null, "id": 534, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 520, "src": "2143:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 511, "id": 535, "nodeType": "Return", "src": "2136:8:3" } ] }, "documentation": "@dev Returns the multiplication of two unsigned integers, reverting on\noverflow.\n * Counterpart to Solidity's `*` operator.\n * Requirements:\n- Multiplication cannot overflow.", "id": 537, "implemented": true, "kind": "function", "modifiers": [], "name": "mul", "nodeType": "FunctionDefinition", "parameters": { "id": 508, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 505, "name": "a", "nodeType": "VariableDeclaration", "scope": 537, "src": "1706:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 504, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1706:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 507, "name": "b", "nodeType": "VariableDeclaration", "scope": 537, "src": "1717:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 506, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1717:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1705:22:3" }, "returnParameters": { "id": 511, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 510, "name": "", "nodeType": "VariableDeclaration", "scope": 537, "src": "1751:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 509, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1751:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1750:9:3" }, "scope": 584, "src": "1693:458:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 561, "nodeType": "Block", "src": "2673:259:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 549, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 547, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 541, "src": "2757:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 548, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2761:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "2757:5:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206469766973696f6e206279207a65726f", "id": 550, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2764:28:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_5b7cc70dda4dc2143e5adb63bd5d1f349504f461dbdfd9bc76fac1f8ca6d019f", "typeString": "literal_string \"SafeMath: division by zero\"" }, "value": "SafeMath: division by zero" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_5b7cc70dda4dc2143e5adb63bd5d1f349504f461dbdfd9bc76fac1f8ca6d019f", "typeString": "literal_string \"SafeMath: division by zero\"" } ], "id": 546, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "2749:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 551, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2749:44:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 552, "nodeType": "ExpressionStatement", "src": "2749:44:3" }, { "assignments": [ 554 ], "declarations": [ { "constant": false, "id": 554, "name": "c", "nodeType": "VariableDeclaration", "scope": 561, "src": "2803:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 553, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2803:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 558, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 557, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 555, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 539, "src": "2815:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 556, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 541, "src": "2819:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2815:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2803:17:3" }, { "expression": { "argumentTypes": null, "id": 559, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 554, "src": "2924:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 545, "id": 560, "nodeType": "Return", "src": "2917:8:3" } ] }, "documentation": "@dev Returns the integer division of two unsigned integers. Reverts on\ndivision by zero. The result is rounded towards zero.\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n`revert` opcode (which leaves remaining gas untouched) while Solidity\nuses an invalid opcode to revert (consuming all remaining gas).\n * Requirements:\n- The divisor cannot be zero.", "id": 562, "implemented": true, "kind": "function", "modifiers": [], "name": "div", "nodeType": "FunctionDefinition", "parameters": { "id": 542, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 539, "name": "a", "nodeType": "VariableDeclaration", "scope": 562, "src": "2619:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 538, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2619:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 541, "name": "b", "nodeType": "VariableDeclaration", "scope": 562, "src": "2630:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 540, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2630:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2618:22:3" }, "returnParameters": { "id": 545, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 544, "name": "", "nodeType": "VariableDeclaration", "scope": 562, "src": "2664:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 543, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2664:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2663:9:3" }, "scope": 584, "src": "2606:326:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 582, "nodeType": "Block", "src": "3443:82:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 574, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 572, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 566, "src": "3461:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 573, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3466:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "3461:6:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "536166654d6174683a206d6f64756c6f206279207a65726f", "id": 575, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "3469:26:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_726e51f7b81fce0a68f5f214f445e275313b20b1633f08ce954ee39abf8d7832", "typeString": "literal_string \"SafeMath: modulo by zero\"" }, "value": "SafeMath: modulo by zero" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_726e51f7b81fce0a68f5f214f445e275313b20b1633f08ce954ee39abf8d7832", "typeString": "literal_string \"SafeMath: modulo by zero\"" } ], "id": 571, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 713, 714 ], "referencedDeclaration": 714, "src": "3453:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 576, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3453:43:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 577, "nodeType": "ExpressionStatement", "src": "3453:43:3" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 580, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 578, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 564, "src": "3513:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "id": 579, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 566, "src": "3517:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "3513:5:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 570, "id": 581, "nodeType": "Return", "src": "3506:12:3" } ] }, "documentation": "@dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\nReverts when dividing by zero.\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\nopcode (which leaves remaining gas untouched) while Solidity uses an\ninvalid opcode to revert (consuming all remaining gas).\n * Requirements:\n- The divisor cannot be zero.", "id": 583, "implemented": true, "kind": "function", "modifiers": [], "name": "mod", "nodeType": "FunctionDefinition", "parameters": { "id": 567, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 564, "name": "a", "nodeType": "VariableDeclaration", "scope": 583, "src": "3389:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 563, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3389:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 566, "name": "b", "nodeType": "VariableDeclaration", "scope": 583, "src": "3400:9:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 565, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3400:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3388:22:3" }, "returnParameters": { "id": 570, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 569, "name": "", "nodeType": "VariableDeclaration", "scope": 583, "src": "3434:7:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 568, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "3434:7:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "3433:9:3" }, "scope": 584, "src": "3376:149:3", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 585, "src": "589:2938:3" } ], "src": "0:3528:3" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.16", "updatedAt": "2019-10-10T05:34:34.822Z", "devdoc": { "details": "Wrappers over Solidity's arithmetic operations with added overflow checks. * Arithmetic operations in Solidity wrap on overflow. This can easily result in bugs, because programmers usually assume that an overflow raises an error, which is the standard behavior in high level programming languages. `SafeMath` restores this intuition by reverting the transaction when an operation overflows. * Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.", "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-10+11/client/src/index.css ================================================ body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: chapter-10+11/client/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom' import App from './App'; ReactDOM.render(( // // ), document.getElementById('root')) ================================================ FILE: chapter-10+11/client/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read http://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit http://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: chapter-10+11/client/src/utils/getWeb3.js ================================================ import Web3 from "web3"; const getWeb3 = () => new Promise((resolve, reject) => { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener("load", async () => { // Modern dapp browsers... if (window.ethereum) { const web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed resolve(web3); } catch (error) { reject(error); } } // Legacy dapp browsers... else if (window.web3) { // Use Mist/MetaMask's provider. const web3 = window.web3; console.log("Injected web3 detected."); resolve(web3); } // Fallback to localhost; use dev console port by default... else { const provider = new Web3.providers.HttpProvider( "http://127.0.0.1:8545" ); const web3 = new Web3(provider); console.log("No web3 instance injected, using Local web3."); resolve(web3); } }); }); export default getWeb3; ================================================ FILE: chapter-10+11/contracts/Fundraiser.sol ================================================ pragma solidity >0.4.23 <0.7.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract Fundraiser is Ownable { using SafeMath for uint256; struct Donation { uint256 value; uint256 date; } mapping(address => Donation[]) private _donations; event DonationReceived(address indexed donor, uint256 value); event Withdraw(uint256 amount); string public name; string public url; string public imageURL; string public description; address payable public beneficiary; uint256 public totalDonations; uint256 public donationsCount; constructor( string memory _name, string memory _url, string memory _imageURL, string memory _description, address payable _beneficiary, address _custodian ) public { name = _name; url = _url; imageURL = _imageURL; description = _description; beneficiary = _beneficiary; _transferOwnership(_custodian); } function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } function myDonationsCount() public view returns(uint256) { return _donations[msg.sender].length; } function donate() public payable { Donation memory donation = Donation({ value: msg.value, date: block.timestamp }); _donations[msg.sender].push(donation); totalDonations = totalDonations.add(msg.value); donationsCount++; emit DonationReceived(msg.sender, msg.value); } function myDonations() public view returns( uint256[] memory values, uint256[] memory dates ) { uint256 count = myDonationsCount(); values = new uint256[](count); dates = new uint256[](count); for (uint256 i = 0; i < count; i++) { Donation storage donation = _donations[msg.sender][i]; values[i] = donation.value; dates[i] = donation.date; } return (values, dates); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; beneficiary.transfer(balance); emit Withdraw(balance); } function () external payable { totalDonations = totalDonations.add(msg.value); donationsCount++; } } ================================================ FILE: chapter-10+11/contracts/FundraiserFactory.sol ================================================ pragma solidity >0.4.23 <0.7.0; import "./Fundraiser.sol"; contract FundraiserFactory { uint256 constant maxLimit = 20; Fundraiser[] private _fundraisers; event FundraiserCreated(Fundraiser indexed fundraiser, address indexed owner); function createFundraiser( string memory name, string memory url, string memory imageURL, string memory description, address payable beneficiary ) public { Fundraiser fundraiser = new Fundraiser( name, url, imageURL, description, beneficiary, msg.sender ); _fundraisers.push(fundraiser); emit FundraiserCreated(fundraiser, msg.sender); } function fundraisersCount() public view returns(uint256) { return _fundraisers.length; } function fundraisers(uint256 limit, uint256 offset) public view returns(Fundraiser[] memory coll) { require(offset <= fundraisersCount(), "offset out of bounds"); uint256 size = fundraisersCount() - offset; size = size < limit ? size : limit; size = size < maxLimit ? size : maxLimit; coll = new Fundraiser[](size); for(uint256 i = 0; i < size; i++) { coll[i] = _fundraisers[offset + i]; } return coll; } } ================================================ FILE: chapter-10+11/contracts/Migrations.sol ================================================ pragma solidity ^0.5.0; contract Migrations { address public owner; uint public last_completed_migration; modifier restricted() { if (msg.sender == owner) _; } constructor() public { owner = msg.sender; } function setCompleted(uint completed) public restricted { last_completed_migration = completed; } function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: chapter-10+11/migrations/1_initial_migration.js ================================================ var Migrations = artifacts.require("./Migrations.sol"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: chapter-10+11/migrations/2_deploy_fundraiser_factory.js ================================================ const FundraiserFactoryContract = artifacts.require("FundraiserFactory"); module.exports = function(deployer) { deployer.deploy(FundraiserFactoryContract); } ================================================ FILE: chapter-10+11/test/TestSimpleStorage.sol ================================================ pragma solidity ^0.5.0; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/SimpleStorage.sol"; contract TestSimpleStorage { function testItStoresAValue() public { SimpleStorage simpleStorage = SimpleStorage(DeployedAddresses.SimpleStorage()); simpleStorage.set(89); uint expected = 89; Assert.equal(simpleStorage.get(), expected, "It should store the value 89."); } } ================================================ FILE: chapter-10+11/test/simplestorage.js ================================================ const SimpleStorage = artifacts.require("./SimpleStorage.sol"); contract("SimpleStorage", accounts => { it("...should store the value 89.", async () => { const simpleStorageInstance = await SimpleStorage.deployed(); // Set value of 89 await simpleStorageInstance.set(89, { from: accounts[0] }); // Get stored value const storedData = await simpleStorageInstance.get.call(); assert.equal(storedData, 89, "The value 89 was not stored."); }); }); ================================================ FILE: chapter-10+11/truffle-config.js ================================================ const path = require("path"); module.exports = { // See // to customize your Truffle configuration! contracts_build_directory: path.join(__dirname, "client/src/contracts"), networks: { develop: { port: 8545 } } }; ================================================ FILE: chapter-4/greeter/contracts/Greeter.sol ================================================ pragma solidity >= 0.4.0 < 0.7.0; import "openzeppelin-solidity/contracts/access/Ownable.sol"; contract Greeter is Ownable { string private _greeting = "Hello, World!"; function greet() external view returns(string memory) { return _greeting; } function setGreeting(string calldata greeting) external onlyOwner { _greeting = greeting; } } ================================================ FILE: chapter-4/greeter/contracts/Migrations.sol ================================================ pragma solidity >=0.4.21 <0.6.0; contract Migrations { address public owner; uint public last_completed_migration; constructor() public { owner = msg.sender; } modifier restricted() { if (msg.sender == owner) _; } function setCompleted(uint completed) public restricted { last_completed_migration = completed; } function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: chapter-4/greeter/migrations/1_initial_migration.js ================================================ const Migrations = artifacts.require("Migrations"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: chapter-4/greeter/migrations/2_deploy_greeter.js ================================================ const GreeterContract = artifacts.require("Greeter"); module.exports = function(deployer) { deployer.deploy(GreeterContract); } ================================================ FILE: chapter-4/greeter/test/greeter_test.js ================================================ const GreeterContract = artifacts.require("Greeter"); contract("Greeter", (accounts) => { describe("deployment", () => { it("has been deployed successfully", async () => { const greeter = await GreeterContract.deployed(); assert(greeter, "contract failed to deploy"); }); }); describe("greet()", () => { it("returns 'Hello, World!'", async () => { const greeter = await GreeterContract.deployed(); const expected = "Hello, World!"; const actual = await greeter.greet(); assert.equal(actual, expected, "greeted with 'Hello, World!'"); }) }); describe("owner()", () => { it("returns the address of the owner", async () => { const greeter = await GreeterContract.deployed(); const owner = await greeter.owner(); assert(owner, "the current owner"); }); it("matches the address that originally deployed the contract", async () => { const greeter = await GreeterContract.deployed(); const owner = await greeter.owner(); const expected = accounts[0]; assert.equal(owner, expected, "matches address used to deploy contract"); }); }); }); contract("Greeter: update greeting", (accounts) => { describe("setGreeting(string)", () => { describe("when message is sent by the owner", () => { it("sets greeting to passed in string", async () => { const greeter = await GreeterContract.deployed() const expected = "The owner changed the message"; await greeter.setGreeting(expected); const actual = await greeter.greet(); assert.equal(actual, expected, "greeting was not updated"); }); }); describe("when message is sent by another account", () => { it("does not set the greeting", async () => { const greeter = await GreeterContract.deployed() const expected = await greeter.greet(); try { await greeter.setGreeting("Not the owner", { from: accounts[1] }); } catch(err) { const errorMessage = "Ownable: caller is not the owner" assert.equal(err.reason, errorMessage, "greeting should not update"); return; } assert(false, "greeting should not update"); }); }); }); }); ================================================ FILE: chapter-4/greeter/truffle-config.js ================================================ /** * Use this file to configure your truffle project. It's seeded with some * common settings for different networks and features like migrations, * compilation and testing. Uncomment the ones you need or modify * them to suit your project as necessary. * * More information about configuration can be found at: * * truffleframework.com/docs/advanced/configuration * * To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider) * to sign your transactions before they're sent to a remote public node. Infura accounts * are available for free at: infura.io/register. * * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate * public/private key pairs. If you're publishing your code to GitHub make sure you load this * phrase from a file you've .gitignored so it doesn't accidentally become public. * */ // const HDWalletProvider = require('truffle-hdwallet-provider'); // const infuraKey = "fj4jll3k....."; // // const fs = require('fs'); // const mnemonic = fs.readFileSync(".secret").toString().trim(); module.exports = { /** * Networks define how you connect to your ethereum client and let you set the * defaults web3 uses to send transactions. If you don't specify one truffle * will spin up a development blockchain for you on port 9545 when you * run `develop` or `test`. You can ask a truffle command to use a specific * network from the command line, e.g * * $ truffle test --network */ networks: { // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set the `host`, `port` and `network_id` // options below to some value. // // development: { // host: "127.0.0.1", // Localhost (default: none) // port: 8545, // Standard Ethereum port (default: none) // network_id: "*", // Any network (default: none) // }, // Another network with more advanced options... // advanced: { // port: 8777, // Custom port // network_id: 1342, // Custom network // gas: 8500000, // Gas sent with each transaction (default: ~6700000) // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) // from:
, // Account to send txs from (default: accounts[0]) // websockets: true // Enable EventEmitter interface for web3 (default: false) // }, // Useful for deploying to a public network. // NB: It's important to wrap the provider as a function. // ropsten: { // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), // network_id: 3, // Ropsten's id // gas: 5500000, // Ropsten has a lower block limit than mainnet // confirmations: 2, // # of confs to wait between deployments. (default: 0) // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) // }, // Useful for private networks // private: { // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), // network_id: 2111, // This network is yours, in the cloud. // production: true // Treats this network as if it was a public net. (default: false) // } }, // Set default mocha options here, use special reporters etc. mocha: { // timeout: 100000 }, // Configure your compilers compilers: { solc: { // version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version) // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) // settings: { // See the solidity docs for advice about optimization and evmVersion // optimizer: { // enabled: false, // runs: 200 // }, // evmVersion: "byzantium" // } } } } ================================================ FILE: chapter-5/greeter/client/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: chapter-5/greeter/client/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: chapter-5/greeter/client/package.json ================================================ { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.6.3", "react-dom": "^16.6.3", "react-scripts": "2.1.1", "web3": "^1.3.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } ================================================ FILE: chapter-5/greeter/client/public/index.html ================================================ React App
================================================ FILE: chapter-5/greeter/client/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: chapter-5/greeter/client/src/App.css ================================================ .App { text-align: center; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: chapter-5/greeter/client/src/App.js ================================================ import React, { Component } from "react"; import GreeterContract from "./contracts/Greeter.json"; import getWeb3 from "./utils/getWeb3"; import "./App.css"; class App extends Component { state = { greeting: '', web3: null, accounts: null, contract: null }; componentDidMount = async () => { try { // Get network provider and web3 instance. const web3 = await getWeb3(); // Use web3 to get the user's accounts. const accounts = await web3.eth.getAccounts(); // Get the contract instance. const networkId = await web3.eth.net.getId(); const deployedNetwork = GreeterContract.networks[networkId]; const instance = new web3.eth.Contract( GreeterContract.abi, deployedNetwork && deployedNetwork.address, ); // Set web3, accounts, and contract to the state, and then proceed with an // example of interacting with the contract's methods. this.setState({ web3, accounts, contract: instance }, this.runExample); } catch (error) { // Catch any errors for any of the above operations. alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } }; runExample = async () => { const { accounts, contract } = this.state; const response = await contract.methods.greet().call() this.setState({ greeting: response }); }; handleGreetingChange = (e) => { const inputVal = e.target.value this.setState({ greeting: inputVal }) } formSubmitHandler = async () => { const { accounts, contract, greeting } = this.state; const updatedGreeting = await contract.methods.setGreeting(greeting).send({from: accounts[0]}); } render() { if (!this.state.web3) { return
Loading Web3, accounts, and contract...
; } return (

Greeter

{this.state.greeting}
); } } export default App; ================================================ FILE: chapter-5/greeter/client/src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); ================================================ FILE: chapter-5/greeter/client/src/contracts/Context.json ================================================ { "contractName": "Context", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"openzeppelin-solidity/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"openzeppelin-solidity/contracts/utils/Context.sol\":{\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ded47ec7c96750f9bd04bbbc84f659992d4ba901cb7b532a52cd468272cf378f\",\"dweb:/ipfs/QmfBrGtQP7rZEqEg6Wz6jh2N2Kukpj1z5v3CGWmAqrzm96\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n", "sourcePath": "openzeppelin-solidity/contracts/utils/Context.sol", "ast": { "absolutePath": "openzeppelin-solidity/contracts/utils/Context.sol", "exportedSymbols": { "Context": [ 218 ] }, "id": 219, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 197, "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "33:31:3" }, { "abstract": true, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 218, "linearizedBaseContracts": [ 218 ], "name": "Context", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 205, "nodeType": "Block", "src": "668:34:3", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 202, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "685:3:3", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 203, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "685:10:3", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 201, "id": 204, "nodeType": "Return", "src": "678:17:3" } ] }, "documentation": null, "id": 206, "implemented": true, "kind": "function", "modifiers": [], "name": "_msgSender", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 198, "nodeType": "ParameterList", "parameters": [], "src": "617:2:3" }, "returnParameters": { "id": 201, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 200, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 206, "src": "651:15:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 199, "name": "address", "nodeType": "ElementaryTypeName", "src": "651:15:3", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "650:17:3" }, "scope": 218, "src": "598:104:3", "stateMutability": "view", "virtual": true, "visibility": "internal" }, { "body": { "id": 216, "nodeType": "Block", "src": "773:165:3", "statements": [ { "expression": { "argumentTypes": null, "id": 211, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, "src": "783:4:3", "typeDescriptions": { "typeIdentifier": "t_contract$_Context_$218", "typeString": "contract Context" } }, "id": 212, "nodeType": "ExpressionStatement", "src": "783:4:3" }, { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 213, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "923:3:3", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 214, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "data", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "923:8:3", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } }, "functionReturnParameters": 210, "id": 215, "nodeType": "Return", "src": "916:15:3" } ] }, "documentation": null, "id": 217, "implemented": true, "kind": "function", "modifiers": [], "name": "_msgData", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 207, "nodeType": "ParameterList", "parameters": [], "src": "725:2:3" }, "returnParameters": { "id": 210, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 209, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 217, "src": "759:12:3", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 208, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "759:5:3", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "758:14:3" }, "scope": 218, "src": "708:230:3", "stateMutability": "view", "virtual": true, "visibility": "internal" } ], "scope": 219, "src": "566:374:3" } ], "src": "33:908:3" }, "legacyAST": { "attributes": { "absolutePath": "openzeppelin-solidity/contracts/utils/Context.sol", "exportedSymbols": { "Context": [ 218 ] }, "license": "MIT" }, "children": [ { "attributes": { "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.8", ".0" ] }, "id": 197, "name": "PragmaDirective", "src": "33:31:3" }, { "attributes": { "abstract": true, "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ 218 ], "name": "Context", "scope": 219 }, "children": [ { "attributes": { "documentation": null, "implemented": true, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "_msgSender", "overrides": null, "scope": 218, "stateMutability": "view", "virtual": true, "visibility": "internal" }, "children": [ { "attributes": { "parameters": [ null ] }, "children": [], "id": 198, "name": "ParameterList", "src": "617:2:3" }, { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "", "overrides": null, "scope": 206, "stateVariable": false, "storageLocation": "default", "type": "address payable", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "address", "stateMutability": "payable", "type": "address payable" }, "id": 199, "name": "ElementaryTypeName", "src": "651:15:3" } ], "id": 200, "name": "VariableDeclaration", "src": "651:15:3" } ], "id": 201, "name": "ParameterList", "src": "650:17:3" }, { "children": [ { "attributes": { "functionReturnParameters": 201 }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "sender", "referencedDeclaration": null, "type": "address payable" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": -15, "type": "msg", "value": "msg" }, "id": 202, "name": "Identifier", "src": "685:3:3" } ], "id": 203, "name": "MemberAccess", "src": "685:10:3" } ], "id": 204, "name": "Return", "src": "678:17:3" } ], "id": 205, "name": "Block", "src": "668:34:3" } ], "id": 206, "name": "FunctionDefinition", "src": "598:104:3" }, { "attributes": { "documentation": null, "implemented": true, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "_msgData", "overrides": null, "scope": 218, "stateMutability": "view", "virtual": true, "visibility": "internal" }, "children": [ { "attributes": { "parameters": [ null ] }, "children": [], "id": 207, "name": "ParameterList", "src": "725:2:3" }, { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "", "overrides": null, "scope": 217, "stateVariable": false, "storageLocation": "memory", "type": "bytes", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "bytes", "type": "bytes" }, "id": 208, "name": "ElementaryTypeName", "src": "759:5:3" } ], "id": 209, "name": "VariableDeclaration", "src": "759:12:3" } ], "id": 210, "name": "ParameterList", "src": "758:14:3" }, { "children": [ { "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": -28, "type": "contract Context", "value": "this" }, "id": 211, "name": "Identifier", "src": "783:4:3" } ], "id": 212, "name": "ExpressionStatement", "src": "783:4:3" }, { "attributes": { "functionReturnParameters": 210 }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "data", "referencedDeclaration": null, "type": "bytes calldata" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": -15, "type": "msg", "value": "msg" }, "id": 213, "name": "Identifier", "src": "923:3:3" } ], "id": 214, "name": "MemberAccess", "src": "923:8:3" } ], "id": 215, "name": "Return", "src": "916:15:3" } ], "id": 216, "name": "Block", "src": "773:165:3" } ], "id": 217, "name": "FunctionDefinition", "src": "708:230:3" } ], "id": 218, "name": "ContractDefinition", "src": "566:374:3" } ], "id": 219, "name": "SourceUnit", "src": "33:908:3" }, "compiler": { "name": "solc", "version": "0.6.12+commit.27d51765.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.3.4", "updatedAt": "2021-03-29T15:59:14.528Z", "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } } ================================================ FILE: chapter-5/greeter/client/src/contracts/Greeter.json ================================================ { "contractName": "Greeter", "abi": [ { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": true, "inputs": [], "name": "greet", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "greeting", "type": "string" } ], "name": "setGreeting", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"greeting\",\"type\":\"string\"}],\"name\":\"setGreeting\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"greet\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Greeter.sol\":\"Greeter\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Greeter.sol\":{\"keccak256\":\"0x74e43d7c1b679a27f5480f4064e3f86c37c263b635357a52d006e81c58b815c3\",\"urls\":[\"bzzr://ad62d3d777461f480ffd9243f963a74eb9c761e6ae0c9c6e110f4b0589b8bdfc\"]},\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]}},\"version\":1}", "bytecode": "0x60806040526040518060400160405280600d81526020017f48656c6c6f2c20576f726c6421000000000000000000000000000000000000008152506001908051906020019061004f929190610111565b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36101b6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015257805160ff1916838001178555610180565b82800160010185558215610180579182015b8281111561017f578251825591602001919060010190610164565b5b50905061018d9190610191565b5090565b6101b391905b808211156101af576000816000905550600101610197565b5090565b90565b6107c9806101c56000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b146100715780638f32d59b146100bb578063a4136862146100dd578063cfae321714610156578063f2fde38b146101d9575b600080fd5b61006f61021d565b005b610079610356565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100c361037f565b604051808215151515815260200191505060405180910390f35b610154600480360360208110156100f357600080fd5b810190808035906020019064010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184600183028401116401000000008311171561014457600080fd5b90919293919293905050506103d6565b005b61015e610466565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019e578082015181840152602081019050610183565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021b600480360360208110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610508565b005b61022561037f565b610297576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6103de61037f565b610450576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8181600191906104619291906106d2565b505050565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104fe5780601f106104d3576101008083540402835291602001916104fe565b820191906000526020600020905b8154815290600101906020018083116104e157829003601f168201915b5050505050905090565b61051061037f565b610582576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61058b8161058e565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610614576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806107786026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061071357803560ff1916838001178555610741565b82800160010185558215610741579182015b82811115610740578235825591602001919060010190610725565b5b50905061074e9190610752565b5090565b61077491905b80821115610770576000816000905550600101610758565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058202a337ad911415c0a06ebd28749cc2b5c52892e80014e1961edcb57dbdcefd54e0029", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063715018a6146100675780638da5cb5b146100715780638f32d59b146100bb578063a4136862146100dd578063cfae321714610156578063f2fde38b146101d9575b600080fd5b61006f61021d565b005b610079610356565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100c361037f565b604051808215151515815260200191505060405180910390f35b610154600480360360208110156100f357600080fd5b810190808035906020019064010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184600183028401116401000000008311171561014457600080fd5b90919293919293905050506103d6565b005b61015e610466565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019e578082015181840152602081019050610183565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021b600480360360208110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610508565b005b61022561037f565b610297576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6103de61037f565b610450576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8181600191906104619291906106d2565b505050565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104fe5780601f106104d3576101008083540402835291602001916104fe565b820191906000526020600020905b8154815290600101906020018083116104e157829003601f168201915b5050505050905090565b61051061037f565b610582576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61058b8161058e565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610614576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806107786026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061071357803560ff1916838001178555610741565b82800160010185558215610741579182015b82811115610740578235825591602001919060010190610725565b5b50905061074e9190610752565b5090565b61077491905b80821115610770576000816000905550600101610758565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a723058202a337ad911415c0a06ebd28749cc2b5c52892e80014e1961edcb57dbdcefd54e0029", "sourceMap": "100:263:0:-;;;132:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;666:10:2;657:6;;:19;;;;;;;;;;;;;;;;;;724:6;;;;;;;;;;;691:40;;720:1;691:40;;;;;;;;;;;;100:263:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", "deployedSourceMap": "100:263:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;100:263:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1599:137:2;;;:::i;:::-;;814:77;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1165:90;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;264:97:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;264:97:0;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;264:97:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;264:97:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;264:97:0;;;;;;;;;;;;:::i;:::-;;179:81;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;179:81:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1885:107:2;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1885:107:2;;;;;;;;;;;;;;;;;;;:::i;:::-;;1599:137;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1697:1;1660:40;;1681:6;;;;;;;;;;;1660:40;;;;;;;;;;;;1727:1;1710:6;;:19;;;;;;;;;;;;;;;;;;1599:137::o;814:77::-;852:7;878:6;;;;;;;;;;;871:13;;814:77;:::o;1165:90::-;1205:4;1242:6;;;;;;;;;;;1228:20;;:10;:20;;;1221:27;;1165:90;:::o;264:97:0:-;1018:9:2;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;348:8:0;;336:9;:20;;;;;;;:::i;:::-;;264:97;;:::o;179:81::-;218:13;246:9;239:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;179:81;:::o;1885:107:2:-;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1957:28;1976:8;1957:18;:28::i;:::-;1885:107;:::o;2093:225::-;2186:1;2166:22;;:8;:22;;;;2158:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2275:8;2246:38;;2267:6;;;;;;;;;;;2246:38;;;;;;;;;;;;2303:8;2294:6;;:17;;;;;;;;;;;;;;;;;;2093:225;:::o;100:263:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity >= 0.4.0 < 0.7.0;\n\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\n\ncontract Greeter is Ownable {\n string private _greeting = \"Hello, World!\";\n\n function greet() external view returns(string memory) {\n return _greeting;\n }\n\n function setGreeting(string calldata greeting) external onlyOwner {\n _greeting = greeting;\n }\n}\n", "sourcePath": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Greeter.sol", "ast": { "absolutePath": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Greeter.sol", "exportedSymbols": { "Greeter": [ 28 ] }, "id": 29, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", ">=", "0.4", ".0", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:33:0" }, { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "file": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "id": 2, "nodeType": "ImportDirective", "scope": 29, "sourceUnit": 197, "src": "35:63:0", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 3, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 196, "src": "120:7:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$196", "typeString": "contract Ownable" } }, "id": 4, "nodeType": "InheritanceSpecifier", "src": "120:7:0" } ], "contractDependencies": [ 196 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 28, "linearizedBaseContracts": [ 28, 196 ], "name": "Greeter", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 7, "name": "_greeting", "nodeType": "VariableDeclaration", "scope": 28, "src": "132:42:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 5, "name": "string", "nodeType": "ElementaryTypeName", "src": "132:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": { "argumentTypes": null, "hexValue": "48656c6c6f2c20576f726c6421", "id": 6, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "159:15:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f", "typeString": "literal_string \"Hello, World!\"" }, "value": "Hello, World!" }, "visibility": "private" }, { "body": { "id": 14, "nodeType": "Block", "src": "233:27:0", "statements": [ { "expression": { "argumentTypes": null, "id": 12, "name": "_greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7, "src": "246:9:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 11, "id": 13, "nodeType": "Return", "src": "239:16:0" } ] }, "documentation": null, "id": 15, "implemented": true, "kind": "function", "modifiers": [], "name": "greet", "nodeType": "FunctionDefinition", "parameters": { "id": 8, "nodeType": "ParameterList", "parameters": [], "src": "193:2:0" }, "returnParameters": { "id": 11, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10, "name": "", "nodeType": "VariableDeclaration", "scope": 15, "src": "218:13:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 9, "name": "string", "nodeType": "ElementaryTypeName", "src": "218:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "217:15:0" }, "scope": 28, "src": "179:81:0", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": { "id": 26, "nodeType": "Block", "src": "330:31:0", "statements": [ { "expression": { "argumentTypes": null, "id": 24, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22, "name": "_greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7, "src": "336:9:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 23, "name": "greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 17, "src": "348:8:0", "typeDescriptions": { "typeIdentifier": "t_string_calldata_ptr", "typeString": "string calldata" } }, "src": "336:20:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 25, "nodeType": "ExpressionStatement", "src": "336:20:0" } ] }, "documentation": null, "id": 27, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 20, "modifierName": { "argumentTypes": null, "id": 19, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "320:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "320:9:0" } ], "name": "setGreeting", "nodeType": "FunctionDefinition", "parameters": { "id": 18, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 17, "name": "greeting", "nodeType": "VariableDeclaration", "scope": 27, "src": "285:24:0", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { "typeIdentifier": "t_string_calldata_ptr", "typeString": "string" }, "typeName": { "id": 16, "name": "string", "nodeType": "ElementaryTypeName", "src": "285:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "284:26:0" }, "returnParameters": { "id": 21, "nodeType": "ParameterList", "parameters": [], "src": "330:0:0" }, "scope": 28, "src": "264:97:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" } ], "scope": 29, "src": "100:263:0" } ], "src": "0:364:0" }, "legacyAST": { "absolutePath": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Greeter.sol", "exportedSymbols": { "Greeter": [ 28 ] }, "id": 29, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", ">=", "0.4", ".0", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:33:0" }, { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "file": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "id": 2, "nodeType": "ImportDirective", "scope": 29, "sourceUnit": 197, "src": "35:63:0", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 3, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 196, "src": "120:7:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$196", "typeString": "contract Ownable" } }, "id": 4, "nodeType": "InheritanceSpecifier", "src": "120:7:0" } ], "contractDependencies": [ 196 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 28, "linearizedBaseContracts": [ 28, 196 ], "name": "Greeter", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 7, "name": "_greeting", "nodeType": "VariableDeclaration", "scope": 28, "src": "132:42:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 5, "name": "string", "nodeType": "ElementaryTypeName", "src": "132:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": { "argumentTypes": null, "hexValue": "48656c6c6f2c20576f726c6421", "id": 6, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "159:15:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f", "typeString": "literal_string \"Hello, World!\"" }, "value": "Hello, World!" }, "visibility": "private" }, { "body": { "id": 14, "nodeType": "Block", "src": "233:27:0", "statements": [ { "expression": { "argumentTypes": null, "id": 12, "name": "_greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7, "src": "246:9:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 11, "id": 13, "nodeType": "Return", "src": "239:16:0" } ] }, "documentation": null, "id": 15, "implemented": true, "kind": "function", "modifiers": [], "name": "greet", "nodeType": "FunctionDefinition", "parameters": { "id": 8, "nodeType": "ParameterList", "parameters": [], "src": "193:2:0" }, "returnParameters": { "id": 11, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10, "name": "", "nodeType": "VariableDeclaration", "scope": 15, "src": "218:13:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 9, "name": "string", "nodeType": "ElementaryTypeName", "src": "218:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "217:15:0" }, "scope": 28, "src": "179:81:0", "stateMutability": "view", "superFunction": null, "visibility": "external" }, { "body": { "id": 26, "nodeType": "Block", "src": "330:31:0", "statements": [ { "expression": { "argumentTypes": null, "id": 24, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 22, "name": "_greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7, "src": "336:9:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 23, "name": "greeting", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 17, "src": "348:8:0", "typeDescriptions": { "typeIdentifier": "t_string_calldata_ptr", "typeString": "string calldata" } }, "src": "336:20:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 25, "nodeType": "ExpressionStatement", "src": "336:20:0" } ] }, "documentation": null, "id": 27, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 20, "modifierName": { "argumentTypes": null, "id": 19, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "320:9:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "320:9:0" } ], "name": "setGreeting", "nodeType": "FunctionDefinition", "parameters": { "id": 18, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 17, "name": "greeting", "nodeType": "VariableDeclaration", "scope": 27, "src": "285:24:0", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { "typeIdentifier": "t_string_calldata_ptr", "typeString": "string" }, "typeName": { "id": 16, "name": "string", "nodeType": "ElementaryTypeName", "src": "285:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "284:26:0" }, "returnParameters": { "id": 21, "nodeType": "ParameterList", "parameters": [], "src": "330:0:0" }, "scope": 28, "src": "264:97:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "external" } ], "scope": 29, "src": "100:263:0" } ], "src": "0:364:0" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "4": { "events": {}, "links": {}, "address": "0x321374D4CD736Ce5484BFb3aF59C290639b73eA4", "transactionHash": "0x94cc8f0ca97b2f4de8f1d33c47796d2f95b211e6b0470c2be22d228ad023e85d" }, "5": { "events": {}, "links": {}, "address": "0x321374D4CD736Ce5484BFb3aF59C290639b73eA4", "transactionHash": "0x94cc8f0ca97b2f4de8f1d33c47796d2f95b211e6b0470c2be22d228ad023e85d" }, "5777": { "events": { "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event", "signature": "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0" } }, "links": {}, "address": "0x7525b94Cbadd6b68B921c6A5B6BCB7A792186206", "transactionHash": "0x8514075705e5829b43610dca0d52ff8763a5cf4a71e084d5708f7f1133175d04" } }, "schemaVersion": "3.0.11", "updatedAt": "2019-08-20T01:34:57.279Z", "devdoc": { "methods": { "isOwner()": { "details": "Returns true if the caller is the current owner." }, "owner()": { "details": "Returns the address of the current owner." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } } }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-5/greeter/client/src/contracts/Migrations.json ================================================ { "contractName": "Migrations", "abi": [ { "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" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": false, "inputs": [ { "name": "completed", "type": "uint256" } ], "name": "setCompleted", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "new_address", "type": "address" } ], "name": "upgrade", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Migrations.sol\":{\"keccak256\":\"0xfdb731592344e2a2890faf03baec7b4bee7057ffba18ba6dbb6eec8db85f8f4c\",\"urls\":[\"bzzr://ddc8801d0a2a7220c2c9bf3881b4921817e72fdd96827ec8be4428fa009ace07\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820de6ceff753b5f9b856958e00070af50b31571f50fbdb76b21c3665866440ef220029", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820de6ceff753b5f9b856958e00070af50b31571f50fbdb76b21c3665866440ef220029", "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;;;;;;", "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", "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": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Migrations.sol", "ast": { "absolutePath": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 85 ] }, "id": 86, "nodeType": "SourceUnit", "nodes": [ { "id": 30, "literals": [ "solidity", ">=", "0.4", ".21", "<", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:32:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 85, "linearizedBaseContracts": [ 85 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 32, "name": "owner", "nodeType": "VariableDeclaration", "scope": 85, "src": "58:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 31, "name": "address", "nodeType": "ElementaryTypeName", "src": "58:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 34, "name": "last_completed_migration", "nodeType": "VariableDeclaration", "scope": 85, "src": "82:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 33, "name": "uint", "nodeType": "ElementaryTypeName", "src": "82:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 42, "nodeType": "Block", "src": "144:29:1", "statements": [ { "expression": { "argumentTypes": null, "id": 40, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 37, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "150:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 38, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "158:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 39, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "158:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "150:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 41, "nodeType": "ExpressionStatement", "src": "150:18:1" } ] }, "documentation": null, "id": 43, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 35, "nodeType": "ParameterList", "parameters": [], "src": "134:2:1" }, "returnParameters": { "id": 36, "nodeType": "ParameterList", "parameters": [], "src": "144:0:1" }, "scope": 85, "src": "123:50:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 51, "nodeType": "Block", "src": "199:37:1", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 48, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 45, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "209:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 46, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "209:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 47, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "223:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "209:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 50, "nodeType": "IfStatement", "src": "205:26:1", "trueBody": { "id": 49, "nodeType": "PlaceholderStatement", "src": "230:1:1" } } ] }, "documentation": null, "id": 52, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 44, "nodeType": "ParameterList", "parameters": [], "src": "196:2:1" }, "src": "177:59:1", "visibility": "internal" }, { "body": { "id": 63, "nodeType": "Block", "src": "296:47:1", "statements": [ { "expression": { "argumentTypes": null, "id": 61, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 59, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "302:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 60, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 54, "src": "329:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "302:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 62, "nodeType": "ExpressionStatement", "src": "302:36:1" } ] }, "documentation": null, "id": 64, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 57, "modifierName": { "argumentTypes": null, "id": 56, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "285:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "285:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 55, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 54, "name": "completed", "nodeType": "VariableDeclaration", "scope": 64, "src": "262:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 53, "name": "uint", "nodeType": "ElementaryTypeName", "src": "262:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "261:16:1" }, "returnParameters": { "id": 58, "nodeType": "ParameterList", "parameters": [], "src": "296:0:1" }, "scope": 85, "src": "240:103:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 83, "nodeType": "Block", "src": "403:109:1", "statements": [ { "assignments": [ 72 ], "declarations": [ { "constant": false, "id": 72, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 83, "src": "409:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, "id": 71, "name": "Migrations", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 85, "src": "409:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "value": null, "visibility": "internal" } ], "id": 76, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 74, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 66, "src": "442:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 73, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 85, "src": "431:10:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Migrations_$85_$", "typeString": "type(contract Migrations)" } }, "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "431:23:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "409:45:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 80, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "482:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 77, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 72, "src": "460:8:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "id": 79, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", "referencedDeclaration": 64, "src": "460:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, "id": 81, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "460:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 82, "nodeType": "ExpressionStatement", "src": "460:47:1" } ] }, "documentation": null, "id": 84, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 69, "modifierName": { "argumentTypes": null, "id": 68, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "392:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "392:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 67, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 66, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 84, "src": "364:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 65, "name": "address", "nodeType": "ElementaryTypeName", "src": "364:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "363:21:1" }, "returnParameters": { "id": 70, "nodeType": "ParameterList", "parameters": [], "src": "403:0:1" }, "scope": 85, "src": "347:165:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 86, "src": "34:480:1" } ], "src": "0:515:1" }, "legacyAST": { "absolutePath": "/Users/ksolo/Projects/oreilly/hoscdev/chapter-5/greeter/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 85 ] }, "id": 86, "nodeType": "SourceUnit", "nodes": [ { "id": 30, "literals": [ "solidity", ">=", "0.4", ".21", "<", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "0:32:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 85, "linearizedBaseContracts": [ 85 ], "name": "Migrations", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 32, "name": "owner", "nodeType": "VariableDeclaration", "scope": 85, "src": "58:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 31, "name": "address", "nodeType": "ElementaryTypeName", "src": "58:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 34, "name": "last_completed_migration", "nodeType": "VariableDeclaration", "scope": 85, "src": "82:36:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 33, "name": "uint", "nodeType": "ElementaryTypeName", "src": "82:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 42, "nodeType": "Block", "src": "144:29:1", "statements": [ { "expression": { "argumentTypes": null, "id": 40, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 37, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "150:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 38, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "158:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 39, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "158:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "150:18:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 41, "nodeType": "ExpressionStatement", "src": "150:18:1" } ] }, "documentation": null, "id": 43, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 35, "nodeType": "ParameterList", "parameters": [], "src": "134:2:1" }, "returnParameters": { "id": 36, "nodeType": "ParameterList", "parameters": [], "src": "144:0:1" }, "scope": 85, "src": "123:50:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 51, "nodeType": "Block", "src": "199:37:1", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 48, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 45, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "209:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 46, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "209:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 47, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 32, "src": "223:5:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "209:19:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 50, "nodeType": "IfStatement", "src": "205:26:1", "trueBody": { "id": 49, "nodeType": "PlaceholderStatement", "src": "230:1:1" } } ] }, "documentation": null, "id": 52, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 44, "nodeType": "ParameterList", "parameters": [], "src": "196:2:1" }, "src": "177:59:1", "visibility": "internal" }, { "body": { "id": 63, "nodeType": "Block", "src": "296:47:1", "statements": [ { "expression": { "argumentTypes": null, "id": 61, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 59, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "302:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 60, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 54, "src": "329:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "302:36:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 62, "nodeType": "ExpressionStatement", "src": "302:36:1" } ] }, "documentation": null, "id": 64, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 57, "modifierName": { "argumentTypes": null, "id": 56, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "285:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "285:10:1" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 55, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 54, "name": "completed", "nodeType": "VariableDeclaration", "scope": 64, "src": "262:14:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 53, "name": "uint", "nodeType": "ElementaryTypeName", "src": "262:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "261:16:1" }, "returnParameters": { "id": 58, "nodeType": "ParameterList", "parameters": [], "src": "296:0:1" }, "scope": 85, "src": "240:103:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 83, "nodeType": "Block", "src": "403:109:1", "statements": [ { "assignments": [ 72 ], "declarations": [ { "constant": false, "id": 72, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 83, "src": "409:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" }, "typeName": { "contractScope": null, "id": 71, "name": "Migrations", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 85, "src": "409:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "value": null, "visibility": "internal" } ], "id": 76, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 74, "name": "new_address", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 66, "src": "442:11:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 73, "name": "Migrations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 85, "src": "431:10:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Migrations_$85_$", "typeString": "type(contract Migrations)" } }, "id": 75, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "431:23:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "409:45:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 80, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 34, "src": "482:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 77, "name": "upgraded", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 72, "src": "460:8:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$85", "typeString": "contract Migrations" } }, "id": 79, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "setCompleted", "nodeType": "MemberAccess", "referencedDeclaration": 64, "src": "460:21:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256) external" } }, "id": 81, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "460:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 82, "nodeType": "ExpressionStatement", "src": "460:47:1" } ] }, "documentation": null, "id": 84, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 69, "modifierName": { "argumentTypes": null, "id": 68, "name": "restricted", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 52, "src": "392:10:1", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "392:10:1" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 67, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 66, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 84, "src": "364:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 65, "name": "address", "nodeType": "ElementaryTypeName", "src": "364:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "363:21:1" }, "returnParameters": { "id": 70, "nodeType": "ParameterList", "parameters": [], "src": "403:0:1" }, "scope": 85, "src": "347:165:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 86, "src": "34:480:1" } ], "src": "0:515:1" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "4": { "events": {}, "links": {}, "address": "0x74c7382e11311530757beDb953D7F302cfAef417", "transactionHash": "0x6e57a078b7d9fdf6a1bc7c777951271220ae3b9f03a62c92991dc0923610b157" }, "5": { "events": {}, "links": {}, "address": "0x74c7382e11311530757beDb953D7F302cfAef417", "transactionHash": "0x6e57a078b7d9fdf6a1bc7c777951271220ae3b9f03a62c92991dc0923610b157" }, "5777": { "events": {}, "links": {}, "address": "0xA90Fb5Ad2D6845B073626971267eFa6a713892a7", "transactionHash": "0x58b3f0669a316f8818c9ec9245c9cb45c4bf12e1f992c334f2275faaf5e41153" } }, "schemaVersion": "3.0.11", "updatedAt": "2019-08-20T01:34:57.281Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-5/greeter/client/src/contracts/Ownable.json ================================================ { "contractName": "Ownable", "abi": [ { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"details\":\"Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. * This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be aplied to your functions to restrict their use to the owner.\",\"methods\":{\"constructor\":{\"details\":\"Initializes the contract setting the deployer as the initial owner.\"},\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"openzeppelin-solidity/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity ^0.5.0;\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be aplied to your functions to restrict their use to\n * the owner.\n */\ncontract Ownable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n _owner = msg.sender;\n emit OwnershipTransferred(address(0), _owner);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(isOwner(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Returns true if the caller is the current owner.\n */\n function isOwner() public view returns (bool) {\n return msg.sender == _owner;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * > Note: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n */\n function _transferOwnership(address newOwner) internal {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n", "sourcePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "ast": { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "exportedSymbols": { "Ownable": [ 196 ] }, "id": 197, "nodeType": "SourceUnit", "nodes": [ { "id": 87, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:2" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@dev Contract module which provides a basic access control mechanism, where\nthere is an account (an owner) that can be granted exclusive access to\nspecific functions.\n * This module is used through inheritance. It will make available the modifier\n`onlyOwner`, which can be aplied to your functions to restrict their use to\nthe owner.", "fullyImplemented": true, "id": 196, "linearizedBaseContracts": [ 196 ], "name": "Ownable", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 89, "name": "_owner", "nodeType": "VariableDeclaration", "scope": 196, "src": "408:22:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 88, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 95, "name": "OwnershipTransferred", "nodeType": "EventDefinition", "parameters": { "id": 94, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 91, "indexed": true, "name": "previousOwner", "nodeType": "VariableDeclaration", "scope": 95, "src": "464:29:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 90, "name": "address", "nodeType": "ElementaryTypeName", "src": "464:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 93, "indexed": true, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 95, "src": "495:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 92, "name": "address", "nodeType": "ElementaryTypeName", "src": "495:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "463:57:2" }, "src": "437:84:2" }, { "body": { "id": 110, "nodeType": "Block", "src": "647:91:2", "statements": [ { "expression": { "argumentTypes": null, "id": 101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 98, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "657:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 99, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "666:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 100, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "666:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "657:19:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 102, "nodeType": "ExpressionStatement", "src": "657:19:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 105, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "720:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 104, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "712:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 106, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "712:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 107, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "724:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 103, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "691:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 108, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:40:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 109, "nodeType": "EmitStatement", "src": "686:45:2" } ] }, "documentation": "@dev Initializes the contract setting the deployer as the initial owner.", "id": 111, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 96, "nodeType": "ParameterList", "parameters": [], "src": "635:2:2" }, "returnParameters": { "id": 97, "nodeType": "ParameterList", "parameters": [], "src": "647:0:2" }, "scope": 196, "src": "623:115:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 118, "nodeType": "Block", "src": "861:30:2", "statements": [ { "expression": { "argumentTypes": null, "id": 116, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "878:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 115, "id": 117, "nodeType": "Return", "src": "871:13:2" } ] }, "documentation": "@dev Returns the address of the current owner.", "id": 119, "implemented": true, "kind": "function", "modifiers": [], "name": "owner", "nodeType": "FunctionDefinition", "parameters": { "id": 112, "nodeType": "ParameterList", "parameters": [], "src": "828:2:2" }, "returnParameters": { "id": 115, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 114, "name": "", "nodeType": "VariableDeclaration", "scope": 119, "src": "852:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 113, "name": "address", "nodeType": "ElementaryTypeName", "src": "852:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "851:9:2" }, "scope": 196, "src": "814:77:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 128, "nodeType": "Block", "src": "1000:82:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 122, "name": "isOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 140, "src": "1018:7:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, "id": 123, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:9:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572", "id": 124, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1029:34:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" }, "value": "Ownable: caller is not the owner" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" } ], "id": 121, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 214, 215 ], "referencedDeclaration": 215, "src": "1010:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 125, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1010:54:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 126, "nodeType": "ExpressionStatement", "src": "1010:54:2" }, { "id": 127, "nodeType": "PlaceholderStatement", "src": "1074:1:2" } ] }, "documentation": "@dev Throws if called by any account other than the owner.", "id": 129, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 120, "nodeType": "ParameterList", "parameters": [], "src": "997:2:2" }, "src": "979:103:2", "visibility": "internal" }, { "body": { "id": 139, "nodeType": "Block", "src": "1211:44:2", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 137, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 134, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "1228:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 135, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1228:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 136, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1242:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1228:20:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 133, "id": 138, "nodeType": "Return", "src": "1221:27:2" } ] }, "documentation": "@dev Returns true if the caller is the current owner.", "id": 140, "implemented": true, "kind": "function", "modifiers": [], "name": "isOwner", "nodeType": "FunctionDefinition", "parameters": { "id": 130, "nodeType": "ParameterList", "parameters": [], "src": "1181:2:2" }, "returnParameters": { "id": 133, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 132, "name": "", "nodeType": "VariableDeclaration", "scope": 140, "src": "1205:4:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 131, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1205:4:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1204:6:2" }, "scope": 196, "src": "1165:90:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 158, "nodeType": "Block", "src": "1645:91:2", "statements": [ { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 146, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1681:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 148, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1697:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 147, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1689:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 149, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1689:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 145, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "1660:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 150, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1660:40:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 151, "nodeType": "EmitStatement", "src": "1655:45:2" }, { "expression": { "argumentTypes": null, "id": 156, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 152, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1710:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 154, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1727:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 153, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1719:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 155, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1719:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1710:19:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 157, "nodeType": "ExpressionStatement", "src": "1710:19:2" } ] }, "documentation": "@dev Leaves the contract without owner. It will not be possible to call\n`onlyOwner` functions anymore. Can only be called by the current owner.\n * > Note: Renouncing ownership will leave the contract without an owner,\nthereby removing any functionality that is only available to the owner.", "id": 159, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 143, "modifierName": { "argumentTypes": null, "id": 142, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "1635:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1635:9:2" } ], "name": "renounceOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 141, "nodeType": "ParameterList", "parameters": [], "src": "1625:2:2" }, "returnParameters": { "id": 144, "nodeType": "ParameterList", "parameters": [], "src": "1645:0:2" }, "scope": 196, "src": "1599:137:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 170, "nodeType": "Block", "src": "1947:45:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 167, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 161, "src": "1976:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 166, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 195, "src": "1957:18:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 168, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1957:28:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 169, "nodeType": "ExpressionStatement", "src": "1957:28:2" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).\nCan only be called by the current owner.", "id": 171, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 164, "modifierName": { "argumentTypes": null, "id": 163, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "1937:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1937:9:2" } ], "name": "transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 162, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 161, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 171, "src": "1912:16:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 160, "name": "address", "nodeType": "ElementaryTypeName", "src": "1912:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1911:18:2" }, "returnParameters": { "id": 165, "nodeType": "ParameterList", "parameters": [], "src": "1947:0:2" }, "scope": 196, "src": "1885:107:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 194, "nodeType": "Block", "src": "2148:170:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 177, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2166:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 179, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2186:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 178, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2178:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 180, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2178:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "2166:22:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "id": 182, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2190:40:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" }, "value": "Ownable: new owner is the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" } ], "id": 176, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 214, 215 ], "referencedDeclaration": 215, "src": "2158:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2158:73:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 184, "nodeType": "ExpressionStatement", "src": "2158:73:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 186, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "2267:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 187, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2275:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 185, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "2246:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2246:38:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 189, "nodeType": "EmitStatement", "src": "2241:43:2" }, { "expression": { "argumentTypes": null, "id": 192, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 190, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "2294:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 191, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2303:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2294:17:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 193, "nodeType": "ExpressionStatement", "src": "2294:17:2" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).", "id": 195, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 174, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 173, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 195, "src": "2121:16:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 172, "name": "address", "nodeType": "ElementaryTypeName", "src": "2121:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2120:18:2" }, "returnParameters": { "id": 175, "nodeType": "ParameterList", "parameters": [], "src": "2148:0:2" }, "scope": 196, "src": "2093:225:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 197, "src": "385:1935:2" } ], "src": "0:2321:2" }, "legacyAST": { "absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol", "exportedSymbols": { "Ownable": [ 196 ] }, "id": 197, "nodeType": "SourceUnit", "nodes": [ { "id": 87, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:2" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@dev Contract module which provides a basic access control mechanism, where\nthere is an account (an owner) that can be granted exclusive access to\nspecific functions.\n * This module is used through inheritance. It will make available the modifier\n`onlyOwner`, which can be aplied to your functions to restrict their use to\nthe owner.", "fullyImplemented": true, "id": 196, "linearizedBaseContracts": [ 196 ], "name": "Ownable", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 89, "name": "_owner", "nodeType": "VariableDeclaration", "scope": 196, "src": "408:22:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 88, "name": "address", "nodeType": "ElementaryTypeName", "src": "408:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 95, "name": "OwnershipTransferred", "nodeType": "EventDefinition", "parameters": { "id": 94, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 91, "indexed": true, "name": "previousOwner", "nodeType": "VariableDeclaration", "scope": 95, "src": "464:29:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 90, "name": "address", "nodeType": "ElementaryTypeName", "src": "464:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 93, "indexed": true, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 95, "src": "495:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 92, "name": "address", "nodeType": "ElementaryTypeName", "src": "495:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "463:57:2" }, "src": "437:84:2" }, { "body": { "id": 110, "nodeType": "Block", "src": "647:91:2", "statements": [ { "expression": { "argumentTypes": null, "id": 101, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 98, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "657:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 99, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "666:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 100, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "666:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "657:19:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 102, "nodeType": "ExpressionStatement", "src": "657:19:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 105, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "720:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 104, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "712:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 106, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "712:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 107, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "724:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 103, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "691:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 108, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "691:40:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 109, "nodeType": "EmitStatement", "src": "686:45:2" } ] }, "documentation": "@dev Initializes the contract setting the deployer as the initial owner.", "id": 111, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 96, "nodeType": "ParameterList", "parameters": [], "src": "635:2:2" }, "returnParameters": { "id": 97, "nodeType": "ParameterList", "parameters": [], "src": "647:0:2" }, "scope": 196, "src": "623:115:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 118, "nodeType": "Block", "src": "861:30:2", "statements": [ { "expression": { "argumentTypes": null, "id": 116, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "878:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 115, "id": 117, "nodeType": "Return", "src": "871:13:2" } ] }, "documentation": "@dev Returns the address of the current owner.", "id": 119, "implemented": true, "kind": "function", "modifiers": [], "name": "owner", "nodeType": "FunctionDefinition", "parameters": { "id": 112, "nodeType": "ParameterList", "parameters": [], "src": "828:2:2" }, "returnParameters": { "id": 115, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 114, "name": "", "nodeType": "VariableDeclaration", "scope": 119, "src": "852:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 113, "name": "address", "nodeType": "ElementaryTypeName", "src": "852:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "851:9:2" }, "scope": 196, "src": "814:77:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 128, "nodeType": "Block", "src": "1000:82:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 122, "name": "isOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 140, "src": "1018:7:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", "typeString": "function () view returns (bool)" } }, "id": 123, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1018:9:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572", "id": 124, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1029:34:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" }, "value": "Ownable: caller is not the owner" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe", "typeString": "literal_string \"Ownable: caller is not the owner\"" } ], "id": 121, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 214, 215 ], "referencedDeclaration": 215, "src": "1010:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 125, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1010:54:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 126, "nodeType": "ExpressionStatement", "src": "1010:54:2" }, { "id": 127, "nodeType": "PlaceholderStatement", "src": "1074:1:2" } ] }, "documentation": "@dev Throws if called by any account other than the owner.", "id": 129, "name": "onlyOwner", "nodeType": "ModifierDefinition", "parameters": { "id": 120, "nodeType": "ParameterList", "parameters": [], "src": "997:2:2" }, "src": "979:103:2", "visibility": "internal" }, { "body": { "id": 139, "nodeType": "Block", "src": "1211:44:2", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 137, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 134, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 211, "src": "1228:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 135, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1228:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 136, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1242:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1228:20:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 133, "id": 138, "nodeType": "Return", "src": "1221:27:2" } ] }, "documentation": "@dev Returns true if the caller is the current owner.", "id": 140, "implemented": true, "kind": "function", "modifiers": [], "name": "isOwner", "nodeType": "FunctionDefinition", "parameters": { "id": 130, "nodeType": "ParameterList", "parameters": [], "src": "1181:2:2" }, "returnParameters": { "id": 133, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 132, "name": "", "nodeType": "VariableDeclaration", "scope": 140, "src": "1205:4:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 131, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1205:4:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1204:6:2" }, "scope": 196, "src": "1165:90:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 158, "nodeType": "Block", "src": "1645:91:2", "statements": [ { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 146, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1681:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 148, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1697:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 147, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1689:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 149, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1689:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 145, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "1660:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 150, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1660:40:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 151, "nodeType": "EmitStatement", "src": "1655:45:2" }, { "expression": { "argumentTypes": null, "id": 156, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 152, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "1710:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 154, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1727:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 153, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1719:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 155, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1719:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1710:19:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 157, "nodeType": "ExpressionStatement", "src": "1710:19:2" } ] }, "documentation": "@dev Leaves the contract without owner. It will not be possible to call\n`onlyOwner` functions anymore. Can only be called by the current owner.\n * > Note: Renouncing ownership will leave the contract without an owner,\nthereby removing any functionality that is only available to the owner.", "id": 159, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 143, "modifierName": { "argumentTypes": null, "id": 142, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "1635:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1635:9:2" } ], "name": "renounceOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 141, "nodeType": "ParameterList", "parameters": [], "src": "1625:2:2" }, "returnParameters": { "id": 144, "nodeType": "ParameterList", "parameters": [], "src": "1645:0:2" }, "scope": 196, "src": "1599:137:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 170, "nodeType": "Block", "src": "1947:45:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 167, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 161, "src": "1976:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 166, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 195, "src": "1957:18:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 168, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1957:28:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 169, "nodeType": "ExpressionStatement", "src": "1957:28:2" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).\nCan only be called by the current owner.", "id": 171, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 164, "modifierName": { "argumentTypes": null, "id": 163, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 129, "src": "1937:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1937:9:2" } ], "name": "transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 162, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 161, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 171, "src": "1912:16:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 160, "name": "address", "nodeType": "ElementaryTypeName", "src": "1912:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1911:18:2" }, "returnParameters": { "id": 165, "nodeType": "ParameterList", "parameters": [], "src": "1947:0:2" }, "scope": 196, "src": "1885:107:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 194, "nodeType": "Block", "src": "2148:170:2", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 177, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2166:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 179, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2186:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 178, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2178:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 180, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2178:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "2166:22:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "id": 182, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2190:40:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" }, "value": "Ownable: new owner is the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe", "typeString": "literal_string \"Ownable: new owner is the zero address\"" } ], "id": 176, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 214, 215 ], "referencedDeclaration": 215, "src": "2158:7:2", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 183, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2158:73:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 184, "nodeType": "ExpressionStatement", "src": "2158:73:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 186, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "2267:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 187, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2275:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 185, "name": "OwnershipTransferred", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 95, "src": "2246:20:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", "typeString": "function (address,address)" } }, "id": 188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2246:38:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 189, "nodeType": "EmitStatement", "src": "2241:43:2" }, { "expression": { "argumentTypes": null, "id": 192, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 190, "name": "_owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 89, "src": "2294:6:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 191, "name": "newOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 173, "src": "2303:8:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "2294:17:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 193, "nodeType": "ExpressionStatement", "src": "2294:17:2" } ] }, "documentation": "@dev Transfers ownership of the contract to a new account (`newOwner`).", "id": 195, "implemented": true, "kind": "function", "modifiers": [], "name": "_transferOwnership", "nodeType": "FunctionDefinition", "parameters": { "id": 174, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 173, "name": "newOwner", "nodeType": "VariableDeclaration", "scope": 195, "src": "2121:16:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 172, "name": "address", "nodeType": "ElementaryTypeName", "src": "2121:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "2120:18:2" }, "returnParameters": { "id": 175, "nodeType": "ParameterList", "parameters": [], "src": "2148:0:2" }, "scope": 196, "src": "2093:225:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 197, "src": "385:1935:2" } ], "src": "0:2321:2" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.11", "updatedAt": "2019-08-18T20:45:06.084Z", "devdoc": { "details": "Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. * This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be aplied to your functions to restrict their use to the owner.", "methods": { "constructor": { "details": "Initializes the contract setting the deployer as the initial owner." }, "isOwner()": { "details": "Returns true if the caller is the current owner." }, "owner()": { "details": "Returns the address of the current owner." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } } }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-5/greeter/client/src/index.css ================================================ body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: chapter-5/greeter/client/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render(, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: chapter-5/greeter/client/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read http://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit http://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: chapter-5/greeter/client/src/utils/getWeb3.js ================================================ import Web3 from "web3"; const getWeb3 = () => new Promise((resolve, reject) => { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener("load", async () => { // Modern dapp browsers... if (window.ethereum) { const web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed resolve(web3); } catch (error) { reject(error); } } // Legacy dapp browsers... else if (window.web3) { // Use Mist/MetaMask's provider. const web3 = window.web3; console.log("Injected web3 detected."); resolve(web3); } // Fallback to localhost; use dev console port by default... else { const provider = new Web3.providers.HttpProvider( "http://127.0.0.1:9545" ); const web3 = new Web3(provider); console.log("No web3 instance injected, using Local web3."); resolve(web3); } }); }); export default getWeb3; ================================================ FILE: chapter-5/greeter/contracts/Greeter.sol ================================================ pragma solidity >= 0.4.0 < 0.7.0; import "openzeppelin-solidity/contracts/access/Ownable.sol"; contract Greeter is Ownable { string private _greeting = "Hello, World!"; function greet() external view returns(string memory) { return _greeting; } function setGreeting(string calldata greeting) external onlyOwner { _greeting = greeting; } } ================================================ FILE: chapter-5/greeter/contracts/Migrations.sol ================================================ pragma solidity >=0.4.21 <0.7.0; contract Migrations { address public owner; uint public last_completed_migration; constructor() public { owner = msg.sender; } modifier restricted() { if (msg.sender == owner) _; } function setCompleted(uint completed) public restricted { last_completed_migration = completed; } function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: chapter-5/greeter/migrations/1_initial_migration.js ================================================ const Migrations = artifacts.require("Migrations"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: chapter-5/greeter/migrations/2_deploy_greeter.js ================================================ const GreeterContract = artifacts.require("Greeter"); module.exports = function(deployer) { deployer.deploy(GreeterContract); } ================================================ FILE: chapter-5/greeter/package.json ================================================ { "dependencies": { "openzeppelin-solidity": "^3.4.0" }, "devDependencies": { "truffle-hdwallet-provider": "^1.0.17" } } ================================================ FILE: chapter-5/greeter/test/greeter_test.js ================================================ const GreeterContract = artifacts.require("Greeter"); contract("Greeter", (accounts) => { it("has been deployed successfully", async () => { const greeter = await GreeterContract.deployed(); assert(greeter, "contract has been deployed"); }); describe("greet()", () => { it("returns 'Hello, World!'", async () => { const greeter = await GreeterContract.deployed(); const expected = "Hello, World!"; const actual = await greeter.greet(); assert.equal(actual, expected, "greeted with 'Hello, World!'"); }) }); describe("owner()", () => { it("returns the address of the owner", async () => { const greeter = await GreeterContract.deployed(); const owner = await greeter.owner(); assert(owner, "the current owner"); }); it("matches the address that originally deployed the contract", async () => { const greeter = await GreeterContract.deployed(); const owner = await greeter.owner(); const expected = accounts[0]; assert.equal(owner, expected, "matches address used to deploy contract"); }); }); }); contract("Greeter: update greeting", (accounts) => { describe("setGreeting(string)", () => { describe("when message is sent by the owner", () => { it("sets greeting to passed in string", async () => { const greeter = await GreeterContract.deployed() const expected = "The owner changed the message"; await greeter.setGreeting(expected); const actual = await greeter.greet(); assert.equal(actual, expected, "greeting updated"); }); }); describe("when message is sent by another account", () => { it("does not set the greeting", async () => { const greeter = await GreeterContract.deployed() const expected = await greeter.greet(); try { await greeter.setGreeting("Not the owner", { from: accounts[1] }); } catch(err) { const errorMessage = "Ownable: caller is not the owner" assert.equal(err.reason, errorMessage, "greeting should not update"); return; } assert(false, "greeting should not update"); }); }); }); }); ================================================ FILE: chapter-5/greeter/truffle-config.js ================================================ const HDWallterProvider = require("truffle-hdwallet-provider"); /** * Use this file to configure your truffle project. It's seeded with some * common settings for different networks and features like migrations, * compilation and testing. Uncomment the ones you need or modify * them to suit your project as necessary. * * More information about configuration can be found at: * * truffleframework.com/docs/advanced/configuration * * To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider) * to sign your transactions before they're sent to a remote public node. Infura accounts * are available for free at: infura.io/register. * * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate * public/private key pairs. If you're publishing your code to GitHub make sure you load this * phrase from a file you've .gitignored so it doesn't accidentally become public. * */ // const HDWalletProvider = require('truffle-hdwallet-provider'); // const infuraKey = "fj4jll3k....."; // // const fs = require('fs'); // const mnemonic = fs.readFileSync(".secret").toString().trim(); module.exports = { contracts_build_directory: "./client/src/contracts", /** * Networks define how you connect to your ethereum client and let you set the * defaults web3 uses to send transactions. If you don't specify one truffle * will spin up a development blockchain for you on port 9545 when you * run `develop` or `test`. You can ask a truffle command to use a specific * network from the command line, e.g * * $ truffle test --network */ networks: { // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set the `host`, `port` and `network_id` // options below to some value. // development: { host: "127.0.0.1", // Localhost (default: none) port: 7545, // Standard Ethereum port (default: none) network_id: "*", // Any network (default: none) }, goerli: { provider: () => { const mnemonic = process.env["MNEMONIC"] return new HDWallterProvider(mnemonic, "http://127.0.0.1:8545"); }, network_id: "*", }, rinkeby: { provider: () => { const mnemonic = process.env["MNEMONIC"] const project_id = process.env["INFURA_PROJECT_ID"] return new HDWallterProvider( mnemonic, `https://rinkeby.infura.io/v3/${project_id}` ); }, network_id: "*" } // Another network with more advanced options... // advanced: { // port: 8777, // Custom port // network_id: 1342, // Custom network // gas: 8500000, // Gas sent with each transaction (default: ~6700000) // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) // from:
, // Account to send txs from (default: accounts[0]) // websockets: true // Enable EventEmitter interface for web3 (default: false) // }, // Useful for deploying to a public network. // NB: It's important to wrap the provider as a function. // ropsten: { // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), // network_id: 3, // Ropsten's id // gas: 5500000, // Ropsten has a lower block limit than mainnet // confirmations: 2, // # of confs to wait between deployments. (default: 0) // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) // }, // Useful for private networks // private: { // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), // network_id: 2111, // This network is yours, in the cloud. // production: true // Treats this network as if it was a public net. (default: false) // } }, // Set default mocha options here, use special reporters etc. mocha: { // timeout: 100000 }, // Configure your compilers compilers: { solc: { version: "0.6", // Fetch exact version from solc-bin (default: truffle's version) // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) // settings: { // See the solidity docs for advice about optimization and evmVersion // optimizer: { // enabled: false, // runs: 200 // }, // evmVersion: "byzantium" // } } } } ================================================ FILE: chapter-6/fundraiser/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2018 Truffle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: chapter-6/fundraiser/client/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: chapter-6/fundraiser/client/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: chapter-6/fundraiser/client/package.json ================================================ { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.6.3", "react-dom": "^16.6.3", "react-scripts": "2.1.1", "web3": "^1.0.0-beta.37" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } ================================================ FILE: chapter-6/fundraiser/client/public/index.html ================================================ React App
================================================ FILE: chapter-6/fundraiser/client/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: chapter-6/fundraiser/client/src/App.css ================================================ .App { text-align: center; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: chapter-6/fundraiser/client/src/App.js ================================================ import React, { Component } from "react"; import SimpleStorageContract from "./contracts/SimpleStorage.json"; import getWeb3 from "./utils/getWeb3"; import "./App.css"; class App extends Component { state = { storageValue: 0, web3: null, accounts: null, contract: null }; componentDidMount = async () => { try { // Get network provider and web3 instance. const web3 = await getWeb3(); // Use web3 to get the user's accounts. const accounts = await web3.eth.getAccounts(); // Get the contract instance. const networkId = await web3.eth.net.getId(); const deployedNetwork = SimpleStorageContract.networks[networkId]; const instance = new web3.eth.Contract( SimpleStorageContract.abi, deployedNetwork && deployedNetwork.address, ); // Set web3, accounts, and contract to the state, and then proceed with an // example of interacting with the contract's methods. this.setState({ web3, accounts, contract: instance }, this.runExample); } catch (error) { // Catch any errors for any of the above operations. alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } }; runExample = async () => { const { accounts, contract } = this.state; // Stores a given value, 5 by default. await contract.methods.set(5).send({ from: accounts[0] }); // Get the value from the contract to prove it worked. const response = await contract.methods.get().call(); // Update state with the result. this.setState({ storageValue: response }); }; render() { if (!this.state.web3) { return
Loading Web3, accounts, and contract...
; } return (

Good to Go!

Your Truffle Box is installed and ready.

Smart Contract Example

If your contracts compiled and migrated successfully, below will show a stored value of 5 (by default).

Try changing the value stored on line 40 of App.js.

The stored value is: {this.state.storageValue}
); } } export default App; ================================================ FILE: chapter-6/fundraiser/client/src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); ================================================ FILE: chapter-6/fundraiser/client/src/index.css ================================================ body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: chapter-6/fundraiser/client/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render(, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: chapter-6/fundraiser/client/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read http://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit http://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: chapter-6/fundraiser/client/src/utils/getWeb3.js ================================================ import Web3 from "web3"; const getWeb3 = () => new Promise((resolve, reject) => { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener("load", async () => { // Modern dapp browsers... if (window.ethereum) { const web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed resolve(web3); } catch (error) { reject(error); } } // Legacy dapp browsers... else if (window.web3) { // Use Mist/MetaMask's provider. const web3 = window.web3; console.log("Injected web3 detected."); resolve(web3); } // Fallback to localhost; use dev console port by default... else { const provider = new Web3.providers.HttpProvider( "http://127.0.0.1:8545" ); const web3 = new Web3(provider); console.log("No web3 instance injected, using Local web3."); resolve(web3); } }); }); export default getWeb3; ================================================ FILE: chapter-6/fundraiser/contracts/Fundraiser.sol ================================================ pragma solidity >0.4.23 <0.7.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract Fundraiser is Ownable { using SafeMath for uint256; struct Donation { uint256 value; uint256 date; } mapping(address => Donation[]) private _donations; event DonationReceived(address indexed donor, uint256 value); event Withdraw(uint256 amount); string public name; string public url; string public imageURL; string public description; address payable public beneficiary; address private _owner; uint256 public totalDonations; uint256 public donationsCount; constructor( string memory _name, string memory _url, string memory _imageURL, string memory _description, address payable _beneficiary, address _custodian ) public { name = _name; url = _url; imageURL = _imageURL; description = _description; beneficiary = _beneficiary; _owner = _custodian; } function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } function myDonationsCount() public view returns(uint256) { return _donations[msg.sender].length; } function donate() public payable { Donation memory donation = Donation({ value: msg.value, date: block.timestamp }); _donations[msg.sender].push(donation); totalDonations = totalDonations.add(msg.value); donationsCount++; emit DonationReceived(msg.sender, msg.value); } function myDonations() public view returns( uint256[] memory values, uint256[] memory dates ) { uint256 count = myDonationsCount(); values = new uint256[](count); dates = new uint256[](count); for (uint256 i = 0; i < count; i++) { Donation storage donation = _donations[msg.sender][i]; values[i] = donation.value; dates[i] = donation.date; } return (values, dates); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; beneficiary.transfer(balance); emit Withdraw(balance); } function () external payable { totalDonations = totalDonations.add(msg.value); donationsCount++; } } ================================================ FILE: chapter-6/fundraiser/contracts/Migrations.sol ================================================ pragma solidity ^0.5.0; contract Migrations { address public owner; uint public last_completed_migration; modifier restricted() { if (msg.sender == owner) _; } constructor() public { owner = msg.sender; } function setCompleted(uint completed) public restricted { last_completed_migration = completed; } function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: chapter-6/fundraiser/migrations/1_initial_migration.js ================================================ var Migrations = artifacts.require("./Migrations.sol"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: chapter-6/fundraiser/test/fundraiser_test.js ================================================ const FundraiserContract = artifacts.require("Fundraiser"); contract("Fundraiser", accounts => { let fundraiser; const name = "Beneficiary Name"; const url = "beneficiaryname.org"; const imageURL = "https://placekitten.com/600/350"; const description = "Beneficiary description"; const beneficiary = accounts[1]; const owner = accounts[0]; beforeEach(async () => { fundraiser = await FundraiserContract.new( name, url, imageURL, description, beneficiary, owner ) }); describe("initialization", () => { it("gets the beneficiary name", async () => { const actual = await fundraiser.name(); assert.equal(actual, name, "names should match"); }); it("gets the beneficiary url", async () => { const actual = await fundraiser.url(); assert.equal(actual, url, "url should match"); }); it("gets the beneficiary image url", async () => { const actual = await fundraiser.imageURL(); assert.equal(actual, imageURL, "imageURL should match"); }); it("gets the beneficiary description", async () => { const actual = await fundraiser.description(); assert.equal(actual, description, "description should match"); }); it("gets the beneficiary", async () => { const actual = await fundraiser.beneficiary(); assert.equal(actual, beneficiary, "beneficiary addresses should match"); }); it("gets the owner", async () => { const actual = await fundraiser.owner(); assert.equal(actual, owner, "bios should match"); }); }); describe("setBeneficiary", () => { const newBeneficiary = accounts[2]; it("updated beneficiary when called by owner account", async () => { await fundraiser.setBeneficiary(newBeneficiary, {from: owner}); const actualBeneficiary = await fundraiser.beneficiary(); assert.equal(actualBeneficiary, newBeneficiary, "beneficiaries should match"); }); it("throws and error when called from a non-owner account", async () => { try { await fundraiser.setBeneficiary(newBeneficiary, {from: accounts[3]}); assert.fail("withdraw was not restricted to owners") } catch(err) { const expectedError = "Ownable: caller is not the owner" const actualError = err.reason; assert.equal(actualError, expectedError, "should not be permitted") } }); }); describe("making donations", () => { const value = web3.utils.toWei('0.0289'); const donor = accounts[2]; it("increases myDonationsCount", async () => { const currentDonationsCount = await fundraiser.myDonationsCount( {from: donor} ); await fundraiser.donate({from: donor, value}); const newDonationsCount = await fundraiser.myDonationsCount({from: donor}); assert.equal( 1, newDonationsCount - currentDonationsCount, "myDonationsCount should increment by 1"); }); it("includes donation in myDonations", async () => { await fundraiser.donate({from: donor, value}); const {values, dates} = await fundraiser.myDonations( {from: donor} ); assert.equal( value, values[0], "values should match" ); assert(dates[0], "date should be present"); }); it("increases the totalDonations amount", async () => { const currentTotalDonations = await fundraiser.totalDonations(); await fundraiser.donate({from: donor, value}); const newTotalDonations = await fundraiser.totalDonations(); const diff = newTotalDonations - currentTotalDonations; assert.equal( diff, value, "difference should match the donation value" ) }); it("increases donationsCount", async () => { const currentDonationsCount = await fundraiser.donationsCount(); await fundraiser.donate({from: donor, value}); const newDonationsCount = await fundraiser.donationsCount(); assert.equal( 1, newDonationsCount - currentDonationsCount, "donationsCount should increment by 1"); }); it("emits the DonationReceived event", async () => { const tx = await fundraiser.donate({from: donor, value}); const expectedEvent = "DonationReceived"; const actualEvent = tx.logs[0].event; assert.equal(actualEvent, expectedEvent, "events should match"); }); }); describe("withdrawing funds", () => { beforeEach(async () => { await fundraiser.donate( {from: accounts[2], value: web3.utils.toWei('0.1')} ); }); describe("access controls", () => { it("throws and error when called from a non-owner account", async () => { try { await fundraiser.withdraw({from: accounts[3]}); assert.fail("withdraw was not restricted to owners") } catch(err) { const expectedError = "Ownable: caller is not the owner" const actualError = err.reason; assert.equal(actualError, expectedError, "should not be permitted") } }); it("permits the owner to call the function", async () => { try { await fundraiser.withdraw({from: owner}); assert(true, "no errors were thrown"); } catch(err) { assert.fail("should not have thrown an error"); } }); }); it("transfers balance to beneficiary", async () => { const currentContractBalance = await web3.eth.getBalance(fundraiser.address); const currentBeneficiaryBalance = await web3.eth.getBalance(beneficiary); await fundraiser.withdraw({from: owner}); const newContractBalance = await web3.eth.getBalance(fundraiser.address); const newBeneficiaryBalance = await web3.eth.getBalance(beneficiary); const beneficiaryDifference = newBeneficiaryBalance - currentBeneficiaryBalance; assert.equal( newContractBalance, 0, "contract should have a 0 balance" ); assert.equal( beneficiaryDifference, currentContractBalance, "beneficiary should receive all the funds" ); }); it("emits Withdraw event", async () => { const tx = await fundraiser.withdraw({from: owner}); const expectedEvent = "Withdraw"; const actualEvent = tx.logs[0].event; assert.equal( actualEvent, expectedEvent, "events should match" ); }); }); describe("fallback function", () => { const value = web3.utils.toWei('0.0289'); it("increases the totalDonations amount", async () => { const currentTotalDonations = await fundraiser.totalDonations(); await web3.eth.sendTransaction( {to: fundraiser.address, from: accounts[9], value} ); const newTotalDonations = await fundraiser.totalDonations(); const diff = newTotalDonations - currentTotalDonations; assert.equal( diff, value, "difference should match the donation value" ) }); it("increases donationsCount", async () => { const currentDonationsCount = await fundraiser.donationsCount(); await web3.eth.sendTransaction( {to: fundraiser.address, from: accounts[9], value} ); const newDonationsCount = await fundraiser.donationsCount(); assert.equal( 1, newDonationsCount - currentDonationsCount, "donationsCount should increment by 1"); }); }); });; ================================================ FILE: chapter-6/fundraiser/truffle-config.js ================================================ const path = require("path"); module.exports = { // See // to customize your Truffle configuration! contracts_build_directory: path.join(__dirname, "client/src/contracts"), networks: { develop: { port: 8545 } } }; ================================================ FILE: chapter-7/fundraiser/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2018 Truffle Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: chapter-7/fundraiser/client/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: chapter-7/fundraiser/client/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: chapter-7/fundraiser/client/package.json ================================================ { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.6.3", "react-dom": "^16.6.3", "react-scripts": "2.1.1", "web3": "^1.0.0-beta.37" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } ================================================ FILE: chapter-7/fundraiser/client/public/index.html ================================================ React App
================================================ FILE: chapter-7/fundraiser/client/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: chapter-7/fundraiser/client/src/App.css ================================================ .App { text-align: center; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: chapter-7/fundraiser/client/src/App.js ================================================ import React, { Component } from "react"; import SimpleStorageContract from "./contracts/SimpleStorage.json"; import getWeb3 from "./utils/getWeb3"; import "./App.css"; class App extends Component { state = { storageValue: 0, web3: null, accounts: null, contract: null }; componentDidMount = async () => { try { // Get network provider and web3 instance. const web3 = await getWeb3(); // Use web3 to get the user's accounts. const accounts = await web3.eth.getAccounts(); // Get the contract instance. const networkId = await web3.eth.net.getId(); const deployedNetwork = SimpleStorageContract.networks[networkId]; const instance = new web3.eth.Contract( SimpleStorageContract.abi, deployedNetwork && deployedNetwork.address, ); // Set web3, accounts, and contract to the state, and then proceed with an // example of interacting with the contract's methods. this.setState({ web3, accounts, contract: instance }, this.runExample); } catch (error) { // Catch any errors for any of the above operations. alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } }; runExample = async () => { const { accounts, contract } = this.state; // Stores a given value, 5 by default. await contract.methods.set(5).send({ from: accounts[0] }); // Get the value from the contract to prove it worked. const response = await contract.methods.get().call(); // Update state with the result. this.setState({ storageValue: response }); }; render() { if (!this.state.web3) { return
Loading Web3, accounts, and contract...
; } return (

Good to Go!

Your Truffle Box is installed and ready.

Smart Contract Example

If your contracts compiled and migrated successfully, below will show a stored value of 5 (by default).

Try changing the value stored on line 40 of App.js.

The stored value is: {this.state.storageValue}
); } } export default App; ================================================ FILE: chapter-7/fundraiser/client/src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); ================================================ FILE: chapter-7/fundraiser/client/src/index.css ================================================ body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: chapter-7/fundraiser/client/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render(, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: chapter-7/fundraiser/client/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read http://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit http://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: chapter-7/fundraiser/client/src/utils/getWeb3.js ================================================ import Web3 from "web3"; const getWeb3 = () => new Promise((resolve, reject) => { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener("load", async () => { // Modern dapp browsers... if (window.ethereum) { const web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed resolve(web3); } catch (error) { reject(error); } } // Legacy dapp browsers... else if (window.web3) { // Use Mist/MetaMask's provider. const web3 = window.web3; console.log("Injected web3 detected."); resolve(web3); } // Fallback to localhost; use dev console port by default... else { const provider = new Web3.providers.HttpProvider( "http://127.0.0.1:8545" ); const web3 = new Web3(provider); console.log("No web3 instance injected, using Local web3."); resolve(web3); } }); }); export default getWeb3; ================================================ FILE: chapter-7/fundraiser/contracts/Fundraiser.sol ================================================ pragma solidity >0.4.23 <0.7.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract Fundraiser is Ownable { using SafeMath for uint256; struct Donation { uint256 value; uint256 date; } mapping(address => Donation[]) private _donations; event DonationReceived(address indexed donor, uint256 value); event Withdraw(uint256 amount); string public name; string public url; string public imageURL; string public description; address payable public beneficiary; uint256 public totalDonations; uint256 public donationsCount; constructor( string memory _name, string memory _url, string memory _imageURL, string memory _description, address payable _beneficiary, address _custodian ) public { name = _name; url = _url; imageURL = _imageURL; description = _description; beneficiary = _beneficiary; _transferOwnership(_custodian); } function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } function myDonationsCount() public view returns(uint256) { return _donations[msg.sender].length; } function donate() public payable { Donation memory donation = Donation({ value: msg.value, date: block.timestamp }); _donations[msg.sender].push(donation); totalDonations = totalDonations.add(msg.value); donationsCount++; emit DonationReceived(msg.sender, msg.value); } function myDonations() public view returns( uint256[] memory values, uint256[] memory dates ) { uint256 count = myDonationsCount(); values = new uint256[](count); dates = new uint256[](count); for (uint256 i = 0; i < count; i++) { Donation storage donation = _donations[msg.sender][i]; values[i] = donation.value; dates[i] = donation.date; } return (values, dates); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; beneficiary.transfer(balance); emit Withdraw(balance); } function () external payable { totalDonations = totalDonations.add(msg.value); donationsCount++; } } ================================================ FILE: chapter-7/fundraiser/contracts/FundraiserFactory.sol ================================================ pragma solidity >0.4.23 <0.7.0; import "./Fundraiser.sol"; contract FundraiserFactory { uint256 constant maxLimit = 20; Fundraiser[] private _fundraisers; event FundraiserCreated(Fundraiser indexed fundraiser, address indexed owner); function createFundraiser( string memory name, string memory url, string memory imageURL, string memory description, address payable beneficiary ) public { Fundraiser fundraiser = new Fundraiser( name, url, imageURL, description, beneficiary, msg.sender ); _fundraisers.push(fundraiser); emit FundraiserCreated(fundraiser, msg.sender); } function fundraisersCount() public view returns(uint256) { return _fundraisers.length; } function fundraisers(uint256 limit, uint256 offset) public view returns(Fundraiser[] memory coll) { require(offset <= fundraisersCount(), "offset out of bounds"); uint256 size = fundraisersCount() - offset; size = size < limit ? size : limit; size = size < maxLimit ? size : maxLimit; coll = new Fundraiser[](size); for(uint256 i = 0; i < size; i++) { coll[i] = _fundraisers[offset + i]; } return coll; } } ================================================ FILE: chapter-7/fundraiser/contracts/Migrations.sol ================================================ pragma solidity ^0.5.0; contract Migrations { address public owner; uint public last_completed_migration; modifier restricted() { if (msg.sender == owner) _; } constructor() public { owner = msg.sender; } function setCompleted(uint completed) public restricted { last_completed_migration = completed; } function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } ================================================ FILE: chapter-7/fundraiser/migrations/1_initial_migration.js ================================================ var Migrations = artifacts.require("./Migrations.sol"); module.exports = function(deployer) { deployer.deploy(Migrations); }; ================================================ FILE: chapter-7/fundraiser/migrations/2_deploy_fundraiser_factory.js ================================================ const FundraiserFactoryContract = artifacts.require("FundraiserFactory"); module.exports = function(deployer) { deployer.deploy(FundraiserFactoryContract); } ================================================ FILE: chapter-7/fundraiser/test/fundraiser_factory_test.js ================================================ const FundraiserFactoryContract = artifacts.require("FundraiserFactory"); const FundraiserContract = artifacts.require("Fundraiser"); contract("FundraiserFactory: deployment", () => { it("has been deployed", async () => { const fundraiserFactory = FundraiserFactoryContract.deployed(); assert(fundraiserFactory, "fundraiser factory was not deployed"); }); }); contract("FundraiserFactory: createFundraiser", (accounts) => { let fundraiserFactory; // fundraiser args const name = "Beneficiary Name"; const url = "beneficiaryname.org"; const imageURL = "https://placekitten.com/600/350" const description = "Beneficiary Description" const beneficiary = accounts[1]; it("increments the fundraisersCount", async () => { fundraiserFactory = await FundraiserFactoryContract.deployed(); const currentFundraisersCount = await fundraiserFactory.fundraisersCount(); await fundraiserFactory.createFundraiser( name, url, imageURL, description, beneficiary ); const newFundraisersCount = await fundraiserFactory.fundraisersCount(); assert.equal( newFundraisersCount - currentFundraisersCount, 1, "should increment by 1" ) }); it("emits the FundraiserCreated event", async () => { fundraiserFactory = await FundraiserFactoryContract.deployed(); const tx = await fundraiserFactory.createFundraiser( name, url, imageURL, description, beneficiary ); const expectedEvent = "FundraiserCreated"; const actualEvent = tx.logs[0].event; assert.equal( actualEvent, expectedEvent, "events should match" ); }); }); contract("FundraiserFactory: fundraisers", (accounts) => { async function createFundraiserFactory(fundraiserCount, accounts) { const factory = await FundraiserFactoryContract.new(); await addFundraisers(factory, fundraiserCount, accounts); return factory; } async function addFundraisers(factory, count, accounts) { const name = "Beneficiary"; const lowerCaseName = name.toLowerCase(); const beneficiary = accounts[1]; for (let i=0; i < count; i++) { await factory.createFundraiser( `${name} ${i}`, `${lowerCaseName}${i}.com`, `${lowerCaseName}${i}.png`, `Description for ${name} ${i}`, beneficiary ); } } describe("when fundraisers collection is empty", () => { it("returns an empty collection", async () => { const factory = await createFundraiserFactory(0, accounts); const fundraisers = await factory.fundraisers(10, 0); assert.equal( fundraisers.length, 0, "collection should be empty" ); }); }); describe("varying limits", async () => { let factory; beforeEach(async () => { factory = await createFundraiserFactory(30, accounts); }) it("returns 10 results when limit requested is 10", async ()=>{ const fundraisers = await factory.fundraisers(10, 0); assert.equal( fundraisers.length, 10, "results size should be 10" ); }); it("returns 20 results when limit requested is 20", async ()=>{ const fundraisers = await factory.fundraisers(20, 0); assert.equal( fundraisers.length, 20, "results size should be 20" ); }); it("returns 20 results when limit requested is 30", async ()=>{ const fundraisers = await factory.fundraisers(30, 0); assert.equal( fundraisers.length, 20, "results size should be 20" ); }); }) describe("varying offset", () => { let factory; beforeEach(async () => { factory = await createFundraiserFactory(10, accounts); }); it("contains the fundraiser with the appropriate offset", async ()=>{ const fundraisers = await factory.fundraisers(1, 0); const fundraiser = await FundraiserContract.at(fundraisers[0]); const name = await fundraiser.name(); assert.ok(await name.includes(0), `${name} did not include the offset`); }); it("contains the fundraiser with the appropriate offset", async ()=>{ const fundraisers = await factory.fundraisers(1, 7); const fundraiser = await FundraiserContract.at(fundraisers[0]); const name = await fundraiser.name(); assert.ok(await name.includes(7), `${name} did not include the offset`); }); }); describe("boundry conditions", () => { let factory; beforeEach(async () => { factory = await createFundraiserFactory(10, accounts); }); it("raises out of bounds error", async () => { try { await factory.fundraisers(1, 11); assert.fail("error was not raised") } catch(err) { const expected = "offset out of bounds"; assert.ok(err.message.includes(expected), `${err.message}`); } }); it("adjusts return size to prevent out of bounds error", async () => { try { const fundraisers = await factory.fundraisers(10, 5); assert.equal( fundraisers.length, 5, "collection adjusted" ); } catch(err) { assert.fail("limit and offset exceeded bounds"); } }); }); }); ================================================ FILE: chapter-7/fundraiser/test/fundraiser_test.js ================================================ const FundraiserContract = artifacts.require("Fundraiser"); contract("Fundraiser", accounts => { let fundraiser; const name = "Beneficiary Name"; const url = "beneficiaryname.org"; const imageURL = "https://placekitten.com/600/350"; const description = "Beneficiary description"; const beneficiary = accounts[1]; const owner = accounts[0]; beforeEach(async () => { fundraiser = await FundraiserContract.new( name, url, imageURL, description, beneficiary, owner ) }); describe("initialization", () => { it("gets the beneficiary name", async () => { const actual = await fundraiser.name(); assert.equal(actual, name, "names should match"); }); it("gets the beneficiary url", async () => { const actual = await fundraiser.url(); assert.equal(actual, url, "url should match"); }); it("gets the beneficiary image url", async () => { const actual = await fundraiser.imageURL(); assert.equal(actual, imageURL, "imageURL should match"); }); it("gets the beneficiary description", async () => { const actual = await fundraiser.description(); assert.equal(actual, description, "description should match"); }); it("gets the beneficiary", async () => { const actual = await fundraiser.beneficiary(); assert.equal(actual, beneficiary, "beneficiary addresses should match"); }); it("gets the owner", async () => { const actual = await fundraiser.owner(); assert.equal(actual, owner, "bios should match"); }); }); describe("setBeneficiary", () => { const newBeneficiary = accounts[2]; it("updated beneficiary when called by owner account", async () => { await fundraiser.setBeneficiary(newBeneficiary, {from: owner}); const actualBeneficiary = await fundraiser.beneficiary(); assert.equal(actualBeneficiary, newBeneficiary, "beneficiaries should match"); }); it("throws and error when called from a non-owner account", async () => { try { await fundraiser.setBeneficiary(newBeneficiary, {from: accounts[3]}); assert.fail("withdraw was not restricted to owners") } catch(err) { const expectedError = "Ownable: caller is not the owner" const actualError = err.reason; assert.equal(actualError, expectedError, "should not be permitted") } }); }); describe("making donations", () => { const value = web3.utils.toWei('0.0289'); const donor = accounts[2]; it("increases myDonationsCount", async () => { const currentDonationsCount = await fundraiser.myDonationsCount( {from: donor} ); await fundraiser.donate({from: donor, value}); const newDonationsCount = await fundraiser.myDonationsCount({from: donor}); assert.equal( 1, newDonationsCount - currentDonationsCount, "myDonationsCount should increment by 1"); }); it("includes donation in myDonations", async () => { await fundraiser.donate({from: donor, value}); const {values, dates} = await fundraiser.myDonations( {from: donor} ); assert.equal( value, values[0], "values should match" ); assert(dates[0], "date should be present"); }); it("increases the totalDonations amount", async () => { const currentTotalDonations = await fundraiser.totalDonations(); await fundraiser.donate({from: donor, value}); const newTotalDonations = await fundraiser.totalDonations(); const diff = newTotalDonations - currentTotalDonations; assert.equal( diff, value, "difference should match the donation value" ) }); it("increases donationsCount", async () => { const currentDonationsCount = await fundraiser.donationsCount(); await fundraiser.donate({from: donor, value}); const newDonationsCount = await fundraiser.donationsCount(); assert.equal( 1, newDonationsCount - currentDonationsCount, "donationsCount should increment by 1"); }); it("emits the DonationReceived event", async () => { const tx = await fundraiser.donate({from: donor, value}); const expectedEvent = "DonationReceived"; const actualEvent = tx.logs[0].event; assert.equal(actualEvent, expectedEvent, "events should match"); }); }); describe("withdrawing funds", () => { beforeEach(async () => { await fundraiser.donate( {from: accounts[2], value: web3.utils.toWei('0.1')} ); }); describe("access controls", () => { it("throws and error when called from a non-owner account", async () => { try { await fundraiser.withdraw({from: accounts[3]}); assert.fail("withdraw was not restricted to owners") } catch(err) { const expectedError = "Ownable: caller is not the owner" const actualError = err.reason; assert.equal(actualError, expectedError, "should not be permitted") } }); it("permits the owner to call the function", async () => { try { await fundraiser.withdraw({from: owner}); assert(true, "no errors were thrown"); } catch(err) { assert.fail("should not have thrown an error"); } }); }); it("transfers balance to beneficiary", async () => { const currentContractBalance = await web3.eth.getBalance(fundraiser.address); const currentBeneficiaryBalance = await web3.eth.getBalance(beneficiary); await fundraiser.withdraw({from: owner}); const newContractBalance = await web3.eth.getBalance(fundraiser.address); const newBeneficiaryBalance = await web3.eth.getBalance(beneficiary); const beneficiaryDifference = newBeneficiaryBalance - currentBeneficiaryBalance; assert.equal( newContractBalance, 0, "contract should have a 0 balance" ); assert.equal( beneficiaryDifference, currentContractBalance, "beneficiary should receive all the funds" ); }); it("emits Withdraw event", async () => { const tx = await fundraiser.withdraw({from: owner}); const expectedEvent = "Withdraw"; const actualEvent = tx.logs[0].event; assert.equal( actualEvent, expectedEvent, "events should match" ); }); }); describe("fallback function", () => { const value = web3.utils.toWei('0.0289'); it("increases the totalDonations amount", async () => { const currentTotalDonations = await fundraiser.totalDonations(); await web3.eth.sendTransaction( {to: fundraiser.address, from: accounts[9], value} ); const newTotalDonations = await fundraiser.totalDonations(); const diff = newTotalDonations - currentTotalDonations; assert.equal( diff, value, "difference should match the donation value" ) }); it("increases donationsCount", async () => { const currentDonationsCount = await fundraiser.donationsCount(); await web3.eth.sendTransaction( {to: fundraiser.address, from: accounts[9], value} ); const newDonationsCount = await fundraiser.donationsCount(); assert.equal( 1, newDonationsCount - currentDonationsCount, "donationsCount should increment by 1"); }); }); });; ================================================ FILE: chapter-7/fundraiser/truffle-config.js ================================================ const path = require("path"); module.exports = { // See // to customize your Truffle configuration! contracts_build_directory: path.join(__dirname, "client/src/contracts"), networks: { develop: { port: 8545 } } }; ================================================ FILE: chapter-9/README.md ================================================ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `npm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: chapter-9/package.json ================================================ { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^4.3.1", "@openzeppelin/contracts": "^2.3.0", "bootstrap": "^4.3.1", "cryptocompare": "^1.0.0", "get-eth-price": "^1.0.0", "normalize.css": "^8.0.1", "react": "^16.8.0", "react-bootstrap": "^1.0.0-beta.10", "react-dom": "^16.9.0", "react-redux": "^7.1.1", "react-router-dom": "^5.0.1", "react-scripts": "2.1.1", "redux": "^4.0.4", "web3": "^1.2.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } ================================================ FILE: chapter-9/public/index.html ================================================ React App
================================================ FILE: chapter-9/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: chapter-9/src/App.css ================================================ body { margin: 0 !important; } .App { text-align: center; } .donation-input-container { display: flex; } .withdrawal-button { margin-left: 10px; } .receipt-header { border-bottom: 1px solid gray; } .receipt-container { text-align: center; } .receipt-info { display: flex; padding: 50px; justify-content: space-between; } .donation-receipt-link { color: inherit; text-decoration: none; } .main-container { margin: 20px; } .donation-list { margin-top: 10px; margin-bottom: 10px; display: flex; justify-content: space-between; } .fundraiser-card-container { display: inline-flex; width: 250px; height: 250px; margin: 20px; } .MuiTextField-root { display: block !important; } .MuiInputBase-root { width: 300px !important; margin-left: 3px; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 40vmin; } .App-header { background-color: #282c34; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); color: white; } .App-link { color: #61dafb; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .nav-link { color: inherit; text-decoration: none; margin-right: 15px; } .nav-link:hover, .nav-link:active, .nav-link:visited { color: black; text-decoration: none; } ================================================ FILE: chapter-9/src/App.js ================================================ import React, { useState, useEffect } from "react"; import FactoryContract from "./contracts/Factory.json"; import getWeb3 from "./utils/getWeb3"; import { makeStyles } from '@material-ui/core/styles'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import { BrowserRouter as Router, Route, Link, NavLink } from "react-router-dom"; import NewFundraiser from './NewFundraiser' import Home from './Home' import Receipts from './Receipts' import "./App.css"; const App = () => { const [state, setState] = useState({web3: null, accounts: null, contract: null}); const [storageValue, setStorageValue] = useState(0); useEffect(() => { const init = async() => { try { // Get network provider and web3 instance. const web3 = await getWeb3(); // Use web3 to get the user's accounts. const accounts = await web3.eth.getAccounts(); // Get the contract instance. const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); // Set web3, accounts, and contract to the state, and then proceed with an setState({web3, accounts, contract: instance}); } catch(error) { // Catch any errors for any of the above operations. alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } init(); }, []); const useStyles = makeStyles({ root: { flexGrow: 1, }, }); const classes = useStyles(); const runExample = async () => { const { accounts, contract } = state; }; return (
Home New
) } export default App; ================================================ FILE: chapter-9/src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); ================================================ FILE: chapter-9/src/FundraiserCard.js ================================================ import React, { useEffect, useState } from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Card from '@material-ui/core/Card'; import CardActionArea from '@material-ui/core/CardActionArea'; import CardActions from '@material-ui/core/CardActions'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; import FilledInput from '@material-ui/core/FilledInput'; import FormControl from '@material-ui/core/FormControl'; import FormHelperText from '@material-ui/core/FormHelperText'; import Input from '@material-ui/core/Input'; import InputLabel from '@material-ui/core/InputLabel'; import OutlinedInput from '@material-ui/core/OutlinedInput'; import getWeb3 from "./utils/getWeb3"; import FundraiserContract from "./contracts/Fundraiser.json"; import Web3 from 'web3' import { Link } from 'react-router-dom' const cc = require('cryptocompare') const getModalStyle =() => { const top = 50; const left = 50; return { top, left, }; } const useStyles = makeStyles(theme => ({ container: { display: 'flex', flexWrap: 'wrap', }, formControl: { margin: theme.spacing(1), display: 'table-cell' }, card: { maxWidth: 450, height: 400 }, media: { height: 140, }, paper: { position: 'absolute', width: 500, backgroundColor: theme.palette.background.paper, border: 'none', boxShadow: 'none', padding: 4, }, })); const FundraiserCard = (props) => { const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const [ fund, setFundraiser ] = useState(null) const [ fundName, setFundname ] = useState(null) const [ bio, setBio ] = useState(null) const [ totalDonations, setTotalDonations ] = useState(null) const [ imageURL, setImageURL ] = useState(null) const [ url, setURL ] = useState(null) const [ open, setOpen] = React.useState(false); const [ donationAmount, setDonationAmount] = useState(null) const [ exchangeRate, setExchangeRate ] = useState(null) const [ userDonations, setUserDonations ] = useState(null) const [ isOwner, setIsOwner ] = useState(false) const ethAmount = (donationAmount / exchangeRate || 0).toFixed(4) const { fundraiser } = props const classes = useStyles(); useEffect(() => { if (fundraiser) { init(fundraiser) } }, [fundraiser]); const init = async (fundraiser) => { try { const fund = fundraiser const networkId = await web3.eth.net.getId(); const deployedNetwork = FundraiserContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FundraiserContract.abi, fund ); setContract(instance) setAccounts(accounts) const name = await instance.methods.name().call() const bio = await instance.methods.bio().call() const totalDonations = await instance.methods.totalDonations().call() const imageURL = await instance.methods.imageURL().call() const url = await instance.methods.url().call() const exchangeRate = await cc.price('ETH', ['USD']) setExchangeRate(exchangeRate.USD) const eth = web3.utils.fromWei(totalDonations, 'ether') const dollarDonationAmount = exchangeRate.USD * eth setTotalDonations(dollarDonationAmount.toFixed(2)) setFundname(name) setBio(bio) setImageURL(imageURL) setURL(url) const userDonations = await instance.methods.myDonations().call({ from: accounts[0]}) console.log(userDonations) setUserDonations(userDonations) const isUser = accounts[0] const isOwner = await instance.methods.owner().call() if (isOwner === accounts[[0]]) { setIsOwner(true) } } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } window.ethereum.on('accountsChanged', function (accounts) { window.location.reload() }) const handleOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; const submitFunds = async () => { const fundraisercontract = contract const conversionRate = 18460; const ethRate = exchangeRate const ethTotal = donationAmount / ethRate const donation = web3.utils.toWei(ethTotal.toString()) await contract.methods.donate(conversionRate).send({ from: accounts[0], value: donation, gas: 650000 }) setOpen(false); } const showReceipt = (amount, date) => { } const renderDonationsList = () => { var donations = userDonations if (donations === null) {return null} const totalDonations = donations.values.length let donationList = [] var i for (i = 0; i < totalDonations; i++) { const ethAmount = web3.utils.fromWei(donations.values[i]) const userDonation = exchangeRate * ethAmount const donationDate = donations.dates[i] donationList.push({ donationAmount: userDonation.toFixed(2), date: donationDate}) } return donationList.map((donation) => { return (

${donation.donationAmount}

) }) } const withdrawalFunds = async () => { await contract.methods.withdraw().send({ from: accounts[0], }) alert('Funds Withdrawn!') } return (
Donate to {fundName}

{bio}

$ setDonationAmount(e.target.value)} placeholder="0.00" />

Eth: {ethAmount}

My donations

{renderDonationsList()}
{isOwner && }
{fundName}

{bio}

Total Donations: ${totalDonations}

) } export default FundraiserCard; ================================================ FILE: chapter-9/src/Home.js ================================================ import React, { useState, useEffect } from "react"; import { makeStyles } from '@material-ui/core/styles'; import FundraiserCard from './FundraiserCard' import getWeb3 from "./utils/getWeb3"; import FactoryContract from "./contracts/Factory.json"; import Web3 from 'web3' const useStyles = makeStyles(theme => ({ button: { margin: theme.spacing(1), }, input: { display: 'none', }, })); const Home = () => { const classes = useStyles(); const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const [ funds, setFunds ] = useState([]) const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) useEffect(() => { init() }, []); const init = async () => { try { const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); setContract(instance) setAccounts(accounts) const funds = await instance.methods.fundraisers().call() setFunds(funds) } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } const displayFundraisers = () => { return funds.map((fundraiser) => { return ( ) }) } return (
{displayFundraisers()}
) } export default Home; ================================================ FILE: chapter-9/src/NewFundraiser.js ================================================ import React, { useState, useEffect } from "react"; import FormControl from '@material-ui/core/FormControl'; import { makeStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import MenuItem from '@material-ui/core/MenuItem'; import TextField from '@material-ui/core/TextField'; import getWeb3 from "./utils/getWeb3"; import FactoryContract from "./contracts/Factory.json"; import Web3 from 'web3' const useStyles = makeStyles(theme => ({ container: { display: 'flex', flexWrap: 'wrap', }, textField: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), }, dense: { marginTop: theme.spacing(2), }, menu: { width: 200, }, })); const NewFundraiser = () => { const [labelWidth, setLabelWidth] = React.useState(0); const labelRef = React.useRef(null); const classes = useStyles(); const [ web3, setWeb3 ] = useState(null) useEffect(() => { const init = async() => { try { const web3 = await getWeb3(); const networkId = await web3.eth.net.getId(); const deployedNetwork = FactoryContract.networks[networkId]; const accounts = await web3.eth.getAccounts(); const instance = new web3.eth.Contract( FactoryContract.abi, deployedNetwork && deployedNetwork.address, ); setWeb3(web3) setContract(instance) setAccounts(accounts) } catch(error) { alert( `Failed to load web3, accounts, or contract. Check console for details.`, ); console.error(error); } } init(); }, []); const [ name, setFundraiserName ] = useState(null) const [ website, setFundraiserWebsite ] = useState(null) const [ description, setFundraiserDescription ] = useState(null) const [ image, setImage ] = useState(null) const [ address, setAddress ] = useState(null) const [ custodian, setCustodian ] = useState(null) const [ contract, setContract] = useState(null) const [ accounts, setAccounts ] = useState(null) const handleSubmit = async () => { const imageURL = image const bio = description const beneficiary = address const transaction = await contract.methods.createFundraiser( name, website, imageURL, bio, beneficiary, custodian ).send({ from: accounts[0] }) alert('Successfully created fundraiser') } return (

Create A New Fundraiser

setFundraiserName(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setFundraiserWebsite(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setFundraiserDescription(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setImage(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setAddress(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} /> setCustodian(e.target.value)} variant="outlined" inputProps={{ 'aria-label': 'bare' }} />
) } export default NewFundraiser; ================================================ FILE: chapter-9/src/Receipts.js ================================================ import React, { useState, useEffect } from "react"; const Receipts = (props) => { const [ donation, setDonation ] = useState(null) const [ fundName, setFundName ] = useState(null) const [ date, setDate ] = useState(null) useEffect(() => { const { donation, date, fund } = props.location.state const formattedDate = new Date(parseInt(date)) setDonation(donation) setDate(formattedDate.toString()) setFundName(fund) }, []); return (

Thank you for your donation to {fundName}

Date of Donation: {date}
Donation Value: ${donation}
) } export default Receipts; ================================================ FILE: chapter-9/src/contracts/Factory.json ================================================ { "contractName": "Factory", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "name": "fundraiser", "type": "address" }, { "indexed": true, "name": "name", "type": "string" } ], "name": "LogFundraiserCreated", "type": "event" }, { "constant": false, "inputs": [ { "name": "name", "type": "string" }, { "name": "url", "type": "string" }, { "name": "imageURL", "type": "string" }, { "name": "bio", "type": "string" }, { "name": "beneficiary", "type": "address" }, { "name": "custodian", "type": "address" } ], "name": "createFundraiser", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "fundraisersCount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "fundraisers", "outputs": [ { "name": "fs", "type": "address[]" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"fundraisers\",\"outputs\":[{\"name\":\"fs\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"fundraisersCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"imageURL\",\"type\":\"string\"},{\"name\":\"bio\",\"type\":\"string\"},{\"name\":\"beneficiary\",\"type\":\"address\"},{\"name\":\"custodian\",\"type\":\"address\"}],\"name\":\"createFundraiser\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"fundraiser\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"LogFundraiserCreated\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Factory.sol\":\"Factory\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]},\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Factory.sol\":{\"keccak256\":\"0xc191a38221745e86be7454a147164100b00a612403359084ce4bc5d825b18124\",\"urls\":[\"bzzr://aad8ace28c5063db8bb8748350dc7e41ce036df200f891c72799f54f7f0e96a0\"]},\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol\":{\"keccak256\":\"0x19055c641f5ff96a84149a81b8950c1387518095d8ce4451b951bc03d46d5c20\",\"urls\":[\"bzzr://2b8f024402ccb06c57f6a57a77f446a65b4a98be633351a4aa39aacd8c00a355\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50611f31806100206000396000f3fe60806040523480156200001157600080fd5b5060043610620000465760003560e01c806307d98512146200004b5780639d3b435514620000ae578063bec23b2814620000ce575b600080fd5b620000556200039d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156200009a5780820151818401526020810190506200007d565b505050509050019250505060405180910390f35b620000b862000485565b6040518082815260200191505060405180910390f35b6200039b600480360360c0811015620000e657600080fd5b81019080803590602001906401000000008111156200010457600080fd5b8201836020820111156200011757600080fd5b803590602001918460018302840111640100000000831117156200013a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200019e57600080fd5b820183602082011115620001b157600080fd5b80359060200191846001830284011164010000000083111715620001d457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200023857600080fd5b8201836020820111156200024b57600080fd5b803590602001918460018302840111640100000000831117156200026e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115620002d257600080fd5b820183602082011115620002e557600080fd5b803590602001918460018302840111640100000000831117156200030857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062000491565b005b60606000620003ab62000485565b905080604051908082528060200260200182016040528015620003dd5781602001602082028038833980820191505090505b50915060008090505b818110156200047d5760008181548110620003fd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168382815181106200043557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050620003e6565b508191505090565b60008080549050905090565b6000868686868686604051620004a79062000801565b80806020018060200180602001806020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185810385528b818151815260200191508051906020019080838360005b838110156200055657808201518184015260208101905062000539565b50505050905090810190601f168015620005845780820380516001836020036101000a031916815260200191505b5085810384528a818151815260200191508051906020019080838360005b83811015620005bf578082015181840152602081019050620005a2565b50505050905090810190601f168015620005ed5780820380516001836020036101000a031916815260200191505b50858103835289818151815260200191508051906020019080838360005b83811015620006285780820151818401526020810190506200060b565b50505050905090810190601f168015620006565780820380516001836020036101000a031916815260200191505b50858103825288818151815260200191508051906020019080838360005b838110156200069157808201518184015260208101905062000674565b50505050905090810190601f168015620006bf5780820380516001836020036101000a031916815260200191505b509a5050505050505050505050604051809103906000f080158015620006e9573d6000803e3d6000fd5b50905060008190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050866040518082805190602001908083835b6020831062000788578051825260208201915060208101905060208303925062000763565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208173ffffffffffffffffffffffffffffffffffffffff167f90abfad37a2503e16cce667bb7e0542fe1af5963cfe29bdf5f778a83803c336260405160405180910390a350505050505050565b6116f680620008108339019056fe6080604052600060065560006007553480156200001b57600080fd5b50604051620016f6380380620016f6833981018060405260c08110156200004157600080fd5b8101908080516401000000008111156200005a57600080fd5b828101905060208101848111156200007157600080fd5b81518560018202830111640100000000821117156200008f57600080fd5b50509291906020018051640100000000811115620000ac57600080fd5b82810190506020810184811115620000c357600080fd5b8151856001820283011164010000000082111715620000e157600080fd5b50509291906020018051640100000000811115620000fe57600080fd5b828101905060208101848111156200011557600080fd5b81518560018202830111640100000000821117156200013357600080fd5b505092919060200180516401000000008111156200015057600080fd5b828101905060208101848111156200016757600080fd5b81518560018202830111640100000000821117156200018557600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600190805190602001906200027892919062000468565b5084600290805190602001906200029192919062000468565b508360039080519060200190620002aa92919062000468565b508260049080519060200190620002c392919062000468565b5081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000316816200032260201b60201c565b50505050505062000517565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003aa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180620016d06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004ab57805160ff1916838001178555620004dc565b82800160010185558215620004dc579182015b82811115620004db578251825591602001919060010190620004be565b5b509050620004eb9190620004ef565b5090565b6200051491905b8082111562000510576000816000905550600101620004f6565b5090565b90565b6111a980620005276000396000f3fe6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063de2ed89311610059578063de2ed893146104c4578063f14faf6f146104ef578063f2fde38b1461051d578063f516b4221461056e576100dd565b80638da5cb5b146103ae5780638f32d59b14610405578063b90497e014610434576100dd565b806338af3eed116100bb57806338af3eed146102995780633ccfd60b146102f05780635600f04f14610307578063715018a614610397576100dd565b806306fdde03146100e25780631a57f7b4146101725780631f5225951461026e575b600080fd5b3480156100ee57600080fd5b506100f76105fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017e57600080fd5b506101876106a0565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156101d25780820151818401526020810190506101b7565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102145780820151818401526020810190506101f9565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561025657808201518184015260208101905061023b565b50505050905001965050505050505060405180910390f35b34801561027a57600080fd5b50610283610909565b6040518082815260200191505060405180910390f35b3480156102a557600080fd5b506102ae610913565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061030561093d565b005b34801561031357600080fd5b5061031c610a76565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103a357600080fd5b506103ac610b18565b005b3480156103ba57600080fd5b506103c3610c51565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041157600080fd5b5061041a610c7a565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610449610cd1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048957808201518184015260208101905061046e565b50505050905090810190601f1680156104b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104d057600080fd5b506104d9610d73565b6040518082815260200191505060405180910390f35b61051b6004803603602081101561050557600080fd5b8101908080359060200190929190505050610d7d565b005b34801561052957600080fd5b5061056c6004803603602081101561054057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eca565b005b34801561057a57600080fd5b50610583610f50565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c35780820151818401526020810190506105a8565b50505050905090810190601f1680156105f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60608060606000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090508060405190808252806020026020018201604052801561071b5781602001602082028038833980820191505090505b5093508060405190808252806020026020018201604052801561074d5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561077f5781602001602082028038833980820191505090505b50915060008090505b818110156108f957600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106107da57fe5b9060005260206000209060030201600001548582815181106107f857fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811061084e57fe5b90600052602060002090600302016001015484828151811061086c57fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106108c257fe5b9060005260206000209060030201600201548382815181106108e057fe5b6020026020010181815250508080600101915050610788565b5083838393509350935050909192565b6000600754905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610945610c7a565b6109b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a3b573d6000803e3d6000fd5b507f879a83fc17750905b8aef4ef85e6701b84a50e15d4463dc3c2e7fb0f9dbcf75d816040518082815260200191505060405180910390a150565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b5050505050905090565b610b20610c7a565b610b92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d695780601f10610d3e57610100808354040283529160200191610d69565b820191906000526020600020905b815481529060010190602001808311610d4c57829003601f168201915b5050505050905090565b6000600654905090565b610d85611136565b6040518060600160405280348152602001428152602001838152509050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060030201600090919290919091506000820151816000015560208201518160010155604082015181600201555050503460066000828254019250508190555060016007600082825401925050819055507f8fa09d0d0409c35ef3a40d2e1f9f00512eedb373c85bd5b86177ba58c3a5a48e33348360200151604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050565b610ed2610c7a565b610f44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4d81610ff2565b50565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fe85780601f10610fbd57610100808354040283529160200191610fe8565b820191906000526020600020905b815481529060010190602001808311610fcb57829003601f168201915b5050505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611078576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111586026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060600160405280600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582012faf8a42a7625617a68d9b57f5b0b15d50babba6dbac248b2b4f6c83200a4a100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582037da87857a9bfc2af4b124bf3c0a908e9ff57f628a30a8c24433852557e11ea60029", "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c806307d98512146200004b5780639d3b435514620000ae578063bec23b2814620000ce575b600080fd5b620000556200039d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156200009a5780820151818401526020810190506200007d565b505050509050019250505060405180910390f35b620000b862000485565b6040518082815260200191505060405180910390f35b6200039b600480360360c0811015620000e657600080fd5b81019080803590602001906401000000008111156200010457600080fd5b8201836020820111156200011757600080fd5b803590602001918460018302840111640100000000831117156200013a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200019e57600080fd5b820183602082011115620001b157600080fd5b80359060200191846001830284011164010000000083111715620001d457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156200023857600080fd5b8201836020820111156200024b57600080fd5b803590602001918460018302840111640100000000831117156200026e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115620002d257600080fd5b820183602082011115620002e557600080fd5b803590602001918460018302840111640100000000831117156200030857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062000491565b005b60606000620003ab62000485565b905080604051908082528060200260200182016040528015620003dd5781602001602082028038833980820191505090505b50915060008090505b818110156200047d5760008181548110620003fd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168382815181106200043557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050620003e6565b508191505090565b60008080549050905090565b6000868686868686604051620004a79062000801565b80806020018060200180602001806020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185810385528b818151815260200191508051906020019080838360005b838110156200055657808201518184015260208101905062000539565b50505050905090810190601f168015620005845780820380516001836020036101000a031916815260200191505b5085810384528a818151815260200191508051906020019080838360005b83811015620005bf578082015181840152602081019050620005a2565b50505050905090810190601f168015620005ed5780820380516001836020036101000a031916815260200191505b50858103835289818151815260200191508051906020019080838360005b83811015620006285780820151818401526020810190506200060b565b50505050905090810190601f168015620006565780820380516001836020036101000a031916815260200191505b50858103825288818151815260200191508051906020019080838360005b838110156200069157808201518184015260208101905062000674565b50505050905090810190601f168015620006bf5780820380516001836020036101000a031916815260200191505b509a5050505050505050505050604051809103906000f080158015620006e9573d6000803e3d6000fd5b50905060008190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050866040518082805190602001908083835b6020831062000788578051825260208201915060208101905060208303925062000763565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208173ffffffffffffffffffffffffffffffffffffffff167f90abfad37a2503e16cce667bb7e0542fe1af5963cfe29bdf5f778a83803c336260405160405180910390a350505050505050565b6116f680620008108339019056fe6080604052600060065560006007553480156200001b57600080fd5b50604051620016f6380380620016f6833981018060405260c08110156200004157600080fd5b8101908080516401000000008111156200005a57600080fd5b828101905060208101848111156200007157600080fd5b81518560018202830111640100000000821117156200008f57600080fd5b50509291906020018051640100000000811115620000ac57600080fd5b82810190506020810184811115620000c357600080fd5b8151856001820283011164010000000082111715620000e157600080fd5b50509291906020018051640100000000811115620000fe57600080fd5b828101905060208101848111156200011557600080fd5b81518560018202830111640100000000821117156200013357600080fd5b505092919060200180516401000000008111156200015057600080fd5b828101905060208101848111156200016757600080fd5b81518560018202830111640100000000821117156200018557600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600190805190602001906200027892919062000468565b5084600290805190602001906200029192919062000468565b508360039080519060200190620002aa92919062000468565b508260049080519060200190620002c392919062000468565b5081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000316816200032260201b60201c565b50505050505062000517565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003aa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180620016d06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004ab57805160ff1916838001178555620004dc565b82800160010185558215620004dc579182015b82811115620004db578251825591602001919060010190620004be565b5b509050620004eb9190620004ef565b5090565b6200051491905b8082111562000510576000816000905550600101620004f6565b5090565b90565b6111a980620005276000396000f3fe6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063de2ed89311610059578063de2ed893146104c4578063f14faf6f146104ef578063f2fde38b1461051d578063f516b4221461056e576100dd565b80638da5cb5b146103ae5780638f32d59b14610405578063b90497e014610434576100dd565b806338af3eed116100bb57806338af3eed146102995780633ccfd60b146102f05780635600f04f14610307578063715018a614610397576100dd565b806306fdde03146100e25780631a57f7b4146101725780631f5225951461026e575b600080fd5b3480156100ee57600080fd5b506100f76105fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017e57600080fd5b506101876106a0565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156101d25780820151818401526020810190506101b7565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102145780820151818401526020810190506101f9565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561025657808201518184015260208101905061023b565b50505050905001965050505050505060405180910390f35b34801561027a57600080fd5b50610283610909565b6040518082815260200191505060405180910390f35b3480156102a557600080fd5b506102ae610913565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061030561093d565b005b34801561031357600080fd5b5061031c610a76565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103a357600080fd5b506103ac610b18565b005b3480156103ba57600080fd5b506103c3610c51565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041157600080fd5b5061041a610c7a565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610449610cd1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048957808201518184015260208101905061046e565b50505050905090810190601f1680156104b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104d057600080fd5b506104d9610d73565b6040518082815260200191505060405180910390f35b61051b6004803603602081101561050557600080fd5b8101908080359060200190929190505050610d7d565b005b34801561052957600080fd5b5061056c6004803603602081101561054057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eca565b005b34801561057a57600080fd5b50610583610f50565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c35780820151818401526020810190506105a8565b50505050905090810190601f1680156105f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60608060606000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090508060405190808252806020026020018201604052801561071b5781602001602082028038833980820191505090505b5093508060405190808252806020026020018201604052801561074d5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561077f5781602001602082028038833980820191505090505b50915060008090505b818110156108f957600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106107da57fe5b9060005260206000209060030201600001548582815181106107f857fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811061084e57fe5b90600052602060002090600302016001015484828151811061086c57fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106108c257fe5b9060005260206000209060030201600201548382815181106108e057fe5b6020026020010181815250508080600101915050610788565b5083838393509350935050909192565b6000600754905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610945610c7a565b6109b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a3b573d6000803e3d6000fd5b507f879a83fc17750905b8aef4ef85e6701b84a50e15d4463dc3c2e7fb0f9dbcf75d816040518082815260200191505060405180910390a150565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b5050505050905090565b610b20610c7a565b610b92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d695780601f10610d3e57610100808354040283529160200191610d69565b820191906000526020600020905b815481529060010190602001808311610d4c57829003601f168201915b5050505050905090565b6000600654905090565b610d85611136565b6040518060600160405280348152602001428152602001838152509050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060030201600090919290919091506000820151816000015560208201518160010155604082015181600201555050503460066000828254019250508190555060016007600082825401925050819055507f8fa09d0d0409c35ef3a40d2e1f9f00512eedb373c85bd5b86177ba58c3a5a48e33348360200151604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050565b610ed2610c7a565b610f44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4d81610ff2565b50565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fe85780601f10610fbd57610100808354040283529160200191610fe8565b820191906000526020600020905b815481529060010190602001808311610fcb57829003601f168201915b5050505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611078576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111586026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060600160405280600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582012faf8a42a7625617a68d9b57f5b0b15d50babba6dbac248b2b4f6c83200a4a100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582037da87857a9bfc2af4b124bf3c0a908e9ff57f628a30a8c24433852557e11ea60029", "sourceMap": "63:1035:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;63:1035:1;;;;;;;", "deployedSourceMap": "63:1035:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;63:1035:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;829:267;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;829:267:1;;;;;;;;;;;;;;;;;722:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;;210:505;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;210:505:1;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;210:505:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;210:505:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;210:505:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;210:505:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;210:505:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;210:505:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;210:505:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;210:505:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;210:505:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;210:505:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;210:505:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;210:505:1;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;210:505:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;210:505:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;210:505:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;210:505:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;829:267;872:22;906:13;922:18;:16;:18::i;:::-;906:34;;972:5;955:23;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;955:23:1;;;;950:28;;992:9;1004:1;992:13;;988:83;1011:5;1007:1;:9;988:83;;;1045:12;1058:1;1045:15;;;;;;;;;;;;;;;;;;;;;;;;;1037:2;1040:1;1037:5;;;;;;;;;;;;;:23;;;;;;;;;;;1018:3;;;;;;;988:83;;;;1087:2;1080:9;;;829:267;:::o;722:100::-;770:7;796:12;:19;;;;789:26;;722:100;:::o;210:505::-;437:21;489:4;507:3;524:8;546:3;563:11;588:9;461:146;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;461:146:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;461:146:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;461:146:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;461:146:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;461:146:1;437:170;;617:12;635:10;617:29;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;617:29:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;703:4;661:47;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;661:47:1;;;;;;;;;;;;;;;;690:10;661:47;;;;;;;;;;;;210:505;;;;;;;:::o;63:1035::-;;;;;;;;:::o", "source": "pragma solidity >0.4.23 <0.7.0;\n\n import \"./Fundraiser.sol\";\n\n contract Factory {\n\n Fundraiser[] private _fundraisers;\n event LogFundraiserCreated(address indexed fundraiser, string indexed name);\n\n function createFundraiser(\n string memory name,\n string memory url,\n string memory imageURL,\n string memory bio,\n address payable beneficiary,\n address custodian\n ) public {\n Fundraiser fundraiser = new Fundraiser(\n name,\n url,\n imageURL,\n bio,\n beneficiary,\n custodian\n );\n _fundraisers.push(fundraiser);\n emit LogFundraiserCreated(address(fundraiser), name);\n }\n\n function fundraisersCount() public view returns(uint256) {\n return _fundraisers.length;\n }\n\n function fundraisers() public view returns(Fundraiser[] memory fs) {\n uint256 count = fundraisersCount();\n fs = new Fundraiser[](count);\n for(uint256 i = 0; i < count; i++) {\n fs[i] = _fundraisers[i];\n }\n return fs;\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Factory.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Factory.sol", "exportedSymbols": { "Factory": [ 215 ] }, "id": 216, "nodeType": "SourceUnit", "nodes": [ { "id": 112, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:1" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol", "file": "./Fundraiser.sol", "id": 113, "nodeType": "ImportDirective", "scope": 216, "sourceUnit": 520, "src": "34:26:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [ 519 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 215, "linearizedBaseContracts": [ 215 ], "name": "Factory", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 116, "name": "_fundraisers", "nodeType": "VariableDeclaration", "scope": 215, "src": "88:33:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 114, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "88:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 115, "length": null, "nodeType": "ArrayTypeName", "src": "88:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 122, "name": "LogFundraiserCreated", "nodeType": "EventDefinition", "parameters": { "id": 121, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 118, "indexed": true, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 122, "src": "154:26:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 117, "name": "address", "nodeType": "ElementaryTypeName", "src": "154:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 120, "indexed": true, "name": "name", "nodeType": "VariableDeclaration", "scope": 122, "src": "182:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 119, "name": "string", "nodeType": "ElementaryTypeName", "src": "182:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "153:49:1" }, "src": "127:76:1" }, { "body": { "id": 162, "nodeType": "Block", "src": "427:288:1", "statements": [ { "assignments": [ 138 ], "declarations": [ { "constant": false, "id": 138, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 162, "src": "437:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 137, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "437:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" } ], "id": 148, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 141, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 124, "src": "489:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 142, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 126, "src": "507:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 143, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 128, "src": "524:8:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 144, "name": "bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 130, "src": "546:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 145, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 132, "src": "563:11:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 146, "name": "custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "588:9:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 140, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "NewExpression", "src": "461:14:1", "typeDescriptions": { "typeIdentifier": "t_function_creation_nonpayable$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_address_payable_$_t_address_$returns$_t_contract$_Fundraiser_$519_$", "typeString": "function (string memory,string memory,string memory,string memory,address payable,address) returns (contract Fundraiser)" }, "typeName": { "contractScope": null, "id": 139, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "465:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } }, "id": 147, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "461:146:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "nodeType": "VariableDeclarationStatement", "src": "437:170:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 152, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 138, "src": "635:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "expression": { "argumentTypes": null, "id": 149, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "617:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 151, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "617:17:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_contract$_Fundraiser_$519_$returns$_t_uint256_$", "typeString": "function (contract Fundraiser) returns (uint256)" } }, "id": 153, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "617:29:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 154, "nodeType": "ExpressionStatement", "src": "617:29:1" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 157, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 138, "src": "690:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "id": 156, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "682:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 158, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "682:19:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 159, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 124, "src": "703:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 155, "name": "LogFundraiserCreated", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 122, "src": "661:20:1", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 160, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "661:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 161, "nodeType": "EmitStatement", "src": "656:52:1" } ] }, "documentation": null, "id": 163, "implemented": true, "kind": "function", "modifiers": [], "name": "createFundraiser", "nodeType": "FunctionDefinition", "parameters": { "id": 135, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 124, "name": "name", "nodeType": "VariableDeclaration", "scope": 163, "src": "245:18:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 123, "name": "string", "nodeType": "ElementaryTypeName", "src": "245:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 126, "name": "url", "nodeType": "VariableDeclaration", "scope": 163, "src": "273:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 125, "name": "string", "nodeType": "ElementaryTypeName", "src": "273:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 128, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 163, "src": "300:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 127, "name": "string", "nodeType": "ElementaryTypeName", "src": "300:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 130, "name": "bio", "nodeType": "VariableDeclaration", "scope": 163, "src": "332:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 129, "name": "string", "nodeType": "ElementaryTypeName", "src": "332:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 132, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 163, "src": "359:27:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 131, "name": "address", "nodeType": "ElementaryTypeName", "src": "359:15:1", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 134, "name": "custodian", "nodeType": "VariableDeclaration", "scope": 163, "src": "396:17:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 133, "name": "address", "nodeType": "ElementaryTypeName", "src": "396:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "235:184:1" }, "returnParameters": { "id": 136, "nodeType": "ParameterList", "parameters": [], "src": "427:0:1" }, "scope": 215, "src": "210:505:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 171, "nodeType": "Block", "src": "779:43:1", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 168, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "796:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 169, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "796:19:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 167, "id": 170, "nodeType": "Return", "src": "789:26:1" } ] }, "documentation": null, "id": 172, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisersCount", "nodeType": "FunctionDefinition", "parameters": { "id": 164, "nodeType": "ParameterList", "parameters": [], "src": "747:2:1" }, "returnParameters": { "id": 167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 166, "name": "", "nodeType": "VariableDeclaration", "scope": 172, "src": "770:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "770:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "769:9:1" }, "scope": 215, "src": "722:100:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 213, "nodeType": "Block", "src": "896:200:1", "statements": [ { "assignments": [ 179 ], "declarations": [ { "constant": false, "id": 179, "name": "count", "nodeType": "VariableDeclaration", "scope": 213, "src": "906:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 178, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "906:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 182, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 180, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 172, "src": "922:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "922:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "906:34:1" }, { "expression": { "argumentTypes": null, "id": 189, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 183, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "950:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 187, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 179, "src": "972:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 186, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "955:16:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_contract$_Fundraiser_$519_$dyn_memory_$", "typeString": "function (uint256) pure returns (contract Fundraiser[] memory)" }, "typeName": { "baseType": { "contractScope": null, "id": 184, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "959:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 185, "length": null, "nodeType": "ArrayTypeName", "src": "959:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } } }, "id": 188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "955:23:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory", "typeString": "contract Fundraiser[] memory" } }, "src": "950:28:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 190, "nodeType": "ExpressionStatement", "src": "950:28:1" }, { "body": { "id": 209, "nodeType": "Block", "src": "1023:48:1", "statements": [ { "expression": { "argumentTypes": null, "id": 207, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 201, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1037:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 203, "indexExpression": { "argumentTypes": null, "id": 202, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1040:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1037:5:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 204, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "1045:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 206, "indexExpression": { "argumentTypes": null, "id": 205, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1058:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1045:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "src": "1037:23:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 208, "nodeType": "ExpressionStatement", "src": "1037:23:1" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 197, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 195, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1007:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 196, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 179, "src": "1011:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1007:9:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 210, "initializationExpression": { "assignments": [ 192 ], "declarations": [ { "constant": false, "id": 192, "name": "i", "nodeType": "VariableDeclaration", "scope": 210, "src": "992:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 191, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "992:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 194, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 193, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1004:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "992:13:1" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1018:3:1", "subExpression": { "argumentTypes": null, "id": 198, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1018:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 200, "nodeType": "ExpressionStatement", "src": "1018:3:1" }, "nodeType": "ForStatement", "src": "988:83:1" }, { "expression": { "argumentTypes": null, "id": 211, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1087:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "functionReturnParameters": 177, "id": 212, "nodeType": "Return", "src": "1080:9:1" } ] }, "documentation": null, "id": 214, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisers", "nodeType": "FunctionDefinition", "parameters": { "id": 173, "nodeType": "ParameterList", "parameters": [], "src": "849:2:1" }, "returnParameters": { "id": 177, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 176, "name": "fs", "nodeType": "VariableDeclaration", "scope": 214, "src": "872:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 174, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "872:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 175, "length": null, "nodeType": "ArrayTypeName", "src": "872:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "internal" } ], "src": "871:24:1" }, "scope": 215, "src": "829:267:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 216, "src": "63:1035:1" } ], "src": "0:1099:1" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Factory.sol", "exportedSymbols": { "Factory": [ 215 ] }, "id": 216, "nodeType": "SourceUnit", "nodes": [ { "id": 112, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:1" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol", "file": "./Fundraiser.sol", "id": 113, "nodeType": "ImportDirective", "scope": 216, "sourceUnit": 520, "src": "34:26:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [ 519 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 215, "linearizedBaseContracts": [ 215 ], "name": "Factory", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 116, "name": "_fundraisers", "nodeType": "VariableDeclaration", "scope": 215, "src": "88:33:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 114, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "88:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 115, "length": null, "nodeType": "ArrayTypeName", "src": "88:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 122, "name": "LogFundraiserCreated", "nodeType": "EventDefinition", "parameters": { "id": 121, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 118, "indexed": true, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 122, "src": "154:26:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 117, "name": "address", "nodeType": "ElementaryTypeName", "src": "154:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 120, "indexed": true, "name": "name", "nodeType": "VariableDeclaration", "scope": 122, "src": "182:19:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 119, "name": "string", "nodeType": "ElementaryTypeName", "src": "182:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "153:49:1" }, "src": "127:76:1" }, { "body": { "id": 162, "nodeType": "Block", "src": "427:288:1", "statements": [ { "assignments": [ 138 ], "declarations": [ { "constant": false, "id": 138, "name": "fundraiser", "nodeType": "VariableDeclaration", "scope": 162, "src": "437:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" }, "typeName": { "contractScope": null, "id": 137, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "437:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "value": null, "visibility": "internal" } ], "id": 148, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 141, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 124, "src": "489:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 142, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 126, "src": "507:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 143, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 128, "src": "524:8:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 144, "name": "bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 130, "src": "546:3:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, { "argumentTypes": null, "id": 145, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 132, "src": "563:11:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 146, "name": "custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 134, "src": "588:9:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" }, { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 140, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "NewExpression", "src": "461:14:1", "typeDescriptions": { "typeIdentifier": "t_function_creation_nonpayable$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_address_payable_$_t_address_$returns$_t_contract$_Fundraiser_$519_$", "typeString": "function (string memory,string memory,string memory,string memory,address payable,address) returns (contract Fundraiser)" }, "typeName": { "contractScope": null, "id": 139, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "465:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } }, "id": 147, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "461:146:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "nodeType": "VariableDeclarationStatement", "src": "437:170:1" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 152, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 138, "src": "635:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "expression": { "argumentTypes": null, "id": 149, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "617:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 151, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "617:17:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_contract$_Fundraiser_$519_$returns$_t_uint256_$", "typeString": "function (contract Fundraiser) returns (uint256)" } }, "id": 153, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "617:29:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 154, "nodeType": "ExpressionStatement", "src": "617:29:1" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 157, "name": "fundraiser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 138, "src": "690:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "id": 156, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "682:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 158, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "682:19:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 159, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 124, "src": "703:4:1", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } ], "id": 155, "name": "LogFundraiserCreated", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 122, "src": "661:20:1", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_string_memory_ptr_$returns$__$", "typeString": "function (address,string memory)" } }, "id": 160, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "661:47:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 161, "nodeType": "EmitStatement", "src": "656:52:1" } ] }, "documentation": null, "id": 163, "implemented": true, "kind": "function", "modifiers": [], "name": "createFundraiser", "nodeType": "FunctionDefinition", "parameters": { "id": 135, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 124, "name": "name", "nodeType": "VariableDeclaration", "scope": 163, "src": "245:18:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 123, "name": "string", "nodeType": "ElementaryTypeName", "src": "245:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 126, "name": "url", "nodeType": "VariableDeclaration", "scope": 163, "src": "273:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 125, "name": "string", "nodeType": "ElementaryTypeName", "src": "273:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 128, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 163, "src": "300:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 127, "name": "string", "nodeType": "ElementaryTypeName", "src": "300:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 130, "name": "bio", "nodeType": "VariableDeclaration", "scope": 163, "src": "332:17:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 129, "name": "string", "nodeType": "ElementaryTypeName", "src": "332:6:1", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 132, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 163, "src": "359:27:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 131, "name": "address", "nodeType": "ElementaryTypeName", "src": "359:15:1", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 134, "name": "custodian", "nodeType": "VariableDeclaration", "scope": 163, "src": "396:17:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 133, "name": "address", "nodeType": "ElementaryTypeName", "src": "396:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "235:184:1" }, "returnParameters": { "id": 136, "nodeType": "ParameterList", "parameters": [], "src": "427:0:1" }, "scope": 215, "src": "210:505:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 171, "nodeType": "Block", "src": "779:43:1", "statements": [ { "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 168, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "796:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 169, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "796:19:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 167, "id": 170, "nodeType": "Return", "src": "789:26:1" } ] }, "documentation": null, "id": 172, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisersCount", "nodeType": "FunctionDefinition", "parameters": { "id": 164, "nodeType": "ParameterList", "parameters": [], "src": "747:2:1" }, "returnParameters": { "id": 167, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 166, "name": "", "nodeType": "VariableDeclaration", "scope": 172, "src": "770:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 165, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "770:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "769:9:1" }, "scope": 215, "src": "722:100:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 213, "nodeType": "Block", "src": "896:200:1", "statements": [ { "assignments": [ 179 ], "declarations": [ { "constant": false, "id": 179, "name": "count", "nodeType": "VariableDeclaration", "scope": 213, "src": "906:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 178, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "906:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 182, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 180, "name": "fundraisersCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 172, "src": "922:16:1", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", "typeString": "function () view returns (uint256)" } }, "id": 181, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "922:18:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "906:34:1" }, { "expression": { "argumentTypes": null, "id": 189, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 183, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "950:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 187, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 179, "src": "972:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 186, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "955:16:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_contract$_Fundraiser_$519_$dyn_memory_$", "typeString": "function (uint256) pure returns (contract Fundraiser[] memory)" }, "typeName": { "baseType": { "contractScope": null, "id": 184, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "959:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 185, "length": null, "nodeType": "ArrayTypeName", "src": "959:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } } }, "id": 188, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "955:23:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory", "typeString": "contract Fundraiser[] memory" } }, "src": "950:28:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 190, "nodeType": "ExpressionStatement", "src": "950:28:1" }, { "body": { "id": 209, "nodeType": "Block", "src": "1023:48:1", "statements": [ { "expression": { "argumentTypes": null, "id": 207, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 201, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1037:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "id": 203, "indexExpression": { "argumentTypes": null, "id": 202, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1040:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1037:5:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 204, "name": "_fundraisers", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 116, "src": "1045:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage", "typeString": "contract Fundraiser[] storage ref" } }, "id": 206, "indexExpression": { "argumentTypes": null, "id": 205, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1058:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1045:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "src": "1037:23:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 208, "nodeType": "ExpressionStatement", "src": "1037:23:1" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 197, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 195, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1007:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 196, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 179, "src": "1011:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1007:9:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 210, "initializationExpression": { "assignments": [ 192 ], "declarations": [ { "constant": false, "id": 192, "name": "i", "nodeType": "VariableDeclaration", "scope": 210, "src": "992:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 191, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "992:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 194, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 193, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1004:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "992:13:1" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1018:3:1", "subExpression": { "argumentTypes": null, "id": 198, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 192, "src": "1018:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 200, "nodeType": "ExpressionStatement", "src": "1018:3:1" }, "nodeType": "ForStatement", "src": "988:83:1" }, { "expression": { "argumentTypes": null, "id": 211, "name": "fs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 176, "src": "1087:2:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[] memory" } }, "functionReturnParameters": 177, "id": 212, "nodeType": "Return", "src": "1080:9:1" } ] }, "documentation": null, "id": 214, "implemented": true, "kind": "function", "modifiers": [], "name": "fundraisers", "nodeType": "FunctionDefinition", "parameters": { "id": 173, "nodeType": "ParameterList", "parameters": [], "src": "849:2:1" }, "returnParameters": { "id": 177, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 176, "name": "fs", "nodeType": "VariableDeclaration", "scope": 214, "src": "872:22:1", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_memory_ptr", "typeString": "contract Fundraiser[]" }, "typeName": { "baseType": { "contractScope": null, "id": 174, "name": "Fundraiser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 519, "src": "872:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } }, "id": 175, "length": null, "nodeType": "ArrayTypeName", "src": "872:12:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Fundraiser_$519_$dyn_storage_ptr", "typeString": "contract Fundraiser[]" } }, "value": null, "visibility": "internal" } ], "src": "871:24:1" }, "scope": 215, "src": "829:267:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 216, "src": "63:1035:1" } ], "src": "0:1099:1" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, "address": "0xB7780C9AD3ef38bb4C8B48fab37Ef176603E7787", "transactionHash": "0x0e704cf19ff80ab5fcc06a4c74087f06fd0363f9120963048b05f67a9b0d7c95" } }, "schemaVersion": "3.0.10", "updatedAt": "2019-09-02T16:31:37.475Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-9/src/contracts/Fundraiser.json ================================================ { "contractName": "Fundraiser", "abi": [ { "constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "isOwner", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "name": "name", "type": "string" }, { "name": "url", "type": "string" }, { "name": "imageURL", "type": "string" }, { "name": "bio", "type": "string" }, { "name": "beneficiary", "type": "address" }, { "name": "custodian", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "from", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }, { "indexed": false, "name": "date", "type": "uint256" } ], "name": "LogDonationReceived", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "LogWithdraw", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "previousOwner", "type": "address" }, { "indexed": true, "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "beneficiary", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "url", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "imageURL", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "bio", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalDonations", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "conversionFactor", "type": "uint256" } ], "name": "donate", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [], "name": "donationsCount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "myDonations", "outputs": [ { "name": "values", "type": "uint256[]" }, { "name": "dates", "type": "uint256[]" }, { "name": "conversionFactors", "type": "uint256[]" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"myDonations\",\"outputs\":[{\"name\":\"values\",\"type\":\"uint256[]\"},{\"name\":\"dates\",\"type\":\"uint256[]\"},{\"name\":\"conversionFactors\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"donationsCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"beneficiary\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"url\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"imageURL\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalDonations\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"conversionFactor\",\"type\":\"uint256\"}],\"name\":\"donate\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"bio\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"imageURL\",\"type\":\"string\"},{\"name\":\"bio\",\"type\":\"string\"},{\"name\":\"beneficiary\",\"type\":\"address\"},{\"name\":\"custodian\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"date\",\"type\":\"uint256\"}],\"name\":\"LogDonationReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"LogWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"isOwner()\":{\"details\":\"Returns true if the caller is the current owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol\":\"Fundraiser\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xf79fb10e8235770eb4aea7249034076a3cc9f9119ad944fc48705bae9c9d20dc\",\"urls\":[\"bzzr://d12a11272051eb6586de8f7e0a82c04a98c9984ce8b2a6cf1ee439f65aba29a9\"]},\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol\":{\"keccak256\":\"0x19055c641f5ff96a84149a81b8950c1387518095d8ce4451b951bc03d46d5c20\",\"urls\":[\"bzzr://2b8f024402ccb06c57f6a57a77f446a65b4a98be633351a4aa39aacd8c00a355\"]}},\"version\":1}", "bytecode": "0x6080604052600060065560006007553480156200001b57600080fd5b50604051620016f6380380620016f6833981018060405260c08110156200004157600080fd5b8101908080516401000000008111156200005a57600080fd5b828101905060208101848111156200007157600080fd5b81518560018202830111640100000000821117156200008f57600080fd5b50509291906020018051640100000000811115620000ac57600080fd5b82810190506020810184811115620000c357600080fd5b8151856001820283011164010000000082111715620000e157600080fd5b50509291906020018051640100000000811115620000fe57600080fd5b828101905060208101848111156200011557600080fd5b81518560018202830111640100000000821117156200013357600080fd5b505092919060200180516401000000008111156200015057600080fd5b828101905060208101848111156200016757600080fd5b81518560018202830111640100000000821117156200018557600080fd5b50509291906020018051906020019092919080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a385600190805190602001906200027892919062000468565b5084600290805190602001906200029192919062000468565b508360039080519060200190620002aa92919062000468565b508260049080519060200190620002c392919062000468565b5081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000316816200032260201b60201c565b50505050505062000517565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415620003aa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180620016d06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004ab57805160ff1916838001178555620004dc565b82800160010185558215620004dc579182015b82811115620004db578251825591602001919060010190620004be565b5b509050620004eb9190620004ef565b5090565b6200051491905b8082111562000510576000816000905550600101620004f6565b5090565b90565b6111a980620005276000396000f3fe6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063de2ed89311610059578063de2ed893146104c4578063f14faf6f146104ef578063f2fde38b1461051d578063f516b4221461056e576100dd565b80638da5cb5b146103ae5780638f32d59b14610405578063b90497e014610434576100dd565b806338af3eed116100bb57806338af3eed146102995780633ccfd60b146102f05780635600f04f14610307578063715018a614610397576100dd565b806306fdde03146100e25780631a57f7b4146101725780631f5225951461026e575b600080fd5b3480156100ee57600080fd5b506100f76105fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017e57600080fd5b506101876106a0565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156101d25780820151818401526020810190506101b7565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102145780820151818401526020810190506101f9565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561025657808201518184015260208101905061023b565b50505050905001965050505050505060405180910390f35b34801561027a57600080fd5b50610283610909565b6040518082815260200191505060405180910390f35b3480156102a557600080fd5b506102ae610913565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061030561093d565b005b34801561031357600080fd5b5061031c610a76565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103a357600080fd5b506103ac610b18565b005b3480156103ba57600080fd5b506103c3610c51565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041157600080fd5b5061041a610c7a565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610449610cd1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048957808201518184015260208101905061046e565b50505050905090810190601f1680156104b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104d057600080fd5b506104d9610d73565b6040518082815260200191505060405180910390f35b61051b6004803603602081101561050557600080fd5b8101908080359060200190929190505050610d7d565b005b34801561052957600080fd5b5061056c6004803603602081101561054057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eca565b005b34801561057a57600080fd5b50610583610f50565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c35780820151818401526020810190506105a8565b50505050905090810190601f1680156105f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60608060606000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090508060405190808252806020026020018201604052801561071b5781602001602082028038833980820191505090505b5093508060405190808252806020026020018201604052801561074d5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561077f5781602001602082028038833980820191505090505b50915060008090505b818110156108f957600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106107da57fe5b9060005260206000209060030201600001548582815181106107f857fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811061084e57fe5b90600052602060002090600302016001015484828151811061086c57fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106108c257fe5b9060005260206000209060030201600201548382815181106108e057fe5b6020026020010181815250508080600101915050610788565b5083838393509350935050909192565b6000600754905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610945610c7a565b6109b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a3b573d6000803e3d6000fd5b507f879a83fc17750905b8aef4ef85e6701b84a50e15d4463dc3c2e7fb0f9dbcf75d816040518082815260200191505060405180910390a150565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b5050505050905090565b610b20610c7a565b610b92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d695780601f10610d3e57610100808354040283529160200191610d69565b820191906000526020600020905b815481529060010190602001808311610d4c57829003601f168201915b5050505050905090565b6000600654905090565b610d85611136565b6040518060600160405280348152602001428152602001838152509050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060030201600090919290919091506000820151816000015560208201518160010155604082015181600201555050503460066000828254019250508190555060016007600082825401925050819055507f8fa09d0d0409c35ef3a40d2e1f9f00512eedb373c85bd5b86177ba58c3a5a48e33348360200151604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050565b610ed2610c7a565b610f44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4d81610ff2565b50565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fe85780601f10610fbd57610100808354040283529160200191610fe8565b820191906000526020600020905b815481529060010190602001808311610fcb57829003601f168201915b5050505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611078576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111586026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060600160405280600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582012faf8a42a7625617a68d9b57f5b0b15d50babba6dbac248b2b4f6c83200a4a100294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373", "deployedBytecode": "0x6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063de2ed89311610059578063de2ed893146104c4578063f14faf6f146104ef578063f2fde38b1461051d578063f516b4221461056e576100dd565b80638da5cb5b146103ae5780638f32d59b14610405578063b90497e014610434576100dd565b806338af3eed116100bb57806338af3eed146102995780633ccfd60b146102f05780635600f04f14610307578063715018a614610397576100dd565b806306fdde03146100e25780631a57f7b4146101725780631f5225951461026e575b600080fd5b3480156100ee57600080fd5b506100f76105fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017e57600080fd5b506101876106a0565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156101d25780820151818401526020810190506101b7565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156102145780820151818401526020810190506101f9565b50505050905001848103825285818151815260200191508051906020019060200280838360005b8381101561025657808201518184015260208101905061023b565b50505050905001965050505050505060405180910390f35b34801561027a57600080fd5b50610283610909565b6040518082815260200191505060405180910390f35b3480156102a557600080fd5b506102ae610913565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061030561093d565b005b34801561031357600080fd5b5061031c610a76565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103a357600080fd5b506103ac610b18565b005b3480156103ba57600080fd5b506103c3610c51565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041157600080fd5b5061041a610c7a565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610449610cd1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048957808201518184015260208101905061046e565b50505050905090810190601f1680156104b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104d057600080fd5b506104d9610d73565b6040518082815260200191505060405180910390f35b61051b6004803603602081101561050557600080fd5b8101908080359060200190929190505050610d7d565b005b34801561052957600080fd5b5061056c6004803603602081101561054057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eca565b005b34801561057a57600080fd5b50610583610f50565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c35780820151818401526020810190506105a8565b50505050905090810190601f1680156105f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60608060606000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090508060405190808252806020026020018201604052801561071b5781602001602082028038833980820191505090505b5093508060405190808252806020026020018201604052801561074d5781602001602082028038833980820191505090505b5092508060405190808252806020026020018201604052801561077f5781602001602082028038833980820191505090505b50915060008090505b818110156108f957600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106107da57fe5b9060005260206000209060030201600001548582815181106107f857fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811061084e57fe5b90600052602060002090600302016001015484828151811061086c57fe5b602002602001018181525050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106108c257fe5b9060005260206000209060030201600201548382815181106108e057fe5b6020026020010181815250508080600101915050610788565b5083838393509350935050909192565b6000600754905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610945610c7a565b6109b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff16319050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a3b573d6000803e3d6000fd5b507f879a83fc17750905b8aef4ef85e6701b84a50e15d4463dc3c2e7fb0f9dbcf75d816040518082815260200191505060405180910390a150565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0e5780601f10610ae357610100808354040283529160200191610b0e565b820191906000526020600020905b815481529060010190602001808311610af157829003601f168201915b5050505050905090565b610b20610c7a565b610b92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d695780601f10610d3e57610100808354040283529160200191610d69565b820191906000526020600020905b815481529060010190602001808311610d4c57829003601f168201915b5050505050905090565b6000600654905090565b610d85611136565b6040518060600160405280348152602001428152602001838152509050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000209060030201600090919290919091506000820151816000015560208201518160010155604082015181600201555050503460066000828254019250508190555060016007600082825401925050819055507f8fa09d0d0409c35ef3a40d2e1f9f00512eedb373c85bd5b86177ba58c3a5a48e33348360200151604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050565b610ed2610c7a565b610f44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4d81610ff2565b50565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fe85780601f10610fbd57610100808354040283529160200191610fe8565b820191906000526020600020905b815481529060010190602001808311610fcb57829003601f168201915b5050505050905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611078576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806111586026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060600160405280600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a165627a7a7230582012faf8a42a7625617a68d9b57f5b0b15d50babba6dbac248b2b4f6c83200a4a10029", "sourceMap": "115:2820:2:-;;;330:1;296:35;;371:1;337:35;;656:373;8:9:-1;5:2;;;30:1;27;20:12;5:2;656:373:2;;;;;;;;;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;656:373:2;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;656:373:2;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;656:373:2;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;656:373:2;;;;;;;19:11:-1;14:3;11:20;8:2;;;44:1;41;34:12;8:2;71:11;66:3;62:21;55:28;;123:4;118:3;114:14;159:9;141:16;138:31;135:2;;;182:1;179;172:12;135:2;219:3;213:10;330:9;325:1;311:12;307:20;289:16;285:43;282:58;261:11;247:12;244:29;233:115;230:2;;;361:1;358;351:12;230:2;0:372;;656:373:2;;;;;;;;;;;;;;;;;;;;;;;;;;666:10:0;657:6;;:19;;;;;;;;;;;;;;;;;;724:6;;;;;;;;;;;691:40;;720:1;691:40;;;;;;;;;;;;872:4:2;864:5;:12;;;;;;;;;;;;:::i;:::-;;893:3;886:4;:10;;;;;;;;;;;;:::i;:::-;;918:8;906:9;:20;;;;;;;;;;;;:::i;:::-;;942:3;936:4;:9;;;;;;;;;;;;:::i;:::-;;970:11;955:12;;:26;;;;;;;;;;;;;;;;;;993:29;1012:9;993:18;;;:29;;:::i;:::-;656:373;;;;;;115:2820;;2093:225:0;2186:1;2166:22;;:8;:22;;;;2158:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2275:8;2246:38;;2267:6;;;;;;;;;;;2246:38;;;;;;;;;;;;2303:8;2294:6;;:17;;;;;;;;;;;;;;;;;;2093:225;:::o;115:2820:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;", "deployedSourceMap": "115:2820:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1036:80;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1036:80:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1036:80:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2113:645;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2113:645:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2113:645:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2113:645:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2113:645:2;;;;;;;;;;;;;;;;;;;;;2012:94;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2012:94:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1123:96;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1123:96:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2765:168;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2765:168:2;;;:::i;:::-;;1226:78;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1226:78:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1226:78:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1599:137:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1599:137:0;;;:::i;:::-;;814:77;;8:9:-1;5:2;;;30:1;27;20:12;5:2;814:77:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1165:90;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1165:90:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1311:88:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1311:88:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1311:88:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1491:94;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1491:94:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1592:413;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1592:413:2;;;;;;;;;;;;;;;;;:::i;:::-;;1885:107:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1885:107:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1885:107:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1406:78:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1406:78:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1406:78:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1036:80;1072:13;1104:5;1097:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1036:80;:::o;2113:645::-;2165:23;2198:22;2230:34;2280:13;2296:10;:22;2307:10;2296:22;;;;;;;;;;;;;;;:29;;;;2280:45;;2358:5;2344:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;2344:20:2;;;;2335:29;;2396:5;2382:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;2382:20:2;;;;2374:28;;2446:5;2432:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;2432:20:2;;;;2412:40;;2468:9;2480:1;2468:13;;2464:237;2487:5;2483:1;:9;2464:237;;;2525:10;:22;2536:10;2525:22;;;;;;;;;;;;;;;2548:1;2525:25;;;;;;;;;;;;;;;;;;:31;;;2513:6;2520:1;2513:9;;;;;;;;;;;;;:43;;;;;2581:10;:22;2592:10;2581:22;;;;;;;;;;;;;;;2604:1;2581:25;;;;;;;;;;;;;;;;;;:30;;;2570:5;2576:1;2570:8;;;;;;;;;;;;;:41;;;;;2648:10;:22;2659:10;2648:22;;;;;;;;;;;;;;;2671:1;2648:25;;;;;;;;;;;;;;;;;;:42;;;2625:17;2643:1;2625:20;;;;;;;;;;;;;:65;;;;;2494:3;;;;;;;2464:237;;;;2718:6;2726:5;2733:17;2710:41;;;;;;;2113:645;;;:::o;2012:94::-;2058:7;2084:15;;2077:22;;2012:94;:::o;1123:96::-;1166:15;1200:12;;;;;;;;;;;1193:19;;1123:96;:::o;2765:168::-;1018:9:0;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2812:15:2;2838:4;2830:21;;;2812:39;;2861:12;;;;;;;;;;;:21;;:30;2883:7;2861:30;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2861:30:2;2906:20;2918:7;2906:20;;;;;;;;;;;;;;;;;;1074:1:0;2765:168:2:o;1226:78::-;1261:13;1293:4;1286:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1226:78;:::o;1599:137:0:-;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1697:1;1660:40;;1681:6;;;;;;;;;;;1660:40;;;;;;;;;;;;1727:1;1710:6;;:19;;;;;;;;;;;;;;;;;;1599:137::o;814:77::-;852:7;878:6;;;;;;;;;;;871:13;;814:77;:::o;1165:90::-;1205:4;1242:6;;;;;;;;;;;1228:20;;:10;:20;;;1221:27;;1165:90;:::o;1311:88:2:-;1351:13;1383:9;1376:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1311:88;:::o;1491:94::-;1537:7;1563:15;;1556:22;;1491:94;:::o;1592:413::-;1659:24;;:::i;:::-;1686:121;;;;;;;;1716:9;1686:121;;;;1793:3;1686:121;;;;1757:16;1686:121;;;1659:148;;1819:10;:22;1830:10;1819:22;;;;;;;;;;;;;;;1847:8;1819:37;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1819:37:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1885:9;1866:15;;:28;;;;;;;;;;;1923:1;1904:15;;:20;;;;;;;;;;;1941:57;1961:10;1973:9;1984:8;:13;;;1941:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1592:413;;:::o;1885:107:0:-;1018:9;:7;:9::i;:::-;1010:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1957:28;1976:8;1957:18;:28::i;:::-;1885:107;:::o;1406:78:2:-;1441:13;1473:4;1466:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1406:78;:::o;2093:225:0:-;2186:1;2166:22;;:8;:22;;;;2158:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2275:8;2246:38;;2267:6;;;;;;;;;;;2246:38;;;;;;;;;;;;2303:8;2294:6;;:17;;;;;;;;;;;;;;;;;;2093:225;:::o;115:2820:2:-;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity >0.4.23 <0.7.0;\n\n import '../client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol';\n\n contract Fundraiser is Ownable {\n string private _name;\n string private _url;\n string private _imageURL;\n string private _bio;\n\n address payable _beneficiary;\n\n uint256 private _totalDonations = 0;\n uint256 private _donationsCount = 0;\n\n struct Donation {\n uint256 value;\n uint256 date;\n uint256 conversionFactor;\n }\n event LogDonationReceived(address from, uint256 value, uint256 date);\n mapping(address => Donation[]) private _donations;\n\n event LogWithdraw(uint amount);\n\n constructor(\n string memory name,\n string memory url,\n string memory imageURL,\n string memory bio,\n address payable beneficiary,\n address custodian) public {\n _name = name;\n _url = url;\n _imageURL = imageURL;\n _bio= bio;\n _beneficiary = beneficiary;\n\n _transferOwnership(custodian);\n }\n\n function name() public view returns(string memory) {\n return _name;\n }\n\n function beneficiary() public view returns(address payable) {\n return _beneficiary;\n }\n\n function url() public view returns(string memory) {\n return _url;\n }\n\n function imageURL() public view returns(string memory) {\n return _imageURL;\n }\n\n function bio() public view returns(string memory) {\n return _bio;\n }\n\n function totalDonations() public view returns(uint256) {\n return _totalDonations;\n }\n\n function donate(uint256 conversionFactor) public payable {\n Donation memory donation = Donation({\n value: msg.value,\n conversionFactor: conversionFactor,\n date: now\n });\n\n _donations[msg.sender].push(donation);\n _totalDonations += msg.value;\n _donationsCount += 1;\n\n emit LogDonationReceived(msg.sender, msg.value, donation.date);\n }\n\n function donationsCount() public view returns(uint256) {\n return _donationsCount;\n }\n\n function myDonations() public view returns(\n uint256[] memory values,\n uint256[] memory dates,\n uint256[] memory conversionFactors)\n {\n uint256 count = _donations[msg.sender].length;\n values = new uint256[](count);\n dates = new uint256[](count);\n conversionFactors = new uint256[](count);\n\n for(uint256 i = 0; i < count; i++) {\n values[i] = _donations[msg.sender][i].value;\n dates[i] = _donations[msg.sender][i].date;\n conversionFactors[i] = _donations[msg.sender][i].conversionFactor;\n }\n return (values, dates, conversionFactors);\n }\n\n function withdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n _beneficiary.transfer(balance);\n emit LogWithdraw(balance);\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol", "exportedSymbols": { "Fundraiser": [ 519 ] }, "id": 520, "nodeType": "SourceUnit", "nodes": [ { "id": 217, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:2" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol", "file": "../client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol", "id": 218, "nodeType": "ImportDirective", "scope": 520, "sourceUnit": 111, "src": "34:78:2", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 219, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 110, "src": "138:7:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$110", "typeString": "contract Ownable" } }, "id": 220, "nodeType": "InheritanceSpecifier", "src": "138:7:2" } ], "contractDependencies": [ 110 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 519, "linearizedBaseContracts": [ 519, 110 ], "name": "Fundraiser", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 222, "name": "_name", "nodeType": "VariableDeclaration", "scope": 519, "src": "152:20:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 221, "name": "string", "nodeType": "ElementaryTypeName", "src": "152:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 224, "name": "_url", "nodeType": "VariableDeclaration", "scope": 519, "src": "178:19:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 223, "name": "string", "nodeType": "ElementaryTypeName", "src": "178:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 226, "name": "_imageURL", "nodeType": "VariableDeclaration", "scope": 519, "src": "203:24:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 225, "name": "string", "nodeType": "ElementaryTypeName", "src": "203:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 228, "name": "_bio", "nodeType": "VariableDeclaration", "scope": 519, "src": "233:19:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 227, "name": "string", "nodeType": "ElementaryTypeName", "src": "233:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 230, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 519, "src": "260:28:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 229, "name": "address", "nodeType": "ElementaryTypeName", "src": "260:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 233, "name": "_totalDonations", "nodeType": "VariableDeclaration", "scope": 519, "src": "296:35:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 231, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "296:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "30", "id": 232, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "330:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "visibility": "private" }, { "constant": false, "id": 236, "name": "_donationsCount", "nodeType": "VariableDeclaration", "scope": 519, "src": "337:35:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 234, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "337:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "30", "id": 235, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "371:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "visibility": "private" }, { "canonicalName": "Fundraiser.Donation", "id": 243, "members": [ { "constant": false, "id": 238, "name": "value", "nodeType": "VariableDeclaration", "scope": 243, "src": "406:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 237, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "406:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 240, "name": "date", "nodeType": "VariableDeclaration", "scope": 243, "src": "429:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 239, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "429:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 242, "name": "conversionFactor", "nodeType": "VariableDeclaration", "scope": 243, "src": "451:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 241, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "451:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Donation", "nodeType": "StructDefinition", "scope": 519, "src": "380:102:2", "visibility": "public" }, { "anonymous": false, "documentation": null, "id": 251, "name": "LogDonationReceived", "nodeType": "EventDefinition", "parameters": { "id": 250, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 245, "indexed": false, "name": "from", "nodeType": "VariableDeclaration", "scope": 251, "src": "513:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 244, "name": "address", "nodeType": "ElementaryTypeName", "src": "513:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 247, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 251, "src": "527:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 246, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "527:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 249, "indexed": false, "name": "date", "nodeType": "VariableDeclaration", "scope": 251, "src": "542:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 248, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "542:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "512:43:2" }, "src": "487:69:2" }, { "constant": false, "id": 256, "name": "_donations", "nodeType": "VariableDeclaration", "scope": 519, "src": "561:49:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "typeName": { "id": 255, "keyType": { "id": 252, "name": "address", "nodeType": "ElementaryTypeName", "src": "569:7:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "561:30:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "valueType": { "baseType": { "contractScope": null, "id": 253, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 243, "src": "580:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "id": 254, "length": null, "nodeType": "ArrayTypeName", "src": "580:10:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage_ptr", "typeString": "struct Fundraiser.Donation[]" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 260, "name": "LogWithdraw", "nodeType": "EventDefinition", "parameters": { "id": 259, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 258, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 260, "src": "636:11:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 257, "name": "uint", "nodeType": "ElementaryTypeName", "src": "636:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "635:13:2" }, "src": "618:31:2" }, { "body": { "id": 299, "nodeType": "Block", "src": "854:175:2", "statements": [ { "expression": { "argumentTypes": null, "id": 277, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 275, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 222, "src": "864:5:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 276, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 262, "src": "872:4:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "864:12:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 278, "nodeType": "ExpressionStatement", "src": "864:12:2" }, { "expression": { "argumentTypes": null, "id": 281, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 279, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224, "src": "886:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 280, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 264, "src": "893:3:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "886:10:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 282, "nodeType": "ExpressionStatement", "src": "886:10:2" }, { "expression": { "argumentTypes": null, "id": 285, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 283, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 226, "src": "906:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 284, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 266, "src": "918:8:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "906:20:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 286, "nodeType": "ExpressionStatement", "src": "906:20:2" }, { "expression": { "argumentTypes": null, "id": 289, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 287, "name": "_bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 228, "src": "936:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 288, "name": "bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 268, "src": "942:3:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "936:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 290, "nodeType": "ExpressionStatement", "src": "936:9:2" }, { "expression": { "argumentTypes": null, "id": 293, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 291, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "955:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 292, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 270, "src": "970:11:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "955:26:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 294, "nodeType": "ExpressionStatement", "src": "955:26:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 296, "name": "custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 272, "src": "1012:9:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 295, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 109, "src": "993:18:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 297, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "993:29:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 298, "nodeType": "ExpressionStatement", "src": "993:29:2" } ] }, "documentation": null, "id": 300, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 273, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 262, "name": "name", "nodeType": "VariableDeclaration", "scope": 300, "src": "677:18:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 261, "name": "string", "nodeType": "ElementaryTypeName", "src": "677:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 264, "name": "url", "nodeType": "VariableDeclaration", "scope": 300, "src": "705:17:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 263, "name": "string", "nodeType": "ElementaryTypeName", "src": "705:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 266, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 300, "src": "732:22:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 265, "name": "string", "nodeType": "ElementaryTypeName", "src": "732:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 268, "name": "bio", "nodeType": "VariableDeclaration", "scope": 300, "src": "764:17:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 267, "name": "string", "nodeType": "ElementaryTypeName", "src": "764:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 270, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 300, "src": "791:27:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 269, "name": "address", "nodeType": "ElementaryTypeName", "src": "791:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 272, "name": "custodian", "nodeType": "VariableDeclaration", "scope": 300, "src": "828:17:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 271, "name": "address", "nodeType": "ElementaryTypeName", "src": "828:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "667:179:2" }, "returnParameters": { "id": 274, "nodeType": "ParameterList", "parameters": [], "src": "854:0:2" }, "scope": 519, "src": "656:373:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 307, "nodeType": "Block", "src": "1087:29:2", "statements": [ { "expression": { "argumentTypes": null, "id": 305, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 222, "src": "1104:5:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 304, "id": 306, "nodeType": "Return", "src": "1097:12:2" } ] }, "documentation": null, "id": 308, "implemented": true, "kind": "function", "modifiers": [], "name": "name", "nodeType": "FunctionDefinition", "parameters": { "id": 301, "nodeType": "ParameterList", "parameters": [], "src": "1049:2:2" }, "returnParameters": { "id": 304, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 303, "name": "", "nodeType": "VariableDeclaration", "scope": 308, "src": "1072:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 302, "name": "string", "nodeType": "ElementaryTypeName", "src": "1072:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1071:15:2" }, "scope": 519, "src": "1036:80:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 315, "nodeType": "Block", "src": "1183:36:2", "statements": [ { "expression": { "argumentTypes": null, "id": 313, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "1200:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 312, "id": 314, "nodeType": "Return", "src": "1193:19:2" } ] }, "documentation": null, "id": 316, "implemented": true, "kind": "function", "modifiers": [], "name": "beneficiary", "nodeType": "FunctionDefinition", "parameters": { "id": 309, "nodeType": "ParameterList", "parameters": [], "src": "1143:2:2" }, "returnParameters": { "id": 312, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 311, "name": "", "nodeType": "VariableDeclaration", "scope": 316, "src": "1166:15:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 310, "name": "address", "nodeType": "ElementaryTypeName", "src": "1166:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "1165:17:2" }, "scope": 519, "src": "1123:96:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 323, "nodeType": "Block", "src": "1276:28:2", "statements": [ { "expression": { "argumentTypes": null, "id": 321, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224, "src": "1293:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 320, "id": 322, "nodeType": "Return", "src": "1286:11:2" } ] }, "documentation": null, "id": 324, "implemented": true, "kind": "function", "modifiers": [], "name": "url", "nodeType": "FunctionDefinition", "parameters": { "id": 317, "nodeType": "ParameterList", "parameters": [], "src": "1238:2:2" }, "returnParameters": { "id": 320, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 319, "name": "", "nodeType": "VariableDeclaration", "scope": 324, "src": "1261:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 318, "name": "string", "nodeType": "ElementaryTypeName", "src": "1261:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1260:15:2" }, "scope": 519, "src": "1226:78:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 331, "nodeType": "Block", "src": "1366:33:2", "statements": [ { "expression": { "argumentTypes": null, "id": 329, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 226, "src": "1383:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 328, "id": 330, "nodeType": "Return", "src": "1376:16:2" } ] }, "documentation": null, "id": 332, "implemented": true, "kind": "function", "modifiers": [], "name": "imageURL", "nodeType": "FunctionDefinition", "parameters": { "id": 325, "nodeType": "ParameterList", "parameters": [], "src": "1328:2:2" }, "returnParameters": { "id": 328, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 327, "name": "", "nodeType": "VariableDeclaration", "scope": 332, "src": "1351:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 326, "name": "string", "nodeType": "ElementaryTypeName", "src": "1351:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1350:15:2" }, "scope": 519, "src": "1311:88:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 339, "nodeType": "Block", "src": "1456:28:2", "statements": [ { "expression": { "argumentTypes": null, "id": 337, "name": "_bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 228, "src": "1473:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 336, "id": 338, "nodeType": "Return", "src": "1466:11:2" } ] }, "documentation": null, "id": 340, "implemented": true, "kind": "function", "modifiers": [], "name": "bio", "nodeType": "FunctionDefinition", "parameters": { "id": 333, "nodeType": "ParameterList", "parameters": [], "src": "1418:2:2" }, "returnParameters": { "id": 336, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 335, "name": "", "nodeType": "VariableDeclaration", "scope": 340, "src": "1441:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 334, "name": "string", "nodeType": "ElementaryTypeName", "src": "1441:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1440:15:2" }, "scope": 519, "src": "1406:78:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 347, "nodeType": "Block", "src": "1546:39:2", "statements": [ { "expression": { "argumentTypes": null, "id": 345, "name": "_totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 233, "src": "1563:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 344, "id": 346, "nodeType": "Return", "src": "1556:22:2" } ] }, "documentation": null, "id": 348, "implemented": true, "kind": "function", "modifiers": [], "name": "totalDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 341, "nodeType": "ParameterList", "parameters": [], "src": "1514:2:2" }, "returnParameters": { "id": 344, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 343, "name": "", "nodeType": "VariableDeclaration", "scope": 348, "src": "1537:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 342, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1537:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1536:9:2" }, "scope": 519, "src": "1491:94:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 388, "nodeType": "Block", "src": "1649:356:2", "statements": [ { "assignments": [ 354 ], "declarations": [ { "constant": false, "id": 354, "name": "donation", "nodeType": "VariableDeclaration", "scope": 388, "src": "1659:24:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 353, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 243, "src": "1659:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 361, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 356, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1716:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 357, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1716:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 358, "name": "conversionFactor", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 350, "src": "1757:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 359, "name": "now", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 616, "src": "1793:3:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 355, "name": "Donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 243, "src": "1686:8:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Donation_$243_storage_ptr_$", "typeString": "type(struct Fundraiser.Donation storage pointer)" } }, "id": 360, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value", "conversionFactor", "date" ], "nodeType": "FunctionCall", "src": "1686:121:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory", "typeString": "struct Fundraiser.Donation memory" } }, "nodeType": "VariableDeclarationStatement", "src": "1659:148:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 367, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 354, "src": "1847:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 362, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "1819:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 365, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 363, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1830:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 364, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1830:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1819:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 366, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1819:27:2", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_Donation_$243_storage_$returns$_t_uint256_$", "typeString": "function (struct Fundraiser.Donation storage ref) returns (uint256)" } }, "id": 368, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1819:37:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 369, "nodeType": "ExpressionStatement", "src": "1819:37:2" }, { "expression": { "argumentTypes": null, "id": 373, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 370, "name": "_totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 233, "src": "1866:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 371, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1885:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 372, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1885:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1866:28:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 374, "nodeType": "ExpressionStatement", "src": "1866:28:2" }, { "expression": { "argumentTypes": null, "id": 377, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 375, "name": "_donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 236, "src": "1904:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "hexValue": "31", "id": 376, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1923:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "1904:20:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 378, "nodeType": "ExpressionStatement", "src": "1904:20:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 380, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1961:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 381, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1961:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 382, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1973:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 383, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1973:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 384, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 354, "src": "1984:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } }, "id": 385, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 240, "src": "1984:13:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 379, "name": "LogDonationReceived", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 251, "src": "1941:19:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$_t_uint256_$returns$__$", "typeString": "function (address,uint256,uint256)" } }, "id": 386, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1941:57:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 387, "nodeType": "EmitStatement", "src": "1936:62:2" } ] }, "documentation": null, "id": 389, "implemented": true, "kind": "function", "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 351, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 350, "name": "conversionFactor", "nodeType": "VariableDeclaration", "scope": 389, "src": "1608:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 349, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1608:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1607:26:2" }, "returnParameters": { "id": 352, "nodeType": "ParameterList", "parameters": [], "src": "1649:0:2" }, "scope": 519, "src": "1592:413:2", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 396, "nodeType": "Block", "src": "2067:39:2", "statements": [ { "expression": { "argumentTypes": null, "id": 394, "name": "_donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 236, "src": "2084:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 393, "id": 395, "nodeType": "Return", "src": "2077:22:2" } ] }, "documentation": null, "id": 397, "implemented": true, "kind": "function", "modifiers": [], "name": "donationsCount", "nodeType": "FunctionDefinition", "parameters": { "id": 390, "nodeType": "ParameterList", "parameters": [], "src": "2035:2:2" }, "returnParameters": { "id": 393, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 392, "name": "", "nodeType": "VariableDeclaration", "scope": 397, "src": "2058:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 391, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2058:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2057:9:2" }, "scope": 519, "src": "2012:94:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 494, "nodeType": "Block", "src": "2270:488:2", "statements": [ { "assignments": [ 410 ], "declarations": [ { "constant": false, "id": 410, "name": "count", "nodeType": "VariableDeclaration", "scope": 494, "src": "2280:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 409, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2280:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 416, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 411, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2296:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 414, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 412, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2307:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 413, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2307:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2296:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 415, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2296:29:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2280:45:2" }, { "expression": { "argumentTypes": null, "id": 423, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 417, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2335:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 421, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2358:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 420, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2344:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 418, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2348:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 419, "length": null, "nodeType": "ArrayTypeName", "src": "2348:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 422, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2344:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2335:29:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 424, "nodeType": "ExpressionStatement", "src": "2335:29:2" }, { "expression": { "argumentTypes": null, "id": 431, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 425, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2374:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 429, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2396:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 428, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2382:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 426, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2386:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 427, "length": null, "nodeType": "ArrayTypeName", "src": "2386:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 430, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2382:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2374:28:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 432, "nodeType": "ExpressionStatement", "src": "2374:28:2" }, { "expression": { "argumentTypes": null, "id": 439, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 433, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2412:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 437, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2446:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 436, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2432:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 434, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2436:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 435, "length": null, "nodeType": "ArrayTypeName", "src": "2436:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 438, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2432:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2412:40:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 440, "nodeType": "ExpressionStatement", "src": "2412:40:2" }, { "body": { "id": 487, "nodeType": "Block", "src": "2499:202:2", "statements": [ { "expression": { "argumentTypes": null, "id": 461, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 451, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2513:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 453, "indexExpression": { "argumentTypes": null, "id": 452, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2520:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2513:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 454, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2525:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 457, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 455, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2536:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 456, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2536:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2525:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 459, "indexExpression": { "argumentTypes": null, "id": 458, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2548:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2525:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 460, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": 238, "src": "2525:31:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2513:43:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 462, "nodeType": "ExpressionStatement", "src": "2513:43:2" }, { "expression": { "argumentTypes": null, "id": 473, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 463, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2570:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 465, "indexExpression": { "argumentTypes": null, "id": 464, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2576:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2570:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 466, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2581:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 469, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 467, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2592:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 468, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2592:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2581:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 471, "indexExpression": { "argumentTypes": null, "id": 470, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2604:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2581:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 472, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 240, "src": "2581:30:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2570:41:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 474, "nodeType": "ExpressionStatement", "src": "2570:41:2" }, { "expression": { "argumentTypes": null, "id": 485, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 475, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2625:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 477, "indexExpression": { "argumentTypes": null, "id": 476, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2643:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2625:20:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 478, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2648:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 481, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 479, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2659:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 480, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2659:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2648:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 483, "indexExpression": { "argumentTypes": null, "id": 482, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2671:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2648:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 484, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "conversionFactor", "nodeType": "MemberAccess", "referencedDeclaration": 242, "src": "2648:42:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2625:65:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 486, "nodeType": "ExpressionStatement", "src": "2625:65:2" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 447, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 445, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2483:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 446, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2487:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2483:9:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 488, "initializationExpression": { "assignments": [ 442 ], "declarations": [ { "constant": false, "id": 442, "name": "i", "nodeType": "VariableDeclaration", "scope": 488, "src": "2468:9:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 441, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2468:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 444, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 443, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2480:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "2468:13:2" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 449, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "2494:3:2", "subExpression": { "argumentTypes": null, "id": 448, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2494:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 450, "nodeType": "ExpressionStatement", "src": "2494:3:2" }, "nodeType": "ForStatement", "src": "2464:237:2" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 489, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2718:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 490, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2726:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 491, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2733:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } } ], "id": 492, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2717:34:2", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", "typeString": "tuple(uint256[] memory,uint256[] memory,uint256[] memory)" } }, "functionReturnParameters": 408, "id": 493, "nodeType": "Return", "src": "2710:41:2" } ] }, "documentation": null, "id": 495, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 398, "nodeType": "ParameterList", "parameters": [], "src": "2133:2:2" }, "returnParameters": { "id": 408, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 401, "name": "values", "nodeType": "VariableDeclaration", "scope": 495, "src": "2165:23:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 399, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2165:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 400, "length": null, "nodeType": "ArrayTypeName", "src": "2165:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 404, "name": "dates", "nodeType": "VariableDeclaration", "scope": 495, "src": "2198:22:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 402, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2198:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 403, "length": null, "nodeType": "ArrayTypeName", "src": "2198:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 407, "name": "conversionFactors", "nodeType": "VariableDeclaration", "scope": 495, "src": "2230:34:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 405, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2230:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 406, "length": null, "nodeType": "ArrayTypeName", "src": "2230:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" } ], "src": "2155:110:2" }, "scope": 519, "src": "2113:645:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 517, "nodeType": "Block", "src": "2802:131:2", "statements": [ { "assignments": [ 501 ], "declarations": [ { "constant": false, "id": 501, "name": "balance", "nodeType": "VariableDeclaration", "scope": 517, "src": "2812:15:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 500, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2812:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 506, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 503, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 630, "src": "2838:4:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "id": 502, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2830:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 504, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2830:13:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 505, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2830:21:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2812:39:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 510, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 501, "src": "2883:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 507, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "2861:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 509, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2861:21:2", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 511, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2861:30:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 512, "nodeType": "ExpressionStatement", "src": "2861:30:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 514, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 501, "src": "2918:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 513, "name": "LogWithdraw", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "2906:11:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 515, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2906:20:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 516, "nodeType": "EmitStatement", "src": "2901:25:2" } ] }, "documentation": null, "id": 518, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 498, "modifierName": { "argumentTypes": null, "id": 497, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 43, "src": "2792:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "2792:9:2" } ], "name": "withdraw", "nodeType": "FunctionDefinition", "parameters": { "id": 496, "nodeType": "ParameterList", "parameters": [], "src": "2782:2:2" }, "returnParameters": { "id": 499, "nodeType": "ParameterList", "parameters": [], "src": "2802:0:2" }, "scope": 519, "src": "2765:168:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 520, "src": "115:2820:2" } ], "src": "0:2936:2" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Fundraiser.sol", "exportedSymbols": { "Fundraiser": [ 519 ] }, "id": 520, "nodeType": "SourceUnit", "nodes": [ { "id": 217, "literals": [ "solidity", ">", "0.4", ".23", "<", "0.7", ".0" ], "nodeType": "PragmaDirective", "src": "0:31:2" }, { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol", "file": "../client/node_modules/@openzeppelin/contracts/ownership/Ownable.sol", "id": 218, "nodeType": "ImportDirective", "scope": 520, "sourceUnit": 111, "src": "34:78:2", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 219, "name": "Ownable", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 110, "src": "138:7:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Ownable_$110", "typeString": "contract Ownable" } }, "id": 220, "nodeType": "InheritanceSpecifier", "src": "138:7:2" } ], "contractDependencies": [ 110 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 519, "linearizedBaseContracts": [ 519, 110 ], "name": "Fundraiser", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 222, "name": "_name", "nodeType": "VariableDeclaration", "scope": 519, "src": "152:20:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 221, "name": "string", "nodeType": "ElementaryTypeName", "src": "152:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 224, "name": "_url", "nodeType": "VariableDeclaration", "scope": 519, "src": "178:19:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 223, "name": "string", "nodeType": "ElementaryTypeName", "src": "178:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 226, "name": "_imageURL", "nodeType": "VariableDeclaration", "scope": 519, "src": "203:24:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 225, "name": "string", "nodeType": "ElementaryTypeName", "src": "203:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 228, "name": "_bio", "nodeType": "VariableDeclaration", "scope": 519, "src": "233:19:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string" }, "typeName": { "id": 227, "name": "string", "nodeType": "ElementaryTypeName", "src": "233:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "private" }, { "constant": false, "id": 230, "name": "_beneficiary", "nodeType": "VariableDeclaration", "scope": 519, "src": "260:28:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 229, "name": "address", "nodeType": "ElementaryTypeName", "src": "260:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 233, "name": "_totalDonations", "nodeType": "VariableDeclaration", "scope": 519, "src": "296:35:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 231, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "296:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "30", "id": 232, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "330:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "visibility": "private" }, { "constant": false, "id": 236, "name": "_donationsCount", "nodeType": "VariableDeclaration", "scope": 519, "src": "337:35:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 234, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "337:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "30", "id": 235, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "371:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "visibility": "private" }, { "canonicalName": "Fundraiser.Donation", "id": 243, "members": [ { "constant": false, "id": 238, "name": "value", "nodeType": "VariableDeclaration", "scope": 243, "src": "406:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 237, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "406:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 240, "name": "date", "nodeType": "VariableDeclaration", "scope": 243, "src": "429:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 239, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "429:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 242, "name": "conversionFactor", "nodeType": "VariableDeclaration", "scope": 243, "src": "451:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 241, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "451:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "name": "Donation", "nodeType": "StructDefinition", "scope": 519, "src": "380:102:2", "visibility": "public" }, { "anonymous": false, "documentation": null, "id": 251, "name": "LogDonationReceived", "nodeType": "EventDefinition", "parameters": { "id": 250, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 245, "indexed": false, "name": "from", "nodeType": "VariableDeclaration", "scope": 251, "src": "513:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 244, "name": "address", "nodeType": "ElementaryTypeName", "src": "513:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 247, "indexed": false, "name": "value", "nodeType": "VariableDeclaration", "scope": 251, "src": "527:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 246, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "527:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 249, "indexed": false, "name": "date", "nodeType": "VariableDeclaration", "scope": 251, "src": "542:12:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 248, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "542:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "512:43:2" }, "src": "487:69:2" }, { "constant": false, "id": 256, "name": "_donations", "nodeType": "VariableDeclaration", "scope": 519, "src": "561:49:2", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "typeName": { "id": 255, "keyType": { "id": 252, "name": "address", "nodeType": "ElementaryTypeName", "src": "569:7:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "561:30:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation[])" }, "valueType": { "baseType": { "contractScope": null, "id": 253, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 243, "src": "580:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "id": 254, "length": null, "nodeType": "ArrayTypeName", "src": "580:10:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage_ptr", "typeString": "struct Fundraiser.Donation[]" } } }, "value": null, "visibility": "private" }, { "anonymous": false, "documentation": null, "id": 260, "name": "LogWithdraw", "nodeType": "EventDefinition", "parameters": { "id": 259, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 258, "indexed": false, "name": "amount", "nodeType": "VariableDeclaration", "scope": 260, "src": "636:11:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 257, "name": "uint", "nodeType": "ElementaryTypeName", "src": "636:4:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "635:13:2" }, "src": "618:31:2" }, { "body": { "id": 299, "nodeType": "Block", "src": "854:175:2", "statements": [ { "expression": { "argumentTypes": null, "id": 277, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 275, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 222, "src": "864:5:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 276, "name": "name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 262, "src": "872:4:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "864:12:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 278, "nodeType": "ExpressionStatement", "src": "864:12:2" }, { "expression": { "argumentTypes": null, "id": 281, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 279, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224, "src": "886:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 280, "name": "url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 264, "src": "893:3:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "886:10:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 282, "nodeType": "ExpressionStatement", "src": "886:10:2" }, { "expression": { "argumentTypes": null, "id": 285, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 283, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 226, "src": "906:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 284, "name": "imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 266, "src": "918:8:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "906:20:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 286, "nodeType": "ExpressionStatement", "src": "906:20:2" }, { "expression": { "argumentTypes": null, "id": 289, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 287, "name": "_bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 228, "src": "936:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 288, "name": "bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 268, "src": "942:3:2", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, "src": "936:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "id": 290, "nodeType": "ExpressionStatement", "src": "936:9:2" }, { "expression": { "argumentTypes": null, "id": 293, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 291, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "955:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 292, "name": "beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 270, "src": "970:11:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "955:26:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 294, "nodeType": "ExpressionStatement", "src": "955:26:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 296, "name": "custodian", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 272, "src": "1012:9:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 295, "name": "_transferOwnership", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 109, "src": "993:18:2", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 297, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "993:29:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 298, "nodeType": "ExpressionStatement", "src": "993:29:2" } ] }, "documentation": null, "id": 300, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 273, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 262, "name": "name", "nodeType": "VariableDeclaration", "scope": 300, "src": "677:18:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 261, "name": "string", "nodeType": "ElementaryTypeName", "src": "677:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 264, "name": "url", "nodeType": "VariableDeclaration", "scope": 300, "src": "705:17:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 263, "name": "string", "nodeType": "ElementaryTypeName", "src": "705:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 266, "name": "imageURL", "nodeType": "VariableDeclaration", "scope": 300, "src": "732:22:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 265, "name": "string", "nodeType": "ElementaryTypeName", "src": "732:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 268, "name": "bio", "nodeType": "VariableDeclaration", "scope": 300, "src": "764:17:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 267, "name": "string", "nodeType": "ElementaryTypeName", "src": "764:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 270, "name": "beneficiary", "nodeType": "VariableDeclaration", "scope": 300, "src": "791:27:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 269, "name": "address", "nodeType": "ElementaryTypeName", "src": "791:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 272, "name": "custodian", "nodeType": "VariableDeclaration", "scope": 300, "src": "828:17:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 271, "name": "address", "nodeType": "ElementaryTypeName", "src": "828:7:2", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "667:179:2" }, "returnParameters": { "id": 274, "nodeType": "ParameterList", "parameters": [], "src": "854:0:2" }, "scope": 519, "src": "656:373:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 307, "nodeType": "Block", "src": "1087:29:2", "statements": [ { "expression": { "argumentTypes": null, "id": 305, "name": "_name", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 222, "src": "1104:5:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 304, "id": 306, "nodeType": "Return", "src": "1097:12:2" } ] }, "documentation": null, "id": 308, "implemented": true, "kind": "function", "modifiers": [], "name": "name", "nodeType": "FunctionDefinition", "parameters": { "id": 301, "nodeType": "ParameterList", "parameters": [], "src": "1049:2:2" }, "returnParameters": { "id": 304, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 303, "name": "", "nodeType": "VariableDeclaration", "scope": 308, "src": "1072:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 302, "name": "string", "nodeType": "ElementaryTypeName", "src": "1072:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1071:15:2" }, "scope": 519, "src": "1036:80:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 315, "nodeType": "Block", "src": "1183:36:2", "statements": [ { "expression": { "argumentTypes": null, "id": 313, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "1200:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "functionReturnParameters": 312, "id": 314, "nodeType": "Return", "src": "1193:19:2" } ] }, "documentation": null, "id": 316, "implemented": true, "kind": "function", "modifiers": [], "name": "beneficiary", "nodeType": "FunctionDefinition", "parameters": { "id": 309, "nodeType": "ParameterList", "parameters": [], "src": "1143:2:2" }, "returnParameters": { "id": 312, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 311, "name": "", "nodeType": "VariableDeclaration", "scope": 316, "src": "1166:15:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 310, "name": "address", "nodeType": "ElementaryTypeName", "src": "1166:15:2", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" } ], "src": "1165:17:2" }, "scope": 519, "src": "1123:96:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 323, "nodeType": "Block", "src": "1276:28:2", "statements": [ { "expression": { "argumentTypes": null, "id": 321, "name": "_url", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224, "src": "1293:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 320, "id": 322, "nodeType": "Return", "src": "1286:11:2" } ] }, "documentation": null, "id": 324, "implemented": true, "kind": "function", "modifiers": [], "name": "url", "nodeType": "FunctionDefinition", "parameters": { "id": 317, "nodeType": "ParameterList", "parameters": [], "src": "1238:2:2" }, "returnParameters": { "id": 320, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 319, "name": "", "nodeType": "VariableDeclaration", "scope": 324, "src": "1261:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 318, "name": "string", "nodeType": "ElementaryTypeName", "src": "1261:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1260:15:2" }, "scope": 519, "src": "1226:78:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 331, "nodeType": "Block", "src": "1366:33:2", "statements": [ { "expression": { "argumentTypes": null, "id": 329, "name": "_imageURL", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 226, "src": "1383:9:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 328, "id": 330, "nodeType": "Return", "src": "1376:16:2" } ] }, "documentation": null, "id": 332, "implemented": true, "kind": "function", "modifiers": [], "name": "imageURL", "nodeType": "FunctionDefinition", "parameters": { "id": 325, "nodeType": "ParameterList", "parameters": [], "src": "1328:2:2" }, "returnParameters": { "id": 328, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 327, "name": "", "nodeType": "VariableDeclaration", "scope": 332, "src": "1351:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 326, "name": "string", "nodeType": "ElementaryTypeName", "src": "1351:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1350:15:2" }, "scope": 519, "src": "1311:88:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 339, "nodeType": "Block", "src": "1456:28:2", "statements": [ { "expression": { "argumentTypes": null, "id": 337, "name": "_bio", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 228, "src": "1473:4:2", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" } }, "functionReturnParameters": 336, "id": 338, "nodeType": "Return", "src": "1466:11:2" } ] }, "documentation": null, "id": 340, "implemented": true, "kind": "function", "modifiers": [], "name": "bio", "nodeType": "FunctionDefinition", "parameters": { "id": 333, "nodeType": "ParameterList", "parameters": [], "src": "1418:2:2" }, "returnParameters": { "id": 336, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 335, "name": "", "nodeType": "VariableDeclaration", "scope": 340, "src": "1441:13:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 334, "name": "string", "nodeType": "ElementaryTypeName", "src": "1441:6:2", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "value": null, "visibility": "internal" } ], "src": "1440:15:2" }, "scope": 519, "src": "1406:78:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 347, "nodeType": "Block", "src": "1546:39:2", "statements": [ { "expression": { "argumentTypes": null, "id": 345, "name": "_totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 233, "src": "1563:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 344, "id": 346, "nodeType": "Return", "src": "1556:22:2" } ] }, "documentation": null, "id": 348, "implemented": true, "kind": "function", "modifiers": [], "name": "totalDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 341, "nodeType": "ParameterList", "parameters": [], "src": "1514:2:2" }, "returnParameters": { "id": 344, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 343, "name": "", "nodeType": "VariableDeclaration", "scope": 348, "src": "1537:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 342, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1537:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1536:9:2" }, "scope": 519, "src": "1491:94:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 388, "nodeType": "Block", "src": "1649:356:2", "statements": [ { "assignments": [ 354 ], "declarations": [ { "constant": false, "id": 354, "name": "donation", "nodeType": "VariableDeclaration", "scope": 388, "src": "1659:24:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation" }, "typeName": { "contractScope": null, "id": 353, "name": "Donation", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 243, "src": "1659:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage_ptr", "typeString": "struct Fundraiser.Donation" } }, "value": null, "visibility": "internal" } ], "id": 361, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 356, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1716:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 357, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1716:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 358, "name": "conversionFactor", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 350, "src": "1757:16:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 359, "name": "now", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 616, "src": "1793:3:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 355, "name": "Donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 243, "src": "1686:8:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_struct$_Donation_$243_storage_ptr_$", "typeString": "type(struct Fundraiser.Donation storage pointer)" } }, "id": 360, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "names": [ "value", "conversionFactor", "date" ], "nodeType": "FunctionCall", "src": "1686:121:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory", "typeString": "struct Fundraiser.Donation memory" } }, "nodeType": "VariableDeclarationStatement", "src": "1659:148:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 367, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 354, "src": "1847:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 362, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "1819:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 365, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 363, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1830:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 364, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1830:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1819:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 366, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1819:27:2", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_Donation_$243_storage_$returns$_t_uint256_$", "typeString": "function (struct Fundraiser.Donation storage ref) returns (uint256)" } }, "id": 368, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1819:37:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 369, "nodeType": "ExpressionStatement", "src": "1819:37:2" }, { "expression": { "argumentTypes": null, "id": 373, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 370, "name": "_totalDonations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 233, "src": "1866:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 371, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1885:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 372, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1885:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1866:28:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 374, "nodeType": "ExpressionStatement", "src": "1866:28:2" }, { "expression": { "argumentTypes": null, "id": 377, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 375, "name": "_donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 236, "src": "1904:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "hexValue": "31", "id": 376, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1923:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "1904:20:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 378, "nodeType": "ExpressionStatement", "src": "1904:20:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 380, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1961:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 381, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1961:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 382, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "1973:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 383, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1973:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 384, "name": "donation", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 354, "src": "1984:8:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_memory_ptr", "typeString": "struct Fundraiser.Donation memory" } }, "id": 385, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 240, "src": "1984:13:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 379, "name": "LogDonationReceived", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 251, "src": "1941:19:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$_t_uint256_$returns$__$", "typeString": "function (address,uint256,uint256)" } }, "id": 386, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1941:57:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 387, "nodeType": "EmitStatement", "src": "1936:62:2" } ] }, "documentation": null, "id": 389, "implemented": true, "kind": "function", "modifiers": [], "name": "donate", "nodeType": "FunctionDefinition", "parameters": { "id": 351, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 350, "name": "conversionFactor", "nodeType": "VariableDeclaration", "scope": 389, "src": "1608:24:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 349, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1608:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1607:26:2" }, "returnParameters": { "id": 352, "nodeType": "ParameterList", "parameters": [], "src": "1649:0:2" }, "scope": 519, "src": "1592:413:2", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { "id": 396, "nodeType": "Block", "src": "2067:39:2", "statements": [ { "expression": { "argumentTypes": null, "id": 394, "name": "_donationsCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 236, "src": "2084:15:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 393, "id": 395, "nodeType": "Return", "src": "2077:22:2" } ] }, "documentation": null, "id": 397, "implemented": true, "kind": "function", "modifiers": [], "name": "donationsCount", "nodeType": "FunctionDefinition", "parameters": { "id": 390, "nodeType": "ParameterList", "parameters": [], "src": "2035:2:2" }, "returnParameters": { "id": 393, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 392, "name": "", "nodeType": "VariableDeclaration", "scope": 397, "src": "2058:7:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 391, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2058:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2057:9:2" }, "scope": 519, "src": "2012:94:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 494, "nodeType": "Block", "src": "2270:488:2", "statements": [ { "assignments": [ 410 ], "declarations": [ { "constant": false, "id": 410, "name": "count", "nodeType": "VariableDeclaration", "scope": 494, "src": "2280:13:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 409, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2280:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 416, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 411, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2296:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 414, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 412, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2307:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 413, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2307:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2296:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 415, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2296:29:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2280:45:2" }, { "expression": { "argumentTypes": null, "id": 423, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 417, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2335:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 421, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2358:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 420, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2344:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 418, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2348:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 419, "length": null, "nodeType": "ArrayTypeName", "src": "2348:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 422, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2344:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2335:29:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 424, "nodeType": "ExpressionStatement", "src": "2335:29:2" }, { "expression": { "argumentTypes": null, "id": 431, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 425, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2374:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 429, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2396:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 428, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2382:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 426, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2386:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 427, "length": null, "nodeType": "ArrayTypeName", "src": "2386:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 430, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2382:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2374:28:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 432, "nodeType": "ExpressionStatement", "src": "2374:28:2" }, { "expression": { "argumentTypes": null, "id": 439, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 433, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2412:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 437, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2446:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 436, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "2432:13:2", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 434, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2436:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 435, "length": null, "nodeType": "ArrayTypeName", "src": "2436:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 438, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2432:20:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } }, "src": "2412:40:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 440, "nodeType": "ExpressionStatement", "src": "2412:40:2" }, { "body": { "id": 487, "nodeType": "Block", "src": "2499:202:2", "statements": [ { "expression": { "argumentTypes": null, "id": 461, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 451, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2513:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 453, "indexExpression": { "argumentTypes": null, "id": 452, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2520:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2513:9:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 454, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2525:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 457, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 455, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2536:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 456, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2536:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2525:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 459, "indexExpression": { "argumentTypes": null, "id": 458, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2548:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2525:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 460, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": 238, "src": "2525:31:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2513:43:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 462, "nodeType": "ExpressionStatement", "src": "2513:43:2" }, { "expression": { "argumentTypes": null, "id": 473, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 463, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2570:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 465, "indexExpression": { "argumentTypes": null, "id": 464, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2576:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2570:8:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 466, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2581:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 469, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 467, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2592:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 468, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2592:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2581:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 471, "indexExpression": { "argumentTypes": null, "id": 470, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2604:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2581:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 472, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "date", "nodeType": "MemberAccess", "referencedDeclaration": 240, "src": "2581:30:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2570:41:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 474, "nodeType": "ExpressionStatement", "src": "2570:41:2" }, { "expression": { "argumentTypes": null, "id": 485, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 475, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2625:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, "id": 477, "indexExpression": { "argumentTypes": null, "id": 476, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2643:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "2625:20:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 478, "name": "_donations", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 256, "src": "2648:10:2", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Donation_$243_storage_$dyn_storage_$", "typeString": "mapping(address => struct Fundraiser.Donation storage ref[] storage ref)" } }, "id": 481, "indexExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 479, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 614, "src": "2659:3:2", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 480, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2659:10:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2648:22:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_struct$_Donation_$243_storage_$dyn_storage", "typeString": "struct Fundraiser.Donation storage ref[] storage ref" } }, "id": 483, "indexExpression": { "argumentTypes": null, "id": 482, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2671:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "2648:25:2", "typeDescriptions": { "typeIdentifier": "t_struct$_Donation_$243_storage", "typeString": "struct Fundraiser.Donation storage ref" } }, "id": 484, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "conversionFactor", "nodeType": "MemberAccess", "referencedDeclaration": 242, "src": "2648:42:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2625:65:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 486, "nodeType": "ExpressionStatement", "src": "2625:65:2" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 447, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 445, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2483:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 446, "name": "count", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 410, "src": "2487:5:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2483:9:2", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 488, "initializationExpression": { "assignments": [ 442 ], "declarations": [ { "constant": false, "id": 442, "name": "i", "nodeType": "VariableDeclaration", "scope": 488, "src": "2468:9:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 441, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2468:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 444, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 443, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2480:1:2", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "2468:13:2" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 449, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "2494:3:2", "subExpression": { "argumentTypes": null, "id": 448, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 442, "src": "2494:1:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 450, "nodeType": "ExpressionStatement", "src": "2494:3:2" }, "nodeType": "ForStatement", "src": "2464:237:2" }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 489, "name": "values", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 401, "src": "2718:6:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 490, "name": "dates", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 404, "src": "2726:5:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } }, { "argumentTypes": null, "id": 491, "name": "conversionFactors", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 407, "src": "2733:17:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } } ], "id": 492, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2717:34:2", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", "typeString": "tuple(uint256[] memory,uint256[] memory,uint256[] memory)" } }, "functionReturnParameters": 408, "id": 493, "nodeType": "Return", "src": "2710:41:2" } ] }, "documentation": null, "id": 495, "implemented": true, "kind": "function", "modifiers": [], "name": "myDonations", "nodeType": "FunctionDefinition", "parameters": { "id": 398, "nodeType": "ParameterList", "parameters": [], "src": "2133:2:2" }, "returnParameters": { "id": 408, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 401, "name": "values", "nodeType": "VariableDeclaration", "scope": 495, "src": "2165:23:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 399, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2165:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 400, "length": null, "nodeType": "ArrayTypeName", "src": "2165:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 404, "name": "dates", "nodeType": "VariableDeclaration", "scope": 495, "src": "2198:22:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 402, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2198:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 403, "length": null, "nodeType": "ArrayTypeName", "src": "2198:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 407, "name": "conversionFactors", "nodeType": "VariableDeclaration", "scope": 495, "src": "2230:34:2", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 405, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2230:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 406, "length": null, "nodeType": "ArrayTypeName", "src": "2230:9:2", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" } ], "src": "2155:110:2" }, "scope": 519, "src": "2113:645:2", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 517, "nodeType": "Block", "src": "2802:131:2", "statements": [ { "assignments": [ 501 ], "declarations": [ { "constant": false, "id": 501, "name": "balance", "nodeType": "VariableDeclaration", "scope": 517, "src": "2812:15:2", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 500, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2812:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 506, "initialValue": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 503, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 630, "src": "2838:4:2", "typeDescriptions": { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Fundraiser_$519", "typeString": "contract Fundraiser" } ], "id": 502, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2830:7:2", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 504, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2830:13:2", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 505, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2830:21:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2812:39:2" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 510, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 501, "src": "2883:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 507, "name": "_beneficiary", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "2861:12:2", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 509, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2861:21:2", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 511, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2861:30:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 512, "nodeType": "ExpressionStatement", "src": "2861:30:2" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 514, "name": "balance", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 501, "src": "2918:7:2", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 513, "name": "LogWithdraw", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 260, "src": "2906:11:2", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 515, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2906:20:2", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 516, "nodeType": "EmitStatement", "src": "2901:25:2" } ] }, "documentation": null, "id": 518, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 498, "modifierName": { "argumentTypes": null, "id": 497, "name": "onlyOwner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 43, "src": "2792:9:2", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "2792:9:2" } ], "name": "withdraw", "nodeType": "FunctionDefinition", "parameters": { "id": 496, "nodeType": "ParameterList", "parameters": [], "src": "2782:2:2" }, "returnParameters": { "id": 499, "nodeType": "ParameterList", "parameters": [], "src": "2802:0:2" }, "scope": 519, "src": "2765:168:2", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 520, "src": "115:2820:2" } ], "src": "0:2936:2" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.10", "updatedAt": "2019-08-31T03:47:25.117Z", "devdoc": { "methods": { "isOwner()": { "details": "Returns true if the caller is the current owner." }, "owner()": { "details": "Returns the address of the current owner." }, "renounceOwnership()": { "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. * > Note: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." }, "transferOwnership(address)": { "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } } }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-9/src/contracts/Migrations.json ================================================ { "contractName": "Migrations", "abi": [ { "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" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": false, "inputs": [ { "name": "completed", "type": "uint256" } ], "name": "setCompleted", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "new_address", "type": "address" } ], "name": "upgrade", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Migrations.sol\":{\"keccak256\":\"0xf65fcb01f4b8ef6909f55bccf7f05ab483d953e671e205d9ce8ea6a9adc3c653\",\"urls\":[\"bzzr://ea0687984a75ca6b8aa89a3ba439fa3123a53421a5b5474320c74ad1174583fc\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a723058209a683952b1b10080d406704c878cca7c812b021f40b0f93fed7e6a8a4f697c4f0029", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a723058209a683952b1b10080d406704c878cca7c812b021f40b0f93fed7e6a8a4f697c4f0029", "sourceMap": "25:480:0:-;;;177:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;177:50:0;212:10;204:5;;:18;;;;;;;;;;;;;;;;;;25:480;;;;;;", "deployedSourceMap": "25:480:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:480:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;338:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;338:165:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;73:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;49:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;231:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;231:103:0;;;;;;;;;;;;;;;;;:::i;:::-;;338:165;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;400:19;433:11;400:45;;451:8;:21;;;473:24;;451:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;451:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;451:47:0;;;;167:1;142:26;338:165;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;231:103::-;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;320:9;293:24;:36;;;;142:26;231:103;:::o", "source": "pragma solidity ^0.5.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Migrations.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 56 ] }, "id": 57, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23: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": "49:20:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2, "name": "address", "nodeType": "ElementaryTypeName", "src": "49: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": "73:36:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4, "name": "uint", "nodeType": "ElementaryTypeName", "src": "73:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 13, "nodeType": "Block", "src": "136:37:0", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 10, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 7, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 94, "src": "146:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 8, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "146:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 9, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, "src": "160:5:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "146:19:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 12, "nodeType": "IfStatement", "src": "142:26:0", "trueBody": { "id": 11, "nodeType": "PlaceholderStatement", "src": "167:1:0" } } ] }, "documentation": null, "id": 14, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 6, "nodeType": "ParameterList", "parameters": [], "src": "133:2:0" }, "src": "114:59:0", "visibility": "internal" }, { "body": { "id": 22, "nodeType": "Block", "src": "198:29:0", "statements": [ { "expression": { "argumentTypes": null, "id": 20, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 17, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, "src": "204:5:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 18, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 94, "src": "212:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 19, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "212:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "204:18:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 21, "nodeType": "ExpressionStatement", "src": "204:18:0" } ] }, "documentation": null, "id": 23, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 15, "nodeType": "ParameterList", "parameters": [], "src": "188:2:0" }, "returnParameters": { "id": 16, "nodeType": "ParameterList", "parameters": [], "src": "198:0:0" }, "scope": 56, "src": "177:50:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 34, "nodeType": "Block", "src": "287: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": "293:24:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 31, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 25, "src": "320:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "293:36:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 33, "nodeType": "ExpressionStatement", "src": "293: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": 14, "src": "276:10:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "276:10:0" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 26, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 25, "name": "completed", "nodeType": "VariableDeclaration", "scope": 35, "src": "253:14:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24, "name": "uint", "nodeType": "ElementaryTypeName", "src": "253:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "252:16:0" }, "returnParameters": { "id": 29, "nodeType": "ParameterList", "parameters": [], "src": "287:0:0" }, "scope": 56, "src": "231:103:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 54, "nodeType": "Block", "src": "394:109:0", "statements": [ { "assignments": [ 43 ], "declarations": [ { "constant": false, "id": 43, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 54, "src": "400: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": "400: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": "433: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": "422: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": "422:23:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$56", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "400:45:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 51, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5, "src": "473: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": "451: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": "451: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": "451:47:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 53, "nodeType": "ExpressionStatement", "src": "451: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": 14, "src": "383:10:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "383:10:0" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 38, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 55, "src": "355:19:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36, "name": "address", "nodeType": "ElementaryTypeName", "src": "355:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "354:21:0" }, "returnParameters": { "id": 41, "nodeType": "ParameterList", "parameters": [], "src": "394:0:0" }, "scope": 56, "src": "338:165:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 57, "src": "25:480:0" } ], "src": "0:506:0" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/Migrations.sol", "exportedSymbols": { "Migrations": [ 56 ] }, "id": 57, "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23: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": "49:20:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2, "name": "address", "nodeType": "ElementaryTypeName", "src": "49: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": "73:36:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4, "name": "uint", "nodeType": "ElementaryTypeName", "src": "73:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 13, "nodeType": "Block", "src": "136:37:0", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 10, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 7, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 94, "src": "146:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 8, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "146:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 9, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, "src": "160:5:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "146:19:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 12, "nodeType": "IfStatement", "src": "142:26:0", "trueBody": { "id": 11, "nodeType": "PlaceholderStatement", "src": "167:1:0" } } ] }, "documentation": null, "id": 14, "name": "restricted", "nodeType": "ModifierDefinition", "parameters": { "id": 6, "nodeType": "ParameterList", "parameters": [], "src": "133:2:0" }, "src": "114:59:0", "visibility": "internal" }, { "body": { "id": 22, "nodeType": "Block", "src": "198:29:0", "statements": [ { "expression": { "argumentTypes": null, "id": 20, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 17, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, "src": "204:5:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 18, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 94, "src": "212:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 19, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "212:10:0", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "204:18:0", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 21, "nodeType": "ExpressionStatement", "src": "204:18:0" } ] }, "documentation": null, "id": 23, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 15, "nodeType": "ParameterList", "parameters": [], "src": "188:2:0" }, "returnParameters": { "id": 16, "nodeType": "ParameterList", "parameters": [], "src": "198:0:0" }, "scope": 56, "src": "177:50:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 34, "nodeType": "Block", "src": "287: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": "293:24:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 31, "name": "completed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 25, "src": "320:9:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "293:36:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 33, "nodeType": "ExpressionStatement", "src": "293: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": 14, "src": "276:10:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "276:10:0" } ], "name": "setCompleted", "nodeType": "FunctionDefinition", "parameters": { "id": 26, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 25, "name": "completed", "nodeType": "VariableDeclaration", "scope": 35, "src": "253:14:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 24, "name": "uint", "nodeType": "ElementaryTypeName", "src": "253:4:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "252:16:0" }, "returnParameters": { "id": 29, "nodeType": "ParameterList", "parameters": [], "src": "287:0:0" }, "scope": 56, "src": "231:103:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 54, "nodeType": "Block", "src": "394:109:0", "statements": [ { "assignments": [ 43 ], "declarations": [ { "constant": false, "id": 43, "name": "upgraded", "nodeType": "VariableDeclaration", "scope": 54, "src": "400: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": "400: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": "433: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": "422: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": "422:23:0", "typeDescriptions": { "typeIdentifier": "t_contract$_Migrations_$56", "typeString": "contract Migrations" } }, "nodeType": "VariableDeclarationStatement", "src": "400:45:0" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 51, "name": "last_completed_migration", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5, "src": "473: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": "451: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": "451: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": "451:47:0", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 53, "nodeType": "ExpressionStatement", "src": "451: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": 14, "src": "383:10:0", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "383:10:0" } ], "name": "upgrade", "nodeType": "FunctionDefinition", "parameters": { "id": 38, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37, "name": "new_address", "nodeType": "VariableDeclaration", "scope": 55, "src": "355:19:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 36, "name": "address", "nodeType": "ElementaryTypeName", "src": "355:7:0", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "354:21:0" }, "returnParameters": { "id": 41, "nodeType": "ParameterList", "parameters": [], "src": "394:0:0" }, "scope": 56, "src": "338:165:0", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 57, "src": "25:480:0" } ], "src": "0:506:0" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, "address": "0x6Af651D4c6E9f32a627381BFC771a82C882B1E8C", "transactionHash": "0xf04ee2a0c62330e7a051148d4660de6441abd817caf695a3943c5b2af9b3397e" } }, "schemaVersion": "3.0.10", "updatedAt": "2019-09-02T16:31:37.476Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-9/src/contracts/SimpleStorage.json ================================================ { "contractName": "SimpleStorage", "abi": [ { "constant": false, "inputs": [ { "name": "x", "type": "uint256" } ], "name": "set", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "get", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/SimpleStorage.sol\":\"SimpleStorage\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/randallkanna/Documents/dev/book/fundraiser/contracts/SimpleStorage.sol\":{\"keccak256\":\"0x27a650f3e92e6057b3f1239be6fc335fb57d75c570d7274d8902eb0b04e48014\",\"urls\":[\"bzzr://72f63578772843cf2f8ae2bce4a69c027cbfe7f3e04cc4af14ca023bdc3c35c2\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5060bd8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b11460375780636d4ce63c146062575b600080fd5b606060048036036020811015604b57600080fd5b8101908080359060200190929190505050607e565b005b60686088565b6040518082815260200191505060405180910390f35b8060008190555050565b6000805490509056fea165627a7a7230582077110c26f2f04cec4cbc18a8f64dbb3f6f62c1a0983ce6d8a8601517c30194bd0029", "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b11460375780636d4ce63c146062575b600080fd5b606060048036036020811015604b57600080fd5b8101908080359060200190929190505050607e565b005b60686088565b6040518082815260200191505060405180910390f35b8060008190555050565b6000805490509056fea165627a7a7230582077110c26f2f04cec4cbc18a8f64dbb3f6f62c1a0983ce6d8a8601517c30194bd0029", "sourceMap": "25:176:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:176:1;;;;;;;", "deployedSourceMap": "25:176:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:176:1;;;;;;;;;;;;;;;;;;;;;;;;72:53;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;72:53:1;;;;;;;;;;;;;;;;;:::i;:::-;;129:70;;;:::i;:::-;;;;;;;;;;;;;;;;;;;72:53;119:1;106:10;:14;;;;72:53;:::o;129:70::-;165:4;184:10;;177:17;;129:70;:::o", "source": "pragma solidity ^0.5.0;\n\ncontract SimpleStorage {\n uint storedData;\n\n function set(uint x) public {\n storedData = x;\n }\n\n function get() public view returns (uint) {\n return storedData;\n }\n}\n", "sourcePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/SimpleStorage.sol", "ast": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/SimpleStorage.sol", "exportedSymbols": { "SimpleStorage": [ 79 ] }, "id": 80, "nodeType": "SourceUnit", "nodes": [ { "id": 58, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 79, "linearizedBaseContracts": [ 79 ], "name": "SimpleStorage", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 60, "name": "storedData", "nodeType": "VariableDeclaration", "scope": 79, "src": "52:15:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 59, "name": "uint", "nodeType": "ElementaryTypeName", "src": "52:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "body": { "id": 69, "nodeType": "Block", "src": "100:25:1", "statements": [ { "expression": { "argumentTypes": null, "id": 67, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 65, "name": "storedData", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 60, "src": "106:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 66, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "119:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "106:14:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 68, "nodeType": "ExpressionStatement", "src": "106:14:1" } ] }, "documentation": null, "id": 70, "implemented": true, "kind": "function", "modifiers": [], "name": "set", "nodeType": "FunctionDefinition", "parameters": { "id": 63, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 62, "name": "x", "nodeType": "VariableDeclaration", "scope": 70, "src": "85:6:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 61, "name": "uint", "nodeType": "ElementaryTypeName", "src": "85:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "84:8:1" }, "returnParameters": { "id": 64, "nodeType": "ParameterList", "parameters": [], "src": "100:0:1" }, "scope": 79, "src": "72:53:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 77, "nodeType": "Block", "src": "171:28:1", "statements": [ { "expression": { "argumentTypes": null, "id": 75, "name": "storedData", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 60, "src": "184:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 74, "id": 76, "nodeType": "Return", "src": "177:17:1" } ] }, "documentation": null, "id": 78, "implemented": true, "kind": "function", "modifiers": [], "name": "get", "nodeType": "FunctionDefinition", "parameters": { "id": 71, "nodeType": "ParameterList", "parameters": [], "src": "141:2:1" }, "returnParameters": { "id": 74, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 73, "name": "", "nodeType": "VariableDeclaration", "scope": 78, "src": "165:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 72, "name": "uint", "nodeType": "ElementaryTypeName", "src": "165:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "164:6:1" }, "scope": 79, "src": "129:70:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 80, "src": "25:176:1" } ], "src": "0:202:1" }, "legacyAST": { "absolutePath": "/Users/randallkanna/Documents/dev/book/fundraiser/contracts/SimpleStorage.sol", "exportedSymbols": { "SimpleStorage": [ 79 ] }, "id": 80, "nodeType": "SourceUnit", "nodes": [ { "id": 58, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:1" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 79, "linearizedBaseContracts": [ 79 ], "name": "SimpleStorage", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 60, "name": "storedData", "nodeType": "VariableDeclaration", "scope": 79, "src": "52:15:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 59, "name": "uint", "nodeType": "ElementaryTypeName", "src": "52:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "body": { "id": 69, "nodeType": "Block", "src": "100:25:1", "statements": [ { "expression": { "argumentTypes": null, "id": 67, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 65, "name": "storedData", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 60, "src": "106:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 66, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 62, "src": "119:1:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "106:14:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 68, "nodeType": "ExpressionStatement", "src": "106:14:1" } ] }, "documentation": null, "id": 70, "implemented": true, "kind": "function", "modifiers": [], "name": "set", "nodeType": "FunctionDefinition", "parameters": { "id": 63, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 62, "name": "x", "nodeType": "VariableDeclaration", "scope": 70, "src": "85:6:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 61, "name": "uint", "nodeType": "ElementaryTypeName", "src": "85:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "84:8:1" }, "returnParameters": { "id": 64, "nodeType": "ParameterList", "parameters": [], "src": "100:0:1" }, "scope": 79, "src": "72:53:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 77, "nodeType": "Block", "src": "171:28:1", "statements": [ { "expression": { "argumentTypes": null, "id": 75, "name": "storedData", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 60, "src": "184:10:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 74, "id": 76, "nodeType": "Return", "src": "177:17:1" } ] }, "documentation": null, "id": 78, "implemented": true, "kind": "function", "modifiers": [], "name": "get", "nodeType": "FunctionDefinition", "parameters": { "id": 71, "nodeType": "ParameterList", "parameters": [], "src": "141:2:1" }, "returnParameters": { "id": 74, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 73, "name": "", "nodeType": "VariableDeclaration", "scope": 78, "src": "165:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 72, "name": "uint", "nodeType": "ElementaryTypeName", "src": "165:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "164:6:1" }, "scope": 79, "src": "129:70:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], "scope": 80, "src": "25:176:1" } ], "src": "0:202:1" }, "compiler": { "name": "solc", "version": "0.5.8+commit.23d335f2.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, "address": "0xB7780C9AD3ef38bb4C8B48fab37Ef176603E7787", "transactionHash": "0x0a144793978354e71b1e47e41dbe2e1709dfed7872fcd66dd2d3d2b391b33728" } }, "schemaVersion": "3.0.10", "updatedAt": "2019-08-30T01:00:14.552Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } } ================================================ FILE: chapter-9/src/index.css ================================================ body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } ================================================ FILE: chapter-9/src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom' import App from './App'; ReactDOM.render(( // // ), document.getElementById('root')) ================================================ FILE: chapter-9/src/serviceWorker.js ================================================ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read http://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit http://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } } ================================================ FILE: chapter-9/src/utils/getWeb3.js ================================================ import Web3 from "web3"; const getWeb3 = () => new Promise((resolve, reject) => { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener("load", async () => { // Modern dapp browsers... if (window.ethereum) { const web3 = new Web3(window.ethereum); try { // Request account access if needed await window.ethereum.enable(); // Acccounts now exposed resolve(web3); } catch (error) { reject(error); } } // Legacy dapp browsers... else if (window.web3) { // Use Mist/MetaMask's provider. const web3 = window.web3; console.log("Injected web3 detected."); resolve(web3); } // Fallback to localhost; use dev console port by default... else { const provider = new Web3.providers.HttpProvider( "http://127.0.0.1:8545" ); const web3 = new Web3(provider); console.log("No web3 instance injected, using Local web3."); resolve(web3); } }); }); export default getWeb3;