Skip to content

Instantly share code, notes, and snippets.

@aakilfernandes
Created April 21, 2016 16:22
Show Gist options
  • Save aakilfernandes/8b081a58fecfbc36f88098acc3a4f794 to your computer and use it in GitHub Desktop.
Save aakilfernandes/8b081a58fecfbc36f88098acc3a4f794 to your computer and use it in GitHub Desktop.
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