Once we have imported PHX network, lets deploy a ERC20 contract! We will create a custom ERC20 token contract like TestTest (TT).
*Note that we will be using OpenZeppelin SDK (https://docs.openzeppelin.com/) for this example.*
Here’s an example of our TT token:
// contracts/TTToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;
contract TTToken is ERC20 {
constructor(uint256 initialSupply) ERC20(“TestTest”, “TT”) {
_mint(msg.sender, initialSupply);
}
}
ERC20 is the standard implementation and the elective extensions are name, symbol, and decimals. Furthermore, by establishing initialsupply of tokens we can allocate it to the deploying address of the contract.
> TTToken.balanceOf(deployerAddress)
100000000
And to transfer to other accounts:
> TTToken.transfer(otherAddress, 30000000)
> TTToken.balanceOf(otherAddress)
30000000
> TTToken.balanceOf(deployerAddress)
70000000
For a list of full commands available on ERC 20, reference:
https://eips.ethereum.org/EIPS/eip-20