diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3b664107..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "git.ignoreLimitWarning": true -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 33f09529..1c457d8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19668,8 +19668,7 @@ "integrity": "sha512-rnwGcCe6cev5A6eG5UBCQqPmkJVZMCrK+HN1AvUCco0OHD/0asGc9LuLbtkQIyznA6Lzetq/OOcaTOM4KeT11g==", "requires": { "underscore": "1.9.1", - "web3-core-helpers": "1.2.0", - "websocket": "github:frozeman/WebSocket-Node#6c72925e3f8aaaea8dc8450f97627e85263999f2" + "web3-core-helpers": "1.2.0" }, "dependencies": { "debug": { @@ -19735,7 +19734,7 @@ }, "websocket": { "version": "github:frozeman/WebSocket-Node#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "from": "github:frozeman/WebSocket-Node#browserifyCompatible", + "from": "github:frozeman/WebSocket-Node#6c72925e3f8aaaea8dc8450f97627e85263999f2", "requires": { "debug": "^2.2.0", "nan": "^2.3.3", diff --git a/public/index.html b/public/index.html index 6e7adcdf..9f854ba9 100644 --- a/public/index.html +++ b/public/index.html @@ -27,7 +27,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Inro to Web3.js + Intro to Web3.js diff --git a/src/App.js b/src/App.js index 534e7776..baacc79b 100644 --- a/src/App.js +++ b/src/App.js @@ -1,16 +1,14 @@ import React, { Component } from "react"; import web3 from "./web3"; import auction from "./auction"; + +// Styling import { Layout } from "./Layout"; import "./App.css"; -import { Button } from "react-bootstrap"; import Typist from 'react-typist'; class App extends Component { - constructor(props) { - super(props); - - this.state = { + state = { bids: [], bidders: [], seller: "", @@ -19,16 +17,14 @@ class App extends Component { value: "", message: "" }; - } + async componentDidMount() { const bids = await auction.methods.getBids().call(); const seller = await auction.methods.seller().call(); const highestBidder = await auction.methods.getHighestBidder().call(); const bidders = await auction.methods.getBidders().call(); - const auctionValue = await web3.eth.getBalance( - "0x8B167cf1754005F502774Ffe63857C8C66B5B9f1" - ); + const auctionValue = await web3.eth.getBalance(auction.options.address); this.setState({ bids, @@ -39,17 +35,17 @@ class App extends Component { }); } - onEnter = async event => { + onSubmit = async (event) => { event.preventDefault(); const accounts = await web3.eth.getAccounts(); this.setState({ - message: "Processing..." + message: "Confirming transaction..." }); await auction.methods.submitBid().send({ from: accounts[0], - valuecd: web3.utils.toWei(this.state.value, "ether") + value: web3.utils.toWei(this.state.value, "ether") }); this.setState({ @@ -60,17 +56,13 @@ class App extends Component { onClick = async () => { const accounts = await web3.eth.getAccounts(); - this.setState({ - message: "Picking the highest bidder..." - }); + this.setState({ message: 'Awaiting transaction success...' }) await auction.methods.determineWinner().send({ from: accounts[0] }); - this.setState({ - message: "Sold, to the highest bidder!" - }); + this.setState({ message: 'A winner has been picked!' }); }; render() { @@ -79,18 +71,9 @@ class App extends Component {
Decentralized Auction on Ethereum. -
- - - There are currently {this.state.bidders.length} people entered, - competing to bid {" "} - {web3.utils.fromWei(this.state.auctionValue, "ether")} ether.{" "} - - -
-
+

Join the Auction:


diff --git a/src/auction.js b/src/auction.js index 02ad0a66..192beb61 100644 --- a/src/auction.js +++ b/src/auction.js @@ -123,6 +123,6 @@ let abi = [ "type": "function" } ]; -let address = "0x8B167cf1754005F502774Ffe63857C8C66B5B9f1"; +let address = "0x0bb3f4d023f3e10df7feeec5396dc96445f61899"; export default new web3.eth.Contract(abi, address); diff --git a/src/test/test.js b/src/test/test.js deleted file mode 100644 index a0167891..00000000 --- a/src/test/test.js +++ /dev/null @@ -1,4 +0,0 @@ -var assert = require('assert'); - - - diff --git a/src/web3.js b/src/web3.js index b202b266..9996ef68 100644 --- a/src/web3.js +++ b/src/web3.js @@ -1,5 +1,3 @@ import Web3 from 'web3'; - -const web3 = new Web3(window.web3.currentProvider); - +const web3 = new Web3(window.web3.currentProvider); export default web3; diff --git a/truffle/build/contracts/Auction.json b/truffle/build/contracts/Auction.json index a752a1ec..f422de23 100644 --- a/truffle/build/contracts/Auction.json +++ b/truffle/build/contracts/Auction.json @@ -123,21 +123,21 @@ "type": "function" } ], - "metadata": "{\"compiler\":{\"version\":\"0.4.19+commit.c4cbbb05\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"getHighestBidder\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"seller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"determineWinner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bids\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"auction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getBids\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"submitBid\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getBidders\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bidders\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol\":\"Auction\"},\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol\":{\"keccak256\":\"0x5ccb1a9e3ccb47ed9dba9d0168da276306541a5d96f75962b9baa74c3ba891b5\",\"urls\":[\"bzzr://6ee805daefc18009550925f1a6aaa155d247209f3287bfa4728f6a0470264681\"]}},\"version\":1}", - "bytecode": "0x6060604052341561000f57600080fd5b61087a8061001e6000396000f300606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680623495a41461009d57806308551a53146100f257806333b16d93146101475780634423c5f11461015c5780637d9f6db514610193578063b81c78ec146101a8578063c334b6b214610212578063cb6632ef1461021c578063cff29dfd14610286575b600080fd5b34156100a857600080fd5b6100b06102e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fd57600080fd5b610105610313565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015257600080fd5b61015a610339565b005b341561016757600080fd5b61017d60048080359060200190919050506104b6565b6040518082815260200191505060405180910390f35b341561019e57600080fd5b6101a66104da565b005b34156101b357600080fd5b6101bb61051d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101fe5780820151818401526020810190506101e3565b505050509050019250505060405180910390f35b61021a61057b565b005b341561022757600080fd5b61022f610609565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610272578082015181840152602081019050610257565b505050509050019250505060405180910390f35b341561029157600080fd5b6102a7600480803590602001909190505061069d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009150600090505b60018054905081101561039f578160018281548110151561036257fe5b90600052602060002090015411156103925760018181548110151561038357fe5b90600052602060002090015491505b8080600101915050610345565b6000818154811015156103ae57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561047c57600080fd5b600060405180591061048b5750595b9080825280602002602001820160405250600090805190602001906104b19291906106dc565b505050565b6001818154811015156104c557fe5b90600052602060002090016000915090505481565b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610525610766565b600180548060200260200160405190810160405280929190818152602001828054801561057157602002820191906000526020600020905b81548152602001906001019080831161055d575b5050505050905090565b6000805480600101828161058f919061077a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600180548060010182816105f291906107a6565b916000526020600020900160003490919091505550565b6106116107d2565b600080548060200260200160405190810160405280929190818152602001828054801561069357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610649575b5050505050905090565b6000818154811015156106ac57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b828054828255906000526020600020908101928215610755579160200282015b828111156107545782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906106fc565b5b50905061076291906107e6565b5090565b602060405190810160405280600081525090565b8154818355818115116107a1578183600052602060002091820191016107a09190610829565b5b505050565b8154818355818115116107cd578183600052602060002091820191016107cc9190610829565b5b505050565b602060405190810160405280600081525090565b61082691905b8082111561082257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016107ec565b5090565b90565b61084b91905b8082111561084757600081600090555060010161082f565b5090565b905600a165627a7a72305820dda34f9d9c943d6f2ddee83ad489dcb20437e45130ecd5fad54993ce5a3cc6eb0029", - "deployedBytecode": "0x606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680623495a41461009d57806308551a53146100f257806333b16d93146101475780634423c5f11461015c5780637d9f6db514610193578063b81c78ec146101a8578063c334b6b214610212578063cb6632ef1461021c578063cff29dfd14610286575b600080fd5b34156100a857600080fd5b6100b06102e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fd57600080fd5b610105610313565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015257600080fd5b61015a610339565b005b341561016757600080fd5b61017d60048080359060200190919050506104b6565b6040518082815260200191505060405180910390f35b341561019e57600080fd5b6101a66104da565b005b34156101b357600080fd5b6101bb61051d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101fe5780820151818401526020810190506101e3565b505050509050019250505060405180910390f35b61021a61057b565b005b341561022757600080fd5b61022f610609565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610272578082015181840152602081019050610257565b505050509050019250505060405180910390f35b341561029157600080fd5b6102a7600480803590602001909190505061069d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009150600090505b60018054905081101561039f578160018281548110151561036257fe5b90600052602060002090015411156103925760018181548110151561038357fe5b90600052602060002090015491505b8080600101915050610345565b6000818154811015156103ae57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561047c57600080fd5b600060405180591061048b5750595b9080825280602002602001820160405250600090805190602001906104b19291906106dc565b505050565b6001818154811015156104c557fe5b90600052602060002090016000915090505481565b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610525610766565b600180548060200260200160405190810160405280929190818152602001828054801561057157602002820191906000526020600020905b81548152602001906001019080831161055d575b5050505050905090565b6000805480600101828161058f919061077a565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600180548060010182816105f291906107a6565b916000526020600020900160003490919091505550565b6106116107d2565b600080548060200260200160405190810160405280929190818152602001828054801561069357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610649575b5050505050905090565b6000818154811015156106ac57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b828054828255906000526020600020908101928215610755579160200282015b828111156107545782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906106fc565b5b50905061076291906107e6565b5090565b602060405190810160405280600081525090565b8154818355818115116107a1578183600052602060002091820191016107a09190610829565b5b505050565b8154818355818115116107cd578183600052602060002091820191016107cc9190610829565b5b505050565b602060405190810160405280600081525090565b61082691905b8082111561082257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016107ec565b5090565b90565b61084b91905b8082111561084757600081600090555060010161082f565b5090565b905600a165627a7a72305820dda34f9d9c943d6f2ddee83ad489dcb20437e45130ecd5fad54993ce5a3cc6eb0029", - "sourceMap": "27:1182:1:-;;;;;;;;;;;;;;;;;", - "deployedSourceMap": "27:1182:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;951:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;280:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;599:348;;;;;;;;;;;;;;203:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;375:58;;;;;;;;;;;;;;1132:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;437:153:1;;;;;;1046:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;123:24:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;951:89;1000:7;1022:13;;;;;;;;;;;1015:20;;951:89;:::o;280:21::-;;;;;;;;;;;;;:::o;599:348::-;639:18;667:9;660:1;639:22;;692:1;688:5;;683:115;699:4;:11;;;;695:1;:15;683:115;;;741:10;731:4;736:1;731:7;;;;;;;;;;;;;;;;;;;:20;727:67;;;780:4;785:1;780:7;;;;;;;;;;;;;;;;;;;767:20;;727:67;712:3;;;;;;;683:115;;;821:7;829:1;821:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;805:13;;:26;;;;;;;;;;;;;;;;;;836:13;;;;;;;;;;;:22;;:34;859:10;836:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;941:1;927:16;;;;;;;;;;;;;;;;;;;;;;;;917:7;:26;;;;;;;;;;;;:::i;:::-;;599:348;;:::o;203:21::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;375:58::-;418:10;409:6;;:19;;;;;;;;;;;;;;;;;;375:58::o;1132:75::-;1172:9;;:::i;:::-;1198:4;1191:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1132:75;:::o;437:153::-;531:7;:24;;;;;;;;;;;:::i;:::-;;;;;;;;;;544:10;531:24;;;;;;;;;;;;;;;;;;;;;;;565:4;:20;;;;;;;;;;;:::i;:::-;;;;;;;;;;575:9;565:20;;;;;;;437:153::o;1046:80::-;1089:9;;:::i;:::-;1114:7;1107:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1046:80;:::o;123:24::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;27:1182::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", - "source": "pragma solidity ^0.4.19;\n\ncontract Auction {\n // Represents a set of people entering the auction to bid on a product.\n address[] public bidders;\n \n // Represents the bids received by the seller.\n uint256[] public bids;\n \n // Represents an address auctioning a product.\n address public seller;\n \n // The highest bidder for the auction.\n address highestBidder;\n\n function auction() public {\n seller = msg.sender;\n }\n\n function submitBid() public payable { \n // initializing bidders & bids.\n bidders.push(msg.sender);\n bids.push(msg.value);\n }\n \n\n function determineWinner() public {\n uint256 highestBid = 0;\n uint256 i;\n\n for (i = 0; i < bids.length; i++) {\n if (bids[i] > highestBid) {\n highestBid = bids[i];\n }\n }\n \n highestBidder = bidders[i];\n highestBidder.transfer(highestBid);\n \n // Reset: for a new auction round.\n bidders = new address[](0);\n }\n\n function getHighestBidder() view public returns (address) {\n return highestBidder;\n }\n \n function getBidders() view public returns (address[]){\n return bidders;\n }\n \n function getBids() view public returns (uint256[]) {\n return bids;\n }\n}\n", + "metadata": "{\"compiler\":{\"version\":\"0.4.19+commit.c4cbbb05\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"getHighestBidder\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"seller\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"determineWinner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bids\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"auction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getBids\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"submitBid\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getBidders\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bidders\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol\":\"Auction\"},\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol\":{\"keccak256\":\"0x35c0a691497fd7e9e242be65b19cf6968abfcdf20a9edf54ed1f34f8f338e308\",\"urls\":[\"bzzr://07c33c8df66c5225abf2040b26d799e81bb784d7c70f0555825ceb05c553db8b\"]}},\"version\":1}", + "bytecode": "0x6060604052341561000f57600080fd5b6108188061001e6000396000f300606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680623495a41461009d57806308551a53146100f257806333b16d93146101475780634423c5f11461015c5780637d9f6db514610193578063b81c78ec146101a8578063c334b6b214610212578063cb6632ef1461021c578063cff29dfd14610286575b600080fd5b34156100a857600080fd5b6100b06102e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fd57600080fd5b610105610313565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015257600080fd5b61015a610339565b005b341561016757600080fd5b61017d6004808035906020019091905050610413565b6040518082815260200191505060405180910390f35b341561019e57600080fd5b6101a6610437565b005b34156101b357600080fd5b6101bb61047a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101fe5780820151818401526020810190506101e3565b505050509050019250505060405180910390f35b61021a6104d8565b005b341561022757600080fd5b61022f6105a7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610272578082015181840152602081019050610257565b505050509050019250505060405180910390f35b341561029157600080fd5b6102a7600480803590602001909190505061063b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060016000805490500381548110151561035057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6001808080549050038154811015156103aa57fe5b9060005260206000209001549081150290604051600060405180830381858888f1935050505015156103db57600080fd5b60006040518059106103ea5750595b90808252806020026020018201604052506000908051906020019061041092919061067a565b50565b60018181548110151561042257fe5b90600052602060002090016000915090505481565b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610482610704565b60018054806020026020016040519081016040528092919081815260200182805480156104ce57602002820191906000526020600020905b8154815260200190600101908083116104ba575b5050505050905090565b600080548060010182816104ec9190610718565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001805480600101828161054f9190610744565b91600052602060002090016000349091909150555033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6105af610770565b600080548060200260200160405190810160405280929190818152602001828054801561063157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116105e7575b5050505050905090565b60008181548110151561064a57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b8280548282559060005260206000209081019282156106f3579160200282015b828111156106f25782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019061069a565b5b5090506107009190610784565b5090565b602060405190810160405280600081525090565b81548183558181151161073f5781836000526020600020918201910161073e91906107c7565b5b505050565b81548183558181151161076b5781836000526020600020918201910161076a91906107c7565b5b505050565b602060405190810160405280600081525090565b6107c491905b808211156107c057600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010161078a565b5090565b90565b6107e991905b808211156107e55760008160009055506001016107cd565b5090565b905600a165627a7a723058202d4d667176e7648315d3d7107e59cebccf80b1e52e6457f76af3666e6c86c7300029", + "deployedBytecode": "0x606060405260043610610098576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680623495a41461009d57806308551a53146100f257806333b16d93146101475780634423c5f11461015c5780637d9f6db514610193578063b81c78ec146101a8578063c334b6b214610212578063cb6632ef1461021c578063cff29dfd14610286575b600080fd5b34156100a857600080fd5b6100b06102e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fd57600080fd5b610105610313565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015257600080fd5b61015a610339565b005b341561016757600080fd5b61017d6004808035906020019091905050610413565b6040518082815260200191505060405180910390f35b341561019e57600080fd5b6101a6610437565b005b34156101b357600080fd5b6101bb61047a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101fe5780820151818401526020810190506101e3565b505050509050019250505060405180910390f35b61021a6104d8565b005b341561022757600080fd5b61022f6105a7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610272578082015181840152602081019050610257565b505050509050019250505060405180910390f35b341561029157600080fd5b6102a7600480803590602001909190505061063b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060016000805490500381548110151561035057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6001808080549050038154811015156103aa57fe5b9060005260206000209001549081150290604051600060405180830381858888f1935050505015156103db57600080fd5b60006040518059106103ea5750595b90808252806020026020018201604052506000908051906020019061041092919061067a565b50565b60018181548110151561042257fe5b90600052602060002090016000915090505481565b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610482610704565b60018054806020026020016040519081016040528092919081815260200182805480156104ce57602002820191906000526020600020905b8154815260200190600101908083116104ba575b5050505050905090565b600080548060010182816104ec9190610718565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001805480600101828161054f9190610744565b91600052602060002090016000349091909150555033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6105af610770565b600080548060200260200160405190810160405280929190818152602001828054801561063157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116105e7575b5050505050905090565b60008181548110151561064a57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b8280548282559060005260206000209081019282156106f3579160200282015b828111156106f25782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019061069a565b5b5090506107009190610784565b5090565b602060405190810160405280600081525090565b81548183558181151161073f5781836000526020600020918201910161073e91906107c7565b5b505050565b81548183558181151161076b5781836000526020600020918201910161076a91906107c7565b5b505050565b602060405190810160405280600081525090565b6107c491905b808211156107c057600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010161078a565b5090565b90565b6107e991905b808211156107e55760008160009055506001016107cd565b5090565b905600a165627a7a723058202d4d667176e7648315d3d7107e59cebccf80b1e52e6457f76af3666e6c86c7300029", + "sourceMap": "27:1135:1:-;;;;;;;;;;;;;;;;;", + "deployedSourceMap": "27:1135:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;904:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;280:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;680:218;;;;;;;;;;;;;;203:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;377:58;;;;;;;;;;;;;;1085:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;439:235:1;;;;;;999:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;123:24:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;904:89;953:7;975:13;;;;;;;;;;;968:20;;904:89;:::o;280:21::-;;;;;;;;;;;;;:::o;680:218::-;733:7;756:1;741:7;:14;;;;:16;733:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;:34;;:69;781:4;799:1;786:4;:11;;;;:14;781:20;;;;;;;;;;;;;;;;;;;733:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;889:1;875:16;;;;;;;;;;;;;;;;;;;;;;;;865:7;:26;;;;;;;;;;;;:::i;:::-;;680:218::o;203:21::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;377:58::-;420:10;411:6;;:19;;;;;;;;;;;;;;;;;;377:58::o;1085:75::-;1125:9;;:::i;:::-;1151:4;1144:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1085:75;:::o;439:235::-;533:7;:24;;;;;;;;;;;:::i;:::-;;;;;;;;;;546:10;533:24;;;;;;;;;;;;;;;;;;;;;;;567:4;:20;;;;;;;;;;;:::i;:::-;;;;;;;;;;577:9;567:20;;;;;;;659:10;643:13;;:26;;;;;;;;;;;;;;;;;;439:235::o;999:80::-;1042:9;;:::i;:::-;1067:7;1060:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;999:80;:::o;123:24::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;27:1135::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", + "source": "pragma solidity ^0.4.19;\n\ncontract Auction {\n // Represents a set of people entering the auction to bid on a product.\n address[] public bidders;\n \n // Represents the bids received by the seller.\n uint256[] public bids;\n \n // Represents an address auctioning a product.\n address public seller;\n \n // The highest bidder for the auction.\n address highestBidder;\n \n function auction() public {\n seller = msg.sender;\n }\n\n function submitBid() public payable { \n // initializing bidders & bids.\n bidders.push(msg.sender);\n bids.push(msg.value);\n \n //initializing highestBidder\n highestBidder = msg.sender;\n }\n \n function determineWinner() public {\n \n bidders[bidders.length-1].transfer(\n bids[bids.length -1]);\n \n // Reset to a new round of auction.\n bidders = new address[](0);\n }\n \n function getHighestBidder() view public returns (address) {\n return highestBidder;\n }\n \n function getBidders() view public returns (address[]){\n return bidders;\n }\n \n function getBids() view public returns (uint256[]) {\n return bids;\n }\n}\n", "sourcePath": "/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol", "ast": { "absolutePath": "/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol", "exportedSymbols": { "Auction": [ - 179 + 154 ] }, - "id": 180, + "id": 155, "nodeType": "SourceUnit", "nodes": [ { @@ -157,9 +157,9 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 179, + "id": 154, "linearizedBaseContracts": [ - 179 + 154 ], "name": "Auction", "nodeType": "ContractDefinition", @@ -169,7 +169,7 @@ "id": 61, "name": "bidders", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "123:24:1", "stateVariable": true, "storageLocation": "default", @@ -205,7 +205,7 @@ "id": 64, "name": "bids", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "203:21:1", "stateVariable": true, "storageLocation": "default", @@ -241,7 +241,7 @@ "id": 66, "name": "seller", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "280:21:1", "stateVariable": true, "storageLocation": "default", @@ -267,7 +267,7 @@ "id": 68, "name": "highestBidder", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "349:21:1", "stateVariable": true, "storageLocation": "default", @@ -292,7 +292,7 @@ "body": { "id": 76, "nodeType": "Block", - "src": "401:32:1", + "src": "403:32:1", "statements": [ { "expression": { @@ -309,7 +309,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 66, - "src": "409:6:1", + "src": "411:6:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -325,8 +325,8 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "418:3:1", + "referencedDeclaration": 166, + "src": "420:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" @@ -340,13 +340,13 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "418:10:1", + "src": "420:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "409:19:1", + "src": "411:19:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -354,7 +354,7 @@ }, "id": 75, "nodeType": "ExpressionStatement", - "src": "409:19:1" + "src": "411:19:1" } ] }, @@ -369,26 +369,26 @@ "id": 69, "nodeType": "ParameterList", "parameters": [], - "src": "391:2:1" + "src": "393:2:1" }, "payable": false, "returnParameters": { "id": 70, "nodeType": "ParameterList", "parameters": [], - "src": "401:0:1" + "src": "403:0:1" }, - "scope": 179, - "src": "375:58:1", + "scope": 154, + "src": "377:58:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 94, + "id": 99, "nodeType": "Block", - "src": "473:117:1", + "src": "475:199:1", "statements": [ { "expression": { @@ -402,8 +402,8 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "544:3:1", + "referencedDeclaration": 166, + "src": "546:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" @@ -417,7 +417,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "544:10:1", + "src": "546:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -438,7 +438,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "531:7:1", + "src": "533:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" @@ -452,7 +452,7 @@ "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "531:12:1", + "src": "533:12:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", "typeString": "function (address) returns (uint256)" @@ -466,7 +466,7 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "531:24:1", + "src": "533:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -474,7 +474,7 @@ }, "id": 86, "nodeType": "ExpressionStatement", - "src": "531:24:1" + "src": "533:24:1" }, { "expression": { @@ -488,8 +488,8 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "575:3:1", + "referencedDeclaration": 166, + "src": "577:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" @@ -503,7 +503,7 @@ "memberName": "value", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "575:9:1", + "src": "577:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -524,7 +524,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, - "src": "565:4:1", + "src": "567:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[] storage ref" @@ -538,7 +538,7 @@ "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "565:9:1", + "src": "567:9:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_uint256_$returns$_t_uint256_$", "typeString": "function (uint256) returns (uint256)" @@ -552,7 +552,7 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "565:20:1", + "src": "567:20:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -560,11 +560,73 @@ }, "id": 93, "nodeType": "ExpressionStatement", - "src": "565:20:1" + "src": "567:20:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 97, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 94, + "name": "highestBidder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 68, + "src": "643:13:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 95, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "659:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 96, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "659:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "643:26:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 98, + "nodeType": "ExpressionStatement", + "src": "643:26:1" } ] }, - "id": 95, + "id": 100, "implemented": true, "isConstructor": false, "isDeclaredConst": false, @@ -575,517 +637,119 @@ "id": 78, "nodeType": "ParameterList", "parameters": [], - "src": "455:2:1" + "src": "457:2:1" }, "payable": true, "returnParameters": { "id": 79, "nodeType": "ParameterList", "parameters": [], - "src": "473:0:1" + "src": "475:0:1" }, - "scope": 179, - "src": "437:153:1", + "scope": 154, + "src": "439:235:1", "stateMutability": "payable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 151, + "id": 126, "nodeType": "Block", - "src": "633:314:1", + "src": "714:184:1", "statements": [ { - "assignments": [ - 99 - ], - "declarations": [ - { - "constant": false, - "id": 99, - "name": "highestBid", - "nodeType": "VariableDeclaration", - "scope": 152, - "src": "639:18:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 98, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "639:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 101, - "initialValue": { + "expression": { "argumentTypes": null, - "hexValue": "30", - "id": 100, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "660:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "639:22:1" - }, - { - "assignments": [], - "declarations": [ - { - "constant": false, - "id": 103, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 152, - "src": "667:9:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 102, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "667:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 104, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "667:9:1" - }, - { - "body": { - "id": 129, - "nodeType": "Block", - "src": "717:81:1", - "statements": [ + "arguments": [ { - "condition": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 110, + "name": "bids", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "781:4:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "id": 115, + "indexExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 120, + "id": 114, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, - "baseExpression": { + "expression": { "argumentTypes": null, - "id": 116, + "id": 111, "name": "bids", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, - "src": "731:4:1", + "src": "786:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[] storage ref" } }, - "id": 118, - "indexExpression": { - "argumentTypes": null, - "id": 117, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "736:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, + "id": 112, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "731:7:1", + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "786:11:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", - "operator": ">", + "operator": "-", "rightExpression": { "argumentTypes": null, - "id": 119, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "741:10:1", + "hexValue": "31", + "id": 113, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "799:1:1", + "subdenomination": null, "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" }, - "src": "731:20:1", + "src": "786:14:1", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "falseBody": null, - "id": 128, - "nodeType": "IfStatement", - "src": "727:67:1", - "trueBody": { - "id": 127, - "nodeType": "Block", - "src": "753:41:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 125, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 121, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "767:10:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 122, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 64, - "src": "780:4:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 124, - "indexExpression": { - "argumentTypes": null, - "id": 123, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "785:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "780:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "767:20:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 126, - "nodeType": "ExpressionStatement", - "src": "767:20:1" - } - ] - } - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 112, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 109, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "695:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, - "expression": { - "argumentTypes": null, - "id": 110, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 64, - "src": "699:4:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 111, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "699:11:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "695:15:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 130, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 107, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 105, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "688:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 106, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "692:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "688:5:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 108, - "nodeType": "ExpressionStatement", - "src": "688:5:1" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "712:3:1", - "subExpression": { - "argumentTypes": null, - "id": 113, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "712:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 115, - "nodeType": "ExpressionStatement", - "src": "712:3:1" - }, - "nodeType": "ForStatement", - "src": "683:115:1" - }, - { - "expression": { - "argumentTypes": null, - "id": 135, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 131, - "name": "highestBidder", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 68, - "src": "805:13:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 132, - "name": "bidders", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 61, - "src": "821:7:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 134, - "indexExpression": { - "argumentTypes": null, - "id": 133, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "829:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "821:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "805:26:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 136, - "nodeType": "ExpressionStatement", - "src": "805:26:1" - }, - { - "expression": { - "argumentTypes": null, - "arguments": [ - { - "argumentTypes": null, - "id": 140, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "859:10:1", + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "781:20:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1101,18 +765,98 @@ ], "expression": { "argumentTypes": null, - "id": 137, - "name": "highestBidder", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 68, - "src": "836:13:1", + "baseExpression": { + "argumentTypes": null, + "id": 103, + "name": "bidders", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 61, + "src": "733:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 108, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 104, + "name": "bidders", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 61, + "src": "741:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 105, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "741:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "756:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "741:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "733:25:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 139, + "id": 109, "isConstant": false, "isLValue": false, "isPure": false, @@ -1120,13 +864,13 @@ "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "836:22:1", + "src": "733:34:1", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, - "id": 141, + "id": 116, "isConstant": false, "isLValue": false, "isPure": false, @@ -1134,32 +878,32 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "836:34:1", + "src": "733:69:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 142, + "id": 117, "nodeType": "ExpressionStatement", - "src": "836:34:1" + "src": "733:69:1" }, { "expression": { "argumentTypes": null, - "id": 149, + "id": 124, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 143, + "id": 118, "name": "bidders", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "917:7:1", + "src": "865:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" @@ -1173,14 +917,14 @@ { "argumentTypes": null, "hexValue": "30", - "id": 147, + "id": 122, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "941:1:1", + "src": "889:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", @@ -1196,39 +940,39 @@ "typeString": "int_const 0" } ], - "id": 146, + "id": 121, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", - "src": "927:13:1", + "src": "875:13:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_address_$dyn_memory_$", "typeString": "function (uint256) pure returns (address[] memory)" }, "typeName": { "baseType": { - "id": 144, + "id": 119, "name": "address", "nodeType": "ElementaryTypeName", - "src": "931:7:1", + "src": "879:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 145, + "id": 120, "length": null, "nodeType": "ArrayTypeName", - "src": "931:9:1", + "src": "879:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[] storage pointer" } } }, - "id": 148, + "id": 123, "isConstant": false, "isLValue": false, "isPure": true, @@ -1236,25 +980,25 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "927:16:1", + "src": "875:16:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory", "typeString": "address[] memory" } }, - "src": "917:26:1", + "src": "865:26:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, - "id": 150, + "id": 125, "nodeType": "ExpressionStatement", - "src": "917:26:1" + "src": "865:26:1" } ] }, - "id": 152, + "id": 127, "implemented": true, "isConstructor": false, "isDeclaredConst": false, @@ -1262,52 +1006,52 @@ "name": "determineWinner", "nodeType": "FunctionDefinition", "parameters": { - "id": 96, + "id": 101, "nodeType": "ParameterList", "parameters": [], - "src": "623:2:1" + "src": "704:2:1" }, "payable": false, "returnParameters": { - "id": 97, + "id": 102, "nodeType": "ParameterList", "parameters": [], - "src": "633:0:1" + "src": "714:0:1" }, - "scope": 179, - "src": "599:348:1", + "scope": 154, + "src": "680:218:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 159, + "id": 134, "nodeType": "Block", - "src": "1009:31:1", + "src": "962:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 157, + "id": 132, "name": "highestBidder", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 68, - "src": "1022:13:1", + "src": "975:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "functionReturnParameters": 156, - "id": 158, + "functionReturnParameters": 131, + "id": 133, "nodeType": "Return", - "src": "1015:20:1" + "src": "968:20:1" } ] }, - "id": 160, + "id": 135, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -1315,23 +1059,23 @@ "name": "getHighestBidder", "nodeType": "FunctionDefinition", "parameters": { - "id": 153, + "id": 128, "nodeType": "ParameterList", "parameters": [], - "src": "976:2:1" + "src": "929:2:1" }, "payable": false, "returnParameters": { - "id": 156, + "id": 131, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 155, + "id": 130, "name": "", "nodeType": "VariableDeclaration", - "scope": 160, - "src": "1000:7:1", + "scope": 135, + "src": "953:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1339,10 +1083,10 @@ "typeString": "address" }, "typeName": { - "id": 154, + "id": 129, "name": "address", "nodeType": "ElementaryTypeName", - "src": "1000:7:1", + "src": "953:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1352,42 +1096,42 @@ "visibility": "internal" } ], - "src": "999:9:1" + "src": "952:9:1" }, - "scope": 179, - "src": "951:89:1", + "scope": 154, + "src": "904:89:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { - "id": 168, + "id": 143, "nodeType": "Block", - "src": "1099:27:1", + "src": "1052:27:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 166, + "id": 141, "name": "bidders", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "1114:7:1", + "src": "1067:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, - "functionReturnParameters": 165, - "id": 167, + "functionReturnParameters": 140, + "id": 142, "nodeType": "Return", - "src": "1107:14:1" + "src": "1060:14:1" } ] }, - "id": 169, + "id": 144, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -1395,23 +1139,23 @@ "name": "getBidders", "nodeType": "FunctionDefinition", "parameters": { - "id": 161, + "id": 136, "nodeType": "ParameterList", "parameters": [], - "src": "1065:2:1" + "src": "1018:2:1" }, "payable": false, "returnParameters": { - "id": 165, + "id": 140, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 164, + "id": 139, "name": "", "nodeType": "VariableDeclaration", - "scope": 169, - "src": "1089:9:1", + "scope": 144, + "src": "1042:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1420,19 +1164,19 @@ }, "typeName": { "baseType": { - "id": 162, + "id": 137, "name": "address", "nodeType": "ElementaryTypeName", - "src": "1089:7:1", + "src": "1042:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 163, + "id": 138, "length": null, "nodeType": "ArrayTypeName", - "src": "1089:9:1", + "src": "1042:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[] storage pointer" @@ -1442,42 +1186,42 @@ "visibility": "internal" } ], - "src": "1088:11:1" + "src": "1041:11:1" }, - "scope": 179, - "src": "1046:80:1", + "scope": 154, + "src": "999:80:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { - "id": 177, + "id": 152, "nodeType": "Block", - "src": "1183:24:1", + "src": "1136:24:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 175, + "id": 150, "name": "bids", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, - "src": "1198:4:1", + "src": "1151:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[] storage ref" } }, - "functionReturnParameters": 174, - "id": 176, + "functionReturnParameters": 149, + "id": 151, "nodeType": "Return", - "src": "1191:11:1" + "src": "1144:11:1" } ] }, - "id": 178, + "id": 153, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -1485,23 +1229,23 @@ "name": "getBids", "nodeType": "FunctionDefinition", "parameters": { - "id": 170, + "id": 145, "nodeType": "ParameterList", "parameters": [], - "src": "1148:2:1" + "src": "1101:2:1" }, "payable": false, "returnParameters": { - "id": 174, + "id": 149, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 173, + "id": 148, "name": "", "nodeType": "VariableDeclaration", - "scope": 178, - "src": "1172:9:1", + "scope": 153, + "src": "1125:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1510,19 +1254,19 @@ }, "typeName": { "baseType": { - "id": 171, + "id": 146, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "1172:7:1", + "src": "1125:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 172, + "id": 147, "length": null, "nodeType": "ArrayTypeName", - "src": "1172:9:1", + "src": "1125:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[] storage pointer" @@ -1532,29 +1276,29 @@ "visibility": "internal" } ], - "src": "1171:11:1" + "src": "1124:11:1" }, - "scope": 179, - "src": "1132:75:1", + "scope": 154, + "src": "1085:75:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], - "scope": 180, - "src": "27:1182:1" + "scope": 155, + "src": "27:1135:1" } ], - "src": "0:1210:1" + "src": "0:1163:1" }, "legacyAST": { "absolutePath": "/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/auction.sol", "exportedSymbols": { "Auction": [ - 179 + 154 ] }, - "id": 180, + "id": 155, "nodeType": "SourceUnit", "nodes": [ { @@ -1574,9 +1318,9 @@ "contractKind": "contract", "documentation": null, "fullyImplemented": true, - "id": 179, + "id": 154, "linearizedBaseContracts": [ - 179 + 154 ], "name": "Auction", "nodeType": "ContractDefinition", @@ -1586,7 +1330,7 @@ "id": 61, "name": "bidders", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "123:24:1", "stateVariable": true, "storageLocation": "default", @@ -1622,7 +1366,7 @@ "id": 64, "name": "bids", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "203:21:1", "stateVariable": true, "storageLocation": "default", @@ -1658,7 +1402,7 @@ "id": 66, "name": "seller", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "280:21:1", "stateVariable": true, "storageLocation": "default", @@ -1684,7 +1428,7 @@ "id": 68, "name": "highestBidder", "nodeType": "VariableDeclaration", - "scope": 179, + "scope": 154, "src": "349:21:1", "stateVariable": true, "storageLocation": "default", @@ -1709,7 +1453,7 @@ "body": { "id": 76, "nodeType": "Block", - "src": "401:32:1", + "src": "403:32:1", "statements": [ { "expression": { @@ -1726,7 +1470,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 66, - "src": "409:6:1", + "src": "411:6:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1742,8 +1486,8 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "418:3:1", + "referencedDeclaration": 166, + "src": "420:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" @@ -1757,13 +1501,13 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "418:10:1", + "src": "420:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "409:19:1", + "src": "411:19:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1771,7 +1515,7 @@ }, "id": 75, "nodeType": "ExpressionStatement", - "src": "409:19:1" + "src": "411:19:1" } ] }, @@ -1786,26 +1530,26 @@ "id": 69, "nodeType": "ParameterList", "parameters": [], - "src": "391:2:1" + "src": "393:2:1" }, "payable": false, "returnParameters": { "id": 70, "nodeType": "ParameterList", "parameters": [], - "src": "401:0:1" + "src": "403:0:1" }, - "scope": 179, - "src": "375:58:1", + "scope": 154, + "src": "377:58:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 94, + "id": 99, "nodeType": "Block", - "src": "473:117:1", + "src": "475:199:1", "statements": [ { "expression": { @@ -1819,8 +1563,8 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "544:3:1", + "referencedDeclaration": 166, + "src": "546:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" @@ -1834,7 +1578,7 @@ "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "544:10:1", + "src": "546:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1855,7 +1599,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "531:7:1", + "src": "533:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" @@ -1869,7 +1613,7 @@ "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "531:12:1", + "src": "533:12:1", "typeDescriptions": { "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", "typeString": "function (address) returns (uint256)" @@ -1883,7 +1627,7 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "531:24:1", + "src": "533:24:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1891,7 +1635,7 @@ }, "id": 86, "nodeType": "ExpressionStatement", - "src": "531:24:1" + "src": "533:24:1" }, { "expression": { @@ -1905,535 +1649,96 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 191, - "src": "575:3:1", + "referencedDeclaration": 166, + "src": "577:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 91, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "value", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "575:9:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "expression": { - "argumentTypes": null, - "id": 87, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 64, - "src": "565:4:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 89, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "push", - "nodeType": "MemberAccess", - "referencedDeclaration": null, - "src": "565:9:1", - "typeDescriptions": { - "typeIdentifier": "t_function_arraypush_nonpayable$_t_uint256_$returns$_t_uint256_$", - "typeString": "function (uint256) returns (uint256)" - } - }, - "id": 92, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "565:20:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 93, - "nodeType": "ExpressionStatement", - "src": "565:20:1" - } - ] - }, - "id": 95, - "implemented": true, - "isConstructor": false, - "isDeclaredConst": false, - "modifiers": [], - "name": "submitBid", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 78, - "nodeType": "ParameterList", - "parameters": [], - "src": "455:2:1" - }, - "payable": true, - "returnParameters": { - "id": 79, - "nodeType": "ParameterList", - "parameters": [], - "src": "473:0:1" - }, - "scope": 179, - "src": "437:153:1", - "stateMutability": "payable", - "superFunction": null, - "visibility": "public" - }, - { - "body": { - "id": 151, - "nodeType": "Block", - "src": "633:314:1", - "statements": [ - { - "assignments": [ - 99 - ], - "declarations": [ - { - "constant": false, - "id": 99, - "name": "highestBid", - "nodeType": "VariableDeclaration", - "scope": 152, - "src": "639:18:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 98, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "639:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 101, - "initialValue": { - "argumentTypes": null, - "hexValue": "30", - "id": 100, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "660:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "639:22:1" - }, - { - "assignments": [], - "declarations": [ - { - "constant": false, - "id": 103, - "name": "i", - "nodeType": "VariableDeclaration", - "scope": 152, - "src": "667:9:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 102, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "667:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "value": null, - "visibility": "internal" - } - ], - "id": 104, - "initialValue": null, - "nodeType": "VariableDeclarationStatement", - "src": "667:9:1" - }, - { - "body": { - "id": 129, - "nodeType": "Block", - "src": "717:81:1", - "statements": [ - { - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 120, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 116, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 64, - "src": "731:4:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 118, - "indexExpression": { - "argumentTypes": null, - "id": 117, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "736:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "731:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": ">", - "rightExpression": { - "argumentTypes": null, - "id": 119, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "741:10:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "731:20:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "falseBody": null, - "id": 128, - "nodeType": "IfStatement", - "src": "727:67:1", - "trueBody": { - "id": 127, - "nodeType": "Block", - "src": "753:41:1", - "statements": [ - { - "expression": { - "argumentTypes": null, - "id": 125, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 121, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "767:10:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 122, - "name": "bids", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 64, - "src": "780:4:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_uint256_$dyn_storage", - "typeString": "uint256[] storage ref" - } - }, - "id": 124, - "indexExpression": { - "argumentTypes": null, - "id": 123, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "785:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "780:7:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "767:20:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 126, - "nodeType": "ExpressionStatement", - "src": "767:20:1" - } - ] - } - } - ] - }, - "condition": { - "argumentTypes": null, - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 112, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "argumentTypes": null, - "id": 109, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "695:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeString": "msg" + } + }, + "id": 91, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "577:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "argumentTypes": null, + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], "expression": { "argumentTypes": null, - "id": 110, + "id": 87, "name": "bids", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, - "src": "699:4:1", + "src": "567:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[] storage ref" } }, - "id": 111, + "id": 89, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "memberName": "length", + "memberName": "push", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "699:11:1", + "src": "567:9:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_function_arraypush_nonpayable$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) returns (uint256)" } }, - "src": "695:15:1", + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "567:20:1", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 130, - "initializationExpression": { - "expression": { - "argumentTypes": null, - "id": 107, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "argumentTypes": null, - "id": 105, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "688:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "argumentTypes": null, - "hexValue": "30", - "id": 106, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "692:1:1", - "subdenomination": null, - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "src": "688:5:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 108, - "nodeType": "ExpressionStatement", - "src": "688:5:1" - }, - "loopExpression": { - "expression": { - "argumentTypes": null, - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": false, - "src": "712:3:1", - "subExpression": { - "argumentTypes": null, - "id": 113, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "712:1:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 115, - "nodeType": "ExpressionStatement", - "src": "712:3:1" - }, - "nodeType": "ForStatement", - "src": "683:115:1" + "id": 93, + "nodeType": "ExpressionStatement", + "src": "567:20:1" }, { "expression": { "argumentTypes": null, - "id": 135, + "id": 97, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 131, + "id": 94, "name": "highestBidder", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 68, - "src": "805:13:1", + "src": "643:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2443,66 +1748,169 @@ "operator": "=", "rightHandSide": { "argumentTypes": null, - "baseExpression": { - "argumentTypes": null, - "id": 132, - "name": "bidders", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 61, - "src": "821:7:1", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage", - "typeString": "address[] storage ref" - } - }, - "id": 134, - "indexExpression": { + "expression": { "argumentTypes": null, - "id": 133, - "name": "i", + "id": 95, + "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 103, - "src": "829:1:1", + "referencedDeclaration": 166, + "src": "659:3:1", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_magic_message", + "typeString": "msg" } }, + "id": 96, "isConstant": false, - "isLValue": true, + "isLValue": false, "isPure": false, "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "821:10:1", + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "659:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "src": "805:26:1", + "src": "643:26:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 136, + "id": 98, "nodeType": "ExpressionStatement", - "src": "805:26:1" - }, + "src": "643:26:1" + } + ] + }, + "id": 100, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "submitBid", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 78, + "nodeType": "ParameterList", + "parameters": [], + "src": "457:2:1" + }, + "payable": true, + "returnParameters": { + "id": 79, + "nodeType": "ParameterList", + "parameters": [], + "src": "475:0:1" + }, + "scope": 154, + "src": "439:235:1", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 126, + "nodeType": "Block", + "src": "714:184:1", + "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, - "id": 140, - "name": "highestBid", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 99, - "src": "859:10:1", + "baseExpression": { + "argumentTypes": null, + "id": 110, + "name": "bids", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "781:4:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "id": 115, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 111, + "name": "bids", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "786:4:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage", + "typeString": "uint256[] storage ref" + } + }, + "id": 112, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "786:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 113, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "799:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "786:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "781:20:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -2518,18 +1926,98 @@ ], "expression": { "argumentTypes": null, - "id": 137, - "name": "highestBidder", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 68, - "src": "836:13:1", + "baseExpression": { + "argumentTypes": null, + "id": 103, + "name": "bidders", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 61, + "src": "733:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 108, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 104, + "name": "bidders", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 61, + "src": "741:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 105, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "741:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "756:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "741:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "733:25:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 139, + "id": 109, "isConstant": false, "isLValue": false, "isPure": false, @@ -2537,13 +2025,13 @@ "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": null, - "src": "836:22:1", + "src": "733:34:1", "typeDescriptions": { "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, - "id": 141, + "id": 116, "isConstant": false, "isLValue": false, "isPure": false, @@ -2551,32 +2039,32 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "836:34:1", + "src": "733:69:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 142, + "id": 117, "nodeType": "ExpressionStatement", - "src": "836:34:1" + "src": "733:69:1" }, { "expression": { "argumentTypes": null, - "id": 149, + "id": 124, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, - "id": 143, + "id": 118, "name": "bidders", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "917:7:1", + "src": "865:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" @@ -2590,14 +2078,14 @@ { "argumentTypes": null, "hexValue": "30", - "id": 147, + "id": 122, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "941:1:1", + "src": "889:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", @@ -2613,39 +2101,39 @@ "typeString": "int_const 0" } ], - "id": 146, + "id": 121, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", - "src": "927:13:1", + "src": "875:13:1", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_address_$dyn_memory_$", "typeString": "function (uint256) pure returns (address[] memory)" }, "typeName": { "baseType": { - "id": 144, + "id": 119, "name": "address", "nodeType": "ElementaryTypeName", - "src": "931:7:1", + "src": "879:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 145, + "id": 120, "length": null, "nodeType": "ArrayTypeName", - "src": "931:9:1", + "src": "879:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[] storage pointer" } } }, - "id": 148, + "id": 123, "isConstant": false, "isLValue": false, "isPure": true, @@ -2653,25 +2141,25 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "927:16:1", + "src": "875:16:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory", "typeString": "address[] memory" } }, - "src": "917:26:1", + "src": "865:26:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, - "id": 150, + "id": 125, "nodeType": "ExpressionStatement", - "src": "917:26:1" + "src": "865:26:1" } ] }, - "id": 152, + "id": 127, "implemented": true, "isConstructor": false, "isDeclaredConst": false, @@ -2679,52 +2167,52 @@ "name": "determineWinner", "nodeType": "FunctionDefinition", "parameters": { - "id": 96, + "id": 101, "nodeType": "ParameterList", "parameters": [], - "src": "623:2:1" + "src": "704:2:1" }, "payable": false, "returnParameters": { - "id": 97, + "id": 102, "nodeType": "ParameterList", "parameters": [], - "src": "633:0:1" + "src": "714:0:1" }, - "scope": 179, - "src": "599:348:1", + "scope": 154, + "src": "680:218:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { - "id": 159, + "id": 134, "nodeType": "Block", - "src": "1009:31:1", + "src": "962:31:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 157, + "id": 132, "name": "highestBidder", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 68, - "src": "1022:13:1", + "src": "975:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "functionReturnParameters": 156, - "id": 158, + "functionReturnParameters": 131, + "id": 133, "nodeType": "Return", - "src": "1015:20:1" + "src": "968:20:1" } ] }, - "id": 160, + "id": 135, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -2732,23 +2220,23 @@ "name": "getHighestBidder", "nodeType": "FunctionDefinition", "parameters": { - "id": 153, + "id": 128, "nodeType": "ParameterList", "parameters": [], - "src": "976:2:1" + "src": "929:2:1" }, "payable": false, "returnParameters": { - "id": 156, + "id": 131, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 155, + "id": 130, "name": "", "nodeType": "VariableDeclaration", - "scope": 160, - "src": "1000:7:1", + "scope": 135, + "src": "953:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2756,10 +2244,10 @@ "typeString": "address" }, "typeName": { - "id": 154, + "id": 129, "name": "address", "nodeType": "ElementaryTypeName", - "src": "1000:7:1", + "src": "953:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -2769,42 +2257,42 @@ "visibility": "internal" } ], - "src": "999:9:1" + "src": "952:9:1" }, - "scope": 179, - "src": "951:89:1", + "scope": 154, + "src": "904:89:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { - "id": 168, + "id": 143, "nodeType": "Block", - "src": "1099:27:1", + "src": "1052:27:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 166, + "id": 141, "name": "bidders", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 61, - "src": "1114:7:1", + "src": "1067:7:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage", "typeString": "address[] storage ref" } }, - "functionReturnParameters": 165, - "id": 167, + "functionReturnParameters": 140, + "id": 142, "nodeType": "Return", - "src": "1107:14:1" + "src": "1060:14:1" } ] }, - "id": 169, + "id": 144, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -2812,23 +2300,23 @@ "name": "getBidders", "nodeType": "FunctionDefinition", "parameters": { - "id": 161, + "id": 136, "nodeType": "ParameterList", "parameters": [], - "src": "1065:2:1" + "src": "1018:2:1" }, "payable": false, "returnParameters": { - "id": 165, + "id": 140, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 164, + "id": 139, "name": "", "nodeType": "VariableDeclaration", - "scope": 169, - "src": "1089:9:1", + "scope": 144, + "src": "1042:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2837,19 +2325,19 @@ }, "typeName": { "baseType": { - "id": 162, + "id": 137, "name": "address", "nodeType": "ElementaryTypeName", - "src": "1089:7:1", + "src": "1042:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, - "id": 163, + "id": 138, "length": null, "nodeType": "ArrayTypeName", - "src": "1089:9:1", + "src": "1042:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[] storage pointer" @@ -2859,42 +2347,42 @@ "visibility": "internal" } ], - "src": "1088:11:1" + "src": "1041:11:1" }, - "scope": 179, - "src": "1046:80:1", + "scope": 154, + "src": "999:80:1", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { - "id": 177, + "id": 152, "nodeType": "Block", - "src": "1183:24:1", + "src": "1136:24:1", "statements": [ { "expression": { "argumentTypes": null, - "id": 175, + "id": 150, "name": "bids", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 64, - "src": "1198:4:1", + "src": "1151:4:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage", "typeString": "uint256[] storage ref" } }, - "functionReturnParameters": 174, - "id": 176, + "functionReturnParameters": 149, + "id": 151, "nodeType": "Return", - "src": "1191:11:1" + "src": "1144:11:1" } ] }, - "id": 178, + "id": 153, "implemented": true, "isConstructor": false, "isDeclaredConst": true, @@ -2902,23 +2390,23 @@ "name": "getBids", "nodeType": "FunctionDefinition", "parameters": { - "id": 170, + "id": 145, "nodeType": "ParameterList", "parameters": [], - "src": "1148:2:1" + "src": "1101:2:1" }, "payable": false, "returnParameters": { - "id": 174, + "id": 149, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 173, + "id": 148, "name": "", "nodeType": "VariableDeclaration", - "scope": 178, - "src": "1172:9:1", + "scope": 153, + "src": "1125:9:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -2927,19 +2415,19 @@ }, "typeName": { "baseType": { - "id": 171, + "id": 146, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "1172:7:1", + "src": "1125:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 172, + "id": 147, "length": null, "nodeType": "ArrayTypeName", - "src": "1172:9:1", + "src": "1125:9:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[] storage pointer" @@ -2949,20 +2437,20 @@ "visibility": "internal" } ], - "src": "1171:11:1" + "src": "1124:11:1" }, - "scope": 179, - "src": "1132:75:1", + "scope": 154, + "src": "1085:75:1", "stateMutability": "view", "superFunction": null, "visibility": "public" } ], - "scope": 180, - "src": "27:1182:1" + "scope": 155, + "src": "27:1135:1" } ], - "src": "0:1210:1" + "src": "0:1163:1" }, "compiler": { "name": "solc", @@ -2995,7 +2483,7 @@ } }, "schemaVersion": "3.0.11", - "updatedAt": "2019-08-03T20:07:03.517Z", + "updatedAt": "2019-09-01T01:09:02.936Z", "devdoc": { "methods": {} }, diff --git a/truffle/build/contracts/Migrations.json b/truffle/build/contracts/Migrations.json index f52e361e..601bead4 100644 --- a/truffle/build/contracts/Migrations.json +++ b/truffle/build/contracts/Migrations.json @@ -64,6 +64,7 @@ "type": "function" } ], + "metadata": "{\"compiler\":{\"version\":\"0.4.19+commit.c4cbbb05\"},\"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/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/Migrations.sol\":\"Migrations\"},\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jenilthakker/Desktop/Coding/auction-dapp/truffle/contracts/Migrations.sol\":{\"keccak256\":\"0x525ea46b09fa157a56f0f75a484f88d0f3ad9645406aadce4d84e631096f766e\",\"urls\":[\"bzzr://cef71a9a33d82ef94e686ec7e6805539d226f5c112728356100a6d38a3722b8e\"]}},\"version\":1}", "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582012b6d38f764513f7d1ae544615c507305a6749dc9973ca9c27f09172d2c9cbeb0029", "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582012b6d38f764513f7d1ae544615c507305a6749dc9973ca9c27f09172d2c9cbeb0029", "sourceMap": "27:488:0:-;;;116:58;;;;;;;;159:10;151:5;;:18;;;;;;;;;;;;;;;;;;27:488;;;;;;", @@ -193,7 +194,7 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 198, + "referencedDeclaration": 166, "src": "159:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", @@ -278,7 +279,7 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 198, + "referencedDeclaration": 166, "src": "210:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", @@ -839,7 +840,7 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 198, + "referencedDeclaration": 166, "src": "159:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", @@ -924,7 +925,7 @@ "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 198, + "referencedDeclaration": 166, "src": "210:3:0", "typeDescriptions": { "typeIdentifier": "t_magic_message", @@ -1375,7 +1376,7 @@ } }, "schemaVersion": "3.0.11", - "updatedAt": "2019-08-02T20:49:53.307Z", + "updatedAt": "2019-08-31T22:36:54.641Z", "devdoc": { "methods": {} }, diff --git a/truffle/contracts/auction.sol b/truffle/contracts/auction.sol index 0774d9a6..bdc258b1 100644 --- a/truffle/contracts/auction.sol +++ b/truffle/contracts/auction.sol @@ -12,7 +12,7 @@ contract Auction { // The highest bidder for the auction. address highestBidder; - + function auction() public { seller = msg.sender; } @@ -21,26 +21,20 @@ contract Auction { // initializing bidders & bids. bidders.push(msg.sender); bids.push(msg.value); + + //initializing highestBidder + highestBidder = msg.sender; } - - + function determineWinner() public { - uint256 highestBid = 0; - uint256 i; - - for (i = 0; i < bids.length; i++) { - if (bids[i] > highestBid) { - highestBid = bids[i]; + + bidders[bidders.length-1].transfer( + bids[bids.length -1]); + + // Reset to a new round of auction. + bidders = new address[](0); } - } - highestBidder = bidders[i]; - highestBidder.transfer(highestBid); - - // Reset: for a new auction round. - bidders = new address[](0); - } - function getHighestBidder() view public returns (address) { return highestBidder; }