The MSTToken.sol contract

According to our contract design and architecture, we created the MSTToken.sol contract. The following is the code for the MSTToken.sol contract:

pragma solidity >=0.5.0 <0.6.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";

contract MSTToken is
ERC20Burnable, ERC20Pausable, ERC20Mintable, ERC20Detailed {

constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
)
ERC20Detailed(_name, _symbol, _decimals)
public
{
// solium-disable-previous-line no-empty-blocks
}
}

At the first line of the contract file, we defined the Solidity compiler version to be used. For this contract, we require a compiler version greater than or equal to version 0.5.0, and lesser than version 0.6.0. Next, we imported the OpenZeppelin library contracts that we are going to use in this contract.

At the start of the contract block, we defined the contract name, MSTTokenThis contract inherits from the ERC20BurnableERC20PausableERC20Mintable, and ERC20Detailed contracts. We discussed the features of these individual contracts in detail in this chapter's Contract architecture design section.

The constructor of the contract takes three parameters—the name (for contract name), symbol (for contract symbol), and decimals (number of decimals to support). These parameters are passed to the constructor of the ERC20Detailed contract. This will initialize the MST token metadata at the time of deployment. The constructor block is empty and, to remove the solium warning message, we added the solium disable comment.

Once the contract is deployed by the deployer's wallet, the deployer will be, by default, assigned PauserRole and MinterRole. These roles will allow the deployer to pause and unpause the transfers, and will also allow them to mint any number of tokens.

Our MST token contract has been created. Now, we will create the MSTCrowdsale.sol contract.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.28.247