Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity >=0.5.0 <0.5.12;
- contract SmartDoor{
- uint8 hour;
- uint8 minute;
- uint8 second;
- // True - закрытие двери, False - открытие двери
- bool last_action;
- constructor() public{
- hour = 0;
- minute = 0;
- second = 0;
- last_action = true;
- }
- function closeDoor(uint8 t_hour, uint8 t_minute, uint8 t_second) public{
- require(last_action == false);
- hour = t_hour;
- minute = t_minute;
- second = t_second;
- }
- function openDoor(uint8 t_hour, uint8 t_minute, uint8 t_second) public{
- require(last_action == true);
- hour = t_hour;
- minute = t_minute;
- second = t_second;
- }
- function getStatus() public view returns (uint8, uint8, uint8, bool){
- return (hour, minute, second, last_action);
- }
- }
Add Comment
Please, Sign In to add comment