Skip to content

Instantly share code, notes, and snippets.

@sungjk
Created May 31, 2018 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sungjk/0378c4856fce7966198b46b272e192f9 to your computer and use it in GitHub Desktop.
Save sungjk/0378c4856fce7966198b46b272e192f9 to your computer and use it in GitHub Desktop.
KeyValueStore.sol
contract KeyValueStore {
uint256 keyIndex;
struct values {
string value1;
string value2;
}
mapping (uint256 => values) Obj;
function setValue(string _value1, string _value2) constant returns (uint256) {
Obj[keyIndex].value1 = _value1;
Obj[keyIndex].value2 = _value2;
keyIndex++;
return keyIndex;
}
function getValue1(uint _key) constant returns (string) {
return Obj[_key].value1;
}
function getValue2(uint _key) constant returns (string) {
return Obj[_key].value2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment