forked from worknation/work.nation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClaim.sol
40 lines (33 loc) · 992 Bytes
/
Claim.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
pragma solidity ^0.4.10;
contract Claim {
string[] public claims;
mapping (string => address) claimSigner;
uint256 public claimCount;
function put(string _claim) returns (bool _success) {
if (claimSigner[_claim] > 0) return false;
claimSigner[_claim] = msg.sender;
claims.push(_claim);
claimCount++;
return true;
}
// normally we would overload `put(...)`, but solidity function overloading seems
// not correctly supported by the browser libraries we use :(
function put2(string _claim1, string _claim2) returns (bool _success) {
var result1 = put(_claim1);
var result2 = put(_claim2);
return result1 && result2;
}
function getSigner(string claim) returns (address _signer) {
return claimSigner[claim];
}
function getClaim(uint256 index) returns (string _claim) {
return claims[index];
}
function whoami() returns (address) {
return msg.sender;
}
// throw on malformed calls
function () {
throw;
}
}