Unfamiliar data types
Value types

Mapping
- Key-value map implemented as a hash table
- so it is NOT sorted → cannot iterate through it unlike a map in C++
- else use an array
mapping(_KeyType => _ValueType)
- _KeyType − can be any built-in types plus bytes and string. No reference type or complex objects are allowed.
- _ValueType − can be any type.
Address
- Holds the 20 byte value representing public key of an Ethereum address
- address.balance(), address.transfer() functions
address payable
: Same as address
, but with the additional members transfer
and send
address payable
is an address you can send Ether to, while you are not supposed to send Ether to a plain address
, for example because it might be a smart contract that was not built to accept Ether
address payable x = 0x212...;
address myAddress = this;
if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10);
Bytes
- byte = 8 bits of data
- can use
bytes1
- bytes32
in Solidity
- often used as alternatives to
string
in Solidity to save gas (but both exist)