Created
January 16, 2018 03:18
-
-
Save zabirauf/bf011d3163ddd41d5b71dab70bdb21b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Code for PersonsAge.sol | |
pragma solidity ^0.4.15; | |
import { StringToUintMap } from "../libraries/StringToUintMap.sol"; | |
contract PersonsAge { | |
StringToUintMap.Data private _stringToUintMapData; | |
event PersonAdded(string name, uint8 age); | |
event GetPersonAgeResponse(string name, uint8 age); | |
function addPersonAge(string name, uint8 age) public { | |
StringToUintMap.insert(_stringToUintMapData, name, age); | |
PersonAdded(name, age); | |
} | |
function getPersonAge(string name) public returns (uint8) { | |
uint8 age = StringToUintMap.get(_stringToUintMapData, name); | |
GetPersonAgeResponse(name, age); | |
return age; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment