Solidity theorytheory 0/50 · 0%
Foundations · easy

17. Units: wei, gwei, ether and time

Built-in unit suffixes.

Solidity understands `wei`, `gwei` and `ether` for value and `seconds`, `minutes`, `hours`, `days` and `weeks` for time. They are literal multipliers, not types.

require(msg.value >= 0.01 ether, "min 0.01");
uint256 lock = block.timestamp + 7 days;

1 ether is 10^18 wei and 1 gwei is 10^9 wei — gas prices are quoted in gwei.

Check your understanding

  1. 1. How many wei are in 1 ether?

  2. 2. What does `7 days` evaluate to?

  3. 3. Gas prices are usually quoted in…