November 2018
Intermediate to advanced
528 pages
13h 21m
English
The constructor of our token sale contract will take two arguments:
At the head of our contract, we will assign two public state variables to hold the values passed into the constructor. Importantly, we use the type definition from our token contract when assigning the passed-in address:
contract PacktTokenSale { PacktToken public tokenContract; uint256 public tokenPrice; address owner; constructor(PacktToken _tokenContract, uint256 _tokenPrice) public { owner = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice; } }Read now
Unlock full access