November 2018
Intermediate to advanced
528 pages
13h 21m
English
Our basic implementation is now complete, and can be compiled by running the following from our project directory:
truffle compile
Here is the full code of our token sale contract as is. You will notice that an additional helper function, safeMultiply(), has been added – this will be explained in the next section:
pragma solidity ^0.4.24;import "./PacktToken.sol";contract PacktTokenSale { PacktToken public tokenContract; uint256 public tokenPrice; uint256 public tokensSold; address owner; event Sell(address indexed _buyer, uint256 indexed _amount); constructor(PacktToken _tokenContract, uint256 _tokenPrice) public { owner = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice; } function ...Read now
Unlock full access