Skip to content

Instantly share code, notes, and snippets.

@iktakahiro
Created December 29, 2015 18:05
Show Gist options
  • Save iktakahiro/5461dcc1e4d94e682dbd to your computer and use it in GitHub Desktop.
Save iktakahiro/5461dcc1e4d94e682dbd to your computer and use it in GitHub Desktop.
Solidity Example - record of reading
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