forked from KayinCheung/KayinCheung.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEscrowMyEtherEntityDB.sol
82 lines (51 loc) · 2.09 KB
/
EscrowMyEtherEntityDB.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
pragma solidity ^0.4.8;
contract EscrowMyEtherEntityDB {
//Author: Cheung Ka Yin
//Date: 11 Jul 2017
//Version: EscrowMyEtherEntityDB v1.0
address public owner;
//Entity struct, used to store the Buyer, Seller or Escrow Agent's info.
//It is optional, Entities can choose not to register their info/name on the blockchain.
struct Entity{
string name;
string info;
}
mapping(address => Entity) public buyerList;
mapping(address => Entity) public sellerList;
mapping(address => Entity) public escrowList;
//Run once the moment contract is created. Set contract creator
function EscrowMyEtherEntityDB() {
owner = msg.sender;
}
function() payable
{
//LogFundsReceived(msg.sender, msg.value);
}
function registerBuyer(string _name, string _info)
{
buyerList[msg.sender].name = _name;
buyerList[msg.sender].info = _info;
}
function registerSeller(string _name, string _info)
{
sellerList[msg.sender].name = _name;
sellerList[msg.sender].info = _info;
}
function registerEscrow(string _name, string _info)
{
escrowList[msg.sender].name = _name;
escrowList[msg.sender].info = _info;
}
function getBuyerFullInfo(address buyerAddress) constant returns (string, string)
{
return (buyerList[buyerAddress].name, buyerList[buyerAddress].info);
}
function getSellerFullInfo(address sellerAddress) constant returns (string, string)
{
return (sellerList[sellerAddress].name, sellerList[sellerAddress].info);
}
function getEscrowFullInfo(address escrowAddress) constant returns (string, string)
{
return (escrowList[escrowAddress].name, escrowList[escrowAddress].info);
}
}