pragma solidity ^0.4.24; contract Timesheet { address employee; mapping(uint => uint) times; // day (starting 1.1.1970) -> hours worked constructor(address _employee) public { employee = _employee; } function logWork(uint _day, uint _hours) public { // only accept work logged by employee: if (msg.sender != employee) { return; } times[_day] = _hours; emit WorkLogged(_day, _hours); // logging } function getHoursWorked(uint _day) public constant returns (uint hoursWorked) { hoursWorked = times[_day]; } // Event (=logging) for logged work event WorkLogged(uint _day, uint _hours); }
0.4.24