-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUser.sol
36 lines (28 loc) · 1.05 KB
/
User.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
pragma solidity ^0.4.8;
contract User {
enum UserType { none, reader, reviewer, writer }
// Maps user Ethereum addresses to internal IDs
mapping (address => uint32) userId;
// Maps user Ethereum addresses to their profiles on IPFS
mapping (address => string) userIpfsHash;
// Maps user Ethereum addresses to accounts types
mapping (address => UserType) userType;
function updateUserId(uint32 id) {
userId[msg.sender] = id;
}
function retrieveUserId(address userAddress) constant returns (uint32) {
return userId[userAddress];
}
function updateUserData(string ipfsHash) {
userIpfsHash[msg.sender] = ipfsHash;
}
function retrieveUserData(address userAddress) constant returns (string) {
return userIpfsHash[userAddress];
}
function updateUserType(UserType newType) {
userType[msg.sender] = newType;
}
function retrieveUserType(address userAddress) constant returns (UserType) {
return userType[userAddress];
}
}