Property Auction

Contract purpose

Smart Contract for simulating a property auction.

Contract parameters

addr: the location (String) of the property

area : area of the property

propID : unique id of the property

Exposed methods and variables

owner : address of the property owner

price : returns the price of the property set by the owner when he wants to sell it

openBid : true if the bidding process is open

chosenBuyer : address of the buyer approved by the owner

chosenPrice : the bid of the chosen buyer

setPrice called by the owner when he wants to sell the property. The Bidding process can begin only after the price is set

parameter nametypedetails
_priceintegerthe desired selling price

sendBid called by anyone who wants to bid for the property. Will emit the offerReceived event

parameter nametypedetails
_proposedBidintegerthe price a bidder is willing to pay

closeBid enables the owner to close the auction

chooseBuyer the contract will choose the bidder with the highest bid as winner

approveBuyer must be called by the owner after the winner bidder is chosen in order to set it as the buyer. Will emit the buyerChosen event

disapproveBuyer might also be called by the owner in case he does not agree with the chosen bid and he wished to open the auction again

sendMoney payable function called by the winner in order to send the sum he bid. Will emit the moneySent event.

getMoney allows the owner to transfer the money sent by the buyer to his account

getBalance return the balance of the contract



parameter nametypedetails
senderethereum addressthe address of the bidder


parameter nametypedetails
bCethereum addressthe address of the winner


parameter nametypedetails
amountintegerhow much money the winner sent
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract