Created
February 17, 2018 19:24
-
-
Save mikec/6377b1b17ab89fb97744b47af2ae8d2b to your computer and use it in GitHub Desktop.
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 KeyValueStorage { | |
mapping(address => mapping(bytes32 => uint256)) _uintStorage; | |
mapping(address => mapping(bytes32 => address)) _addressStorage; | |
mapping(address => mapping(bytes32 => bool)) _boolStorage; | |
/**** Get Methods ***********/ | |
function getAddress(bytes32 key) public view returns (address) { | |
return _addressStorage[msg.sender][key]; | |
} | |
function getUint(bytes32 key) public view returns (uint) { | |
return _uintStorage[msg.sender][key]; | |
} | |
function getBool(bytes32 key) public view returns (bool) { | |
return _boolStorage[msg.sender][key]; | |
} | |
/**** Set Methods ***********/ | |
function setAddress(bytes32 key, address value) public { | |
_addressStorage[msg.sender][key] = value; | |
} | |
function setUint(bytes32 key, uint value) public { | |
_uintStorage[msg.sender][key] = value; | |
} | |
function setBool(bytes32 key, bool value) public { | |
_boolStorage[msg.sender][key] = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment