I have a timelock on an ERC20 contract, from year 0 to 9, it works until year 4, but from year 5 onwards it reverts. It fails both on minting and checking (Using 52 seconds instead of weeks for testing):
constructor() ERC20("Coin", "C") {
deploymentTime = block.timestamp;
}
function checkMintDate(uint8 year) public view returns (uint256){
return deploymentTime + 52 seconds * year;
}
function mint(uint8 year) public onlyOwner {
require (year <= 9, "cannot claim for more than 10 years");
require(block.timestamp >= deploymentTime + 52 seconds * year, "Not that year yet");
require(!yearClaimed[year], "you already claimed that year");
yearClaimed[year] = true;
_mint(msg.sender, yearlyMintAmount);
}
When deployed to the testnet, remix gives this data, which is the overflow one:
"code": "3", "message": "execution reverted", "output": "0x4e487b710000000000000000000000000000000000000000000000000000000000000011"
Any ideas?, thanks!