English 中文(简体)
Solidity - Ether Units
  • 时间:2024-09-17

Sopdity - Ether Units


Previous Page Next Page  

In sopdity we can use wei, finney, szabo or ether as a suffix to a pteral to be used to convert various ether based denominations. Lowest unit is wei and 1e12 represents 1 x 1012.

assert(1 wei == 1);
assert(1 szabo == 1e12);
assert(1 finney == 1e15);
assert(1 ether == 1e18);
assert(2 ether == 2000 fenny);

Time Units

Similar to currency, Sopdity has time units where lowest unit is second and we can use seconds, minutes, hours, days and weeks as suffix to denote time.

assert(1 seconds == 1);
assert(1 minutes == 60 seconds);
assert(1 hours == 60 minutes);
assert(1 day == 24 hours);
assert(1 week == 7 days);
Advertisements