Created
August 1, 2022 16:09
-
-
Save Ultra-Tech-code/aafb6c59311d5481097c318b12f0d456 to your computer and use it in GitHub Desktop.
My class exercise
This file contains 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
//SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract examole{ | |
uint count; | |
uint timeframe = block.timestamp + 30 seconds; | |
// uint timeframe; | |
modifier timer{ | |
require(timeframe <= block.timestamp, "time has elapsed"); | |
_; | |
} | |
function add() public timer{ | |
count++; | |
} | |
function decrement() public timer{ | |
count--; | |
} | |
function getCount() public view returns(uint){ | |
return count; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the correction to the code: https://gist.github.com/Ultra-Tech-code/f2c723e31bb4e997b1e281216bc38bec
"block.timestamp <= timeframe" here is the correction to it