Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ultra-Tech-code/aafb6c59311d5481097c318b12f0d456 to your computer and use it in GitHub Desktop.
Save Ultra-Tech-code/aafb6c59311d5481097c318b12f0d456 to your computer and use it in GitHub Desktop.
My class exercise
//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;
}
}
@Ultra-Tech-code
Copy link
Author

This is the correction to the code: https://gist.github.com/Ultra-Tech-code/f2c723e31bb4e997b1e281216bc38bec

"block.timestamp <= timeframe" here is the correction to it

modifier timer{
    require(timeframe <= block.timestamp, "time has elapsed");
    _;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment