LIGO features timestamps, as Michelson does, while bakers baking the block (including the transaction in a block) are responsible for providing the given current timestamp for the contract.
Starting time of the current block
You can obtain the starting time of the current block using the
Tezos.get_now. This timestamp does not change during the execution
of the contract. Please be aware that it is up to the baker to set the
current timestamp value.
When running code, the LIGO CLI option
--nowallows you to control what
In LIGO, timestamps can be added to integers, allowing you to set time constraints on your smart contracts. Consider the following scenarios.
In 24 hours
24 hours Ago
Timestamps can be subtracted, that means, we can use minus (
-) between two timestamps:
Notice that the result of such subtraction is an
int, which describes the difference in seconds between the two timestamps.
You can compare timestamps using the same comparison operators applying to numbers.
address type in LIGO denotes Tezos addresses (tz1, tz2, tz3,
KT1, ...). Currently, addresses are created by casting a string to the
address type. Beware of failures if the address is invalid. Consider
the following examples.
signature type in LIGO datatype is used for Tezos signatures
(edsig, spsig). Signatures are created by casting a string. Beware of
failure if the signature is invalid.
Here is how you can define a signature:
key type in LIGO is used for Tezos public keys. Do not confuse
them with map keys. Keys are made by casting strings. Beware of
failure if the key is invalid.
Here is how you can define a key.