Created
December 29, 2015 18:05
-
-
Save iktakahiro/5461dcc1e4d94e682dbd to your computer and use it in GitHub Desktop.
Solidity Example - record of reading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract proofOfBook { | |
mapping(string => uint) books; | |
mapping(address => Log) logs; | |
struct Log { | |
string isbn; | |
uint date; | |
uint rate; | |
} | |
Log x; | |
function getMyLog() returns(string x) { | |
x = logs[msg.sender].isbn; | |
return x; | |
} | |
function getCount(string isbn) returns(uint count) { | |
count = books[isbn]; | |
} | |
function logging(string isbn, uint date, uint rate) returns(bool) { | |
logs[msg.sender] = Log(isbn, date, rate); | |
books[isbn] += 1; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment