Explain solidity>constants

Fixed Values with Constants

Some values never change and should be fixed. These are called constants.

The constant Keyword:

Constants are values that can't be changed after deployment.

They save gas because they're stored in the contract's bytecode, not in storage.

uint constant TIMEOUT = 3600;



Naming Convention:

Constants use UPPER_CASE names by convention.



The uint64 Type:

For timestamps, we use uint64 instead of uint.

It's smaller (saves gas) but still large enough for timestamps.



Timeout Constants:

Add two constants for game timeouts:

uint64 constant ACCEPT_TIMEOUT = 1 days;

uint64 constant MOVE_TIMEOUT = 1 days;



These define how long players have to accept or make moves.

Add timeout constants
0%
Requirements:
Declares ACCEPT_TIMEOUT constant
ACCEPT_TIMEOUT is uint64
ACCEPT_TIMEOUT equals 1 days
Declares MOVE_TIMEOUT constant
MOVE_TIMEOUT is uint64
MOVE_TIMEOUT equals 1 days
Constants are at top of contract