MyToken

Git Source

Inherits: ERC20, Ownable

Implementation of the ERC20 standard with ownership features

Inherits from ERC20 and Ownable contracts from OpenZeppelin

Functions

constructor

Constructs the MyToken contract

Sets token name to "MyToken" and symbol to "MTK"

constructor(address initialOwner) ERC20("MyToken", "MTK") Ownable(initialOwner);

Parameters

NameTypeDescription
initialOwneraddressThe address that will be granted initial ownership of the token

mint

Allows the current owner to mint new tokens

Restricted to be callable only by the contract owner

function mint(address to, uint256 amount) public onlyOwner;

Parameters

NameTypeDescription
toaddressThe address that will receive the minted tokens
amountuint256The amount of tokens to mint