-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsigner.sol
35 lines (30 loc) · 1.07 KB
/
signer.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
pragma solidity ^0.4.6;
contract Signer {
address public owner = msg.sender;
struct Agreement {
string stringToAgreeOn;
bool signed;
bool initialized;
}
mapping (address=> Agreement) agreements;
modifier onlyBy(address _account)
{
require(msg.sender == _account);
_;
}
function createAgreement(string _stringToAgreeOn, address customer) payable public onlyBy(owner) returns (bool success) {
agreements[customer] = Agreement(_stringToAgreeOn, false, true);
return true;
}
function signAgreement() payable public returns (bool success) {
var agreement = agreements[msg.sender];
require(agreement.initialized == true);
require(agreement.signed == false);
agreement.signed = true;
return true;
}
function getAgreement(address addr) public constant returns(string stringToAgreeOn, bool signed, bool initialized) {
var agreement = agreements[addr];
return (agreement.stringToAgreeOn, agreement.signed, agreement.initialized);
}
}