Created
April 21, 2016 16:22
-
-
Save aakilfernandes/8b081a58fecfbc36f88098acc3a4f794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract AuctionContract { | |
address owner; | |
address currentWinner; | |
uint minRaise = 1 ether; | |
bool isComplete = false; | |
function bid() { | |
if(isComplete) { | |
throw; | |
} | |
if(msg.value < this.balance + minRaise) { | |
throw; | |
} | |
// return old winner his/her funds | |
currentWinner.send(this.balance); | |
// set the new winner | |
currentWinner = msg.sender; | |
} | |
function complete() { | |
if(msg.sender != owner) { | |
throw; | |
} | |
owner.send(this.balance); | |
isComplete = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment