45 - Address Type
The address type comes in two types:
-
address
: Holds a 20 byte value (size of an Ethereum address) -
address payable
: Same asaddress
, but with the additional memberstransfer
andsend
.address payable
is an address you can send Ether to, while a plainaddress
cannot be sent Ether. -
Operators are
<=
,<
,==
,!=
,>=
and>
-
Conversions: Implicit conversions from
address payable
toaddress
are allowed, whereas conversions fromaddress
toaddress payable
must be explicit viapayable(<address>)
. Explicit conversions to and fromaddress
are allowed foruint160
, integer literals,bytes20
and contract types. -
Only expressions of type
address
and contract-type can be converted to the typeaddress payable
via the explicit conversionpayable(...)
. For contract-type, this conversion is only allowed if the contract can receive Ether, i.e., the contract either has a receive or a payable fallback function.
- Account Address: EOA/Contract
- Keyword:
account
(payable) 20 Bytes - Operators are
<=
,<
,==
,!=
,>=
and>
- Implicit/Explicit Conversions
- Security: Critical
- Access Control, Balances etc.