August 2019
Intermediate to advanced
486 pages
13h 52m
English
The address data type represents the public address of an external account or a smart contract. An address data type stores 20 bytes value that represents an Ethereum address. An Ethereum address is always represented in hexadecimal and prefixed with 0x. This makes the address of an Ethereum look something like 0xFf899Af34214B0D777bcD3c230EF637B763F0B01.
An address data type is declared and assigned a value as shown in the following code:
address owner = 0xFf899Af34214B0D777bcD3c230EF637B763F0B01; //Fixed value without quotesaddress sender = msg.sender; //Assignmentaddress emptyAddress = address(0); //Sets the address to 0x0 address current = address(this); //Assigns current contract's addressrequire(msg.sender == owner); ...