Skip to content

Instantly share code, notes, and snippets.

@lyhistory
Created January 31, 2019 02:13
Show Gist options
  • Save lyhistory/57beb322a4df936c9f80a20dc4183f8b to your computer and use it in GitHub Desktop.
Save lyhistory/57beb322a4df936c9f80a20dc4183f8b to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity >=0.4.0 <0.6.0;
contract UnitExample {
function test() public {
assert(1 wei == 1);
assert(1 szabo == 1e12);
assert(1 finney == 1e15);
assert(1 ether == 1e18);
//The suffix years has been removed in version 0.5.0 due to::
//Take care if you perform calendar calculations using these units, because not every year equals 365 days and not
//even every day has 24 hours because of leap seconds. Due to the fact that leap seconds cannot be predicted, an exact
//calendar library has to be updated by an external oracle
assert(1 seconds == 1);
assert(1 minutes == 60 seconds);
assert(1 hours == 60 minutes);
assert(1 days == 24 hours);
assert(1 weeks == 7 days);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment