Skip to content

Instantly share code, notes, and snippets.

@babedev
Created April 21, 2017 06:36
Show Gist options
  • Save babedev/2f5d9db84b5d3cd036c46d9401b1b5c0 to your computer and use it in GitHub Desktop.
Save babedev/2f5d9db84b5d3cd036c46d9401b1b5c0 to your computer and use it in GitHub Desktop.
Sample report contract
pragma solidity ^0.4.7;
contract Report {
struct report {
uint id;
string detail;
}
mapping(uint => report) public reports;
function write(uint id, string detail) {
report memory newReport = report(id, detail);
reports[id] = newReport;
}
function getReport(uint id) constant returns (string detail) {
return reports[id].detail;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment