-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
EscrowSimple.sol
53 lines (35 loc) · 892 Bytes
/
EscrowSimple.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pragma solidity ^0.4.2;
/**
/// @author SergeyPonomarev(JackBekket)
buyer = initiator
seller = executor
Simple Escrow service without hard-modifiers and state VALUES
**/
contract EscrowSimple {
//set variables
address public buyer;
address public seller;
address public arbiter;
//constructor runs once
function EscrowSimple(address _seller, address _arbiter) {
buyer = msg.sender;
seller = _seller;
arbiter = _arbiter;
}
//make payment to seller
function payoutToSeller() {
if(msg.sender == buyer || msg.sender == arbiter) {
if(!seller.send(this.balance)) throw;
}
}
//refund transaction
function refundToBuyer() {
if(msg.sender == seller || msg.sender == arbiter) {
if(!buyer.send(this.balance)) throw;
}
}
//query for balance
function getBalance() constant returns (uint) {
return this.balance;
}
}