Skip to content

Instantly share code, notes, and snippets.

@casweeney
Created August 1, 2022 17:58
Show Gist options
  • Save casweeney/c8451dae53ef20b724b943b6d85e29c8 to your computer and use it in GitHub Desktop.
Save casweeney/c8451dae53ef20b724b943b6d85e29c8 to your computer and use it in GitHub Desktop.
Jesserc Implementation
// SPDX-License-Identifier: MIT;
pragma solidity ^0.8.7;
contract Counter{
uint public count;
uint timer = 0;
error timeNotReached(string);
bool reached = false;
modifier requiredTime(){
if(block.timestamp < timer){
revert timeNotReached("Sorry wait till 30 seconds");
}
_;
}
function increment() public requiredTime {
updateTime(block.timestamp + 30 seconds);
count++;
}
function decrement() requiredTime public{
count--;
updateTime(block.timestamp + 30 seconds);
}
function updateTime(uint _timer) internal{
timer = _timer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment