-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathescrow_contract.sol
More file actions
37 lines (32 loc) · 869 Bytes
/
escrow_contract.sol
File metadata and controls
37 lines (32 loc) · 869 Bytes
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
pragma solidity ^0.5.0;
contract Escrow {
address buyer;
address seller;
uint amount;
function escrow() public{
// setBuyer
buyer = msg.sender;
}
function setSellerAndAmt(address sellerAddress, uint amt)public payable {
seller = sellerAddress;
if (msg.value >= amt) {
amount = amt;
}
}
function getSellerAndBuyerDetails()public view returns(address, address, uint){
return(seller,buyer,amount);
}
function release() public {
//Only allow buyer to release the funds
if (msg.sender == buyer) {
seller.transfer(amount);
selfdestruct(buyer);
}
}
function void() public {
//Only allow seller to void the contract
if (msg.sender == seller) {
selfdestruct(buyer);
}
}
}