Skip to content

Instantly share code, notes, and snippets.

@stupeters187
Created October 12, 2018 19:32
Show Gist options
  • Save stupeters187/6b9d00125aa470075d3102c72eab6738 to your computer and use it in GitHub Desktop.
Save stupeters187/6b9d00125aa470075d3102c72eab6738 to your computer and use it in GitHub Desktop.
Escrow
pragma solidity ^0.4.25;
contract Escrow {
address public buyer;
address public seller;
address public arbiter;
uint256 public escrowAmount;
constructor(address _buyer, address _arbiter, uint256 _escrowAmount) public {
seller = msg.sender;
buyer = _buyer;
arbiter = _arbiter;
escrowAmount = _escrowAmount;
}
function fund() payable public {
require(msg.value == escrowAmount);
}
function payoutSeller() public {
require(msg.sender == buyer || msg.sender == arbiter);
seller.transfer(address(this).balance);
}
function refundBuyer() public {
require(msg.sender == seller || msg.sender == arbiter);
buyer.transfer(address(this).balance);
}
function contractBalance() public view returns (uint256){
return address(this).balance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment