Skip to content

Instantly share code, notes, and snippets.

@pelle
Created January 10, 2016 21:14
Show Gist options
  • Save pelle/38cde143e314a91b8362 to your computer and use it in GitHub Desktop.
Save pelle/38cde143e314a91b8362 to your computer and use it in GitHub Desktop.
Simple Escrow with Agent
contract Escrow {
address buyer;
address seller;
address agent;
function Escrow(address _agent, address _seller) {
// In this simple example, the person sending money is the buyer and sets up the initial contract
buyer = msg.sender;
agent = _agent;
seller = _seller;
}
function release() {
if (msg.sender == agent)
suicide(seller); // Send all funds to seller
else
throw;
}
function cancel() {
if (msg.sender == agent)
suicide(buyer); // Cancel escrow and return all funds to buyer
else
throw;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment