Created
May 31, 2018 06:21
-
-
Save sungjk/0378c4856fce7966198b46b272e192f9 to your computer and use it in GitHub Desktop.
KeyValueStore.sol
This file contains 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 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