August 2019
Intermediate to advanced
486 pages
13h 52m
English
this is a keyword, used in the contract to get the current contract's type. this is also explicitly convertible to the address type. Here is some sample code explaining the usage of the this and address(this) keywords:
contract ThisExample { address public owner; ThisExample public instance; ThisExample public instanceConverted; address public currentContractAddress; address public currentContractAddressConverted; constructor() public { owner = msg.sender; instance = this; instanceConverted = ThisExample(this); currentContractAddress = this; currentContractAddressConverted = address(this); }}