Guest User

Untitled

a guest
Jun 24th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. pragma solidity ^0.4.24;
  2.  
  3. import "./Ownable.sol";
  4. contract Counter is Ownable {
  5. /* Define counter of type integer */
  6. int counter;
  7.  
  8. /* This runs when the contract is executed */
  9. constructor() public {
  10. counter = 0;
  11. }
  12.  
  13. /* Resets counter to zero. Only callable by the creator of the contract */
  14. function reset() public onlyOwner {
  15. counter = 0;
  16. }
  17.  
  18. /* Simple function to add 1 to the counter */
  19. function add() public {
  20. counter += 1;
  21. }
  22.  
  23. /* Returns the counter. Does not cost gas. */
  24. function getCounter() public view returns (int) {
  25. return counter;
  26. }
  27. }
Add Comment
Please, Sign In to add comment