In Solidity, We have literal numbers that can be suffixed with units. There are different types of units

  • Ether Units
  • Time Units

Ether or Currency Units

Ether Units are currency denominations of an Ether unit. The number can be suffixed with Ether Units for denominations of Ether units.

  • Wei
  • Finney
  • szabo
  • ether

The smallest Unit is wei which is equal to 1 x 10 power 12. the base unit is Etheṛ

Let’s a denomination for each 1 Ether unit.

Ether Units 1 Ether =?
wei 1000000000000000000
szabo 1000000
finney 1000
ether 1

Here is an example

// true condition
if(1 wei == 1){
    // true code
}

Time Units

In Solidity, time-based data are represented in Time Units. The lowest unit is 1 Second.

Numbers are suffixed with the below types to represent time

  • seconds

  • minutes

  • hours

  • days

  • weeks

  • years