-
Notifications
You must be signed in to change notification settings - Fork 4
Default Values
boolean
: False
string
: ""
int
: 0
uint
: 0n
enum
: the first element of the enum - enum[NAME_OF_FIRST_KEY]
address
: ("tz1ZZZZZZZZZZZZZZZZZZZZZZZZZZZZNkiRg": address)
mapping
: (map end: map(key_type, value_type))
- an empty map
struct
: a struct where all members are set to initial values
array
: (map end: map(nat, value_type))
- nat
is the index of map
timestamp
: abs(now - (\"1970-01-01T00:00:00Z\" : timestamp))
- since Solidity timestamp is stored in uint
to emulate the same behaviour we convert Tezos timestamp typed value by subtracting "beginning of unix times" from it
We chose to go with tz1ZZZZZZZZZZZZZZZZZZZZZZZZZZZZNkiRg
since it is superultra computationally difficult to find private key for public key corresponding to hash producing this address. We would go with all 'Z' for that matter, but Tezos addresses should be checksummed, therefore a suffix has to be present.
To generate such an address bs58check npm package can be used like so:
- Come up with an address with allowed characters (KLMNPQRSTUVWXYZabcdefghi)(?) or numbers
- Remove checksum validation from
decode
function - Encode resulting bytes to get address with checksum
Arrays in Solidity are continious, whereas in LIGO, since it is represented by mapping, key can be an arbitrary value. Also there is no direct way to push
or pop
into mapping