Skip to content

Default Values

Julian Konchunas edited this page Aug 20, 2020 · 4 revisions

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

Address

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:

  1. Come up with an address with allowed characters (KLMNPQRSTUVWXYZabcdefghi)(?) or numbers
  2. Remove checksum validation from decode function
  3. Encode resulting bytes to get address with checksum

Arrays

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

Clone this wiki locally