-
Notifications
You must be signed in to change notification settings - Fork 15
/
WillManager.sol
48 lines (45 loc) · 1.69 KB
/
WillManager.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
/// title: Will Manager to for a Non-Devs' Enjoyment!
/// author: Griff Green
/// notice: This Contract gives the user a chance to interact with the
///blockchain as a novice, it is not actually for Will Validation
contract WillManager {
/// notice: Making these variables public displays them in the Ethereum Wallet.
address public willOwner;
bytes32 public hashOfWill;
bytes32 public hashOfWillBeingChecked;
bool public willIsCorrect;
bool public willCreated;
address public lastWillChecker;
/// notice: This function is called when the contract is deployed and it sets
///the account deploying it as the 'Will owner'
function WillManager(){
willOwner = msg.sender;
}
/// notice: In case you sent ether to 'this' by accident this function will send
///the funds to the 'Will owner.' Don't send funds to this contract
function empty(){
uint256 balance = address(this).balance;
address(willOwner).send(balance);
}
/// notice: This function will only update the 'Hash of will' if called by the
///'Will owner' otherwise it will make 'Will created' display 'No'
function newWill(string will) {
if (msg.sender != willOwner) {
willCreated = false;
} else {
hashOfWill = sha3(will);
willCreated = true;
}
}
/// notice: This function can be called by anyone and is used to verify that
///the version of the Will that they have is the current up-to-date version
function checkWill(string willUserIsChecking) {
lastWillChecker = msg.sender;
hashOfWillBeingChecked = sha3(willUserIsChecking);
if (hashOfWillBeingChecked == hashOfWill) {
willIsCorrect = true;
} else {
willIsCorrect = false;
}
}
}