I have an auction contract that's supposed to run for say 20 minutes.
To facilitate this, I have an auctionEndTime
variable which I initialize in the constructor
as follows:
auctionEndTime = block.timestamp + 20 minutes;
But what if I wanted to update the auctionEndTime
by adding some additional minutes to it?
I wrote a function that lets me pass in the value of the additional minutes I'd wanna add to my auctionEndTime
variable, as follows:
function changeAuctionEndTime(uint extraTimeAmount) public {
require(msg.sender == contractOwner, "ONLY THE CONTRACT's OWNER CAN CALL THIS FUNCTION!");
auctionEndTime += newEndTime minutes;
}
But this immediately gives me the following error:
Expected ';' but got 'minutes'
And it's giving me a squiggly red line under the word minutes
.
So it's clearly not liking something right there. (And note that this error appears immediately - as-in, it's not like I compile and get this error, it's that I can't even compile and run the code as is.)
So what's going on? How do I fix this?