This is an ERC20 token contract named MiaToken (MIA). It is implemented in Solidity and inherits from OpenZeppelin's ERC20 contract. MiaToken allows token minting by the contract owner, token burning by any user, and standard token transfer functionalities.
- Transfer Tokens: Users can transfer tokens to other addresses using the
transferfunction. - Mint Tokens: Only the contract owner (the address that deployed the contract) can mint new tokens using the
mintfunction. - Burn Tokens: Any user can burn their own tokens using the
burnfunction.
-
Compile Contract:
- Copy the Solidity code for
MiaTokeninto Remix IDE or your preferred Solidity IDE. - Compile the contract using a Solidity compiler version compatible with
^0.8.13.
- Copy the Solidity code for
-
Deploy Contract:
- In Remix, select the
Deploy & Run Transactionstab. - Choose
MiaTokenfrom the contract dropdown. - Enter the initial supply parameter for deployment.
- In Remix, select the
-
Interact with Contract:
- After deployment, you can interact with the contract using the provided interface in Remix.
- To test the functions' modifications, switch accounts from the contract owner address to other addresses.
- Initial Supply - Set an initial supply of tokens before deploying the contract.
- Mint Function - requires an address to mint tokens to and the amounts of tokens to be minted.
- using the account that deployed the contract, you can mint any amount of tokens to any account address.
- if you switch to a different account in the account dropdown below the environment options, you should receive an error saying "You are not the owner."
- Burn Function - requires an address to burn tokens from and the amount of tokens to be burned.
- using any account, you can burn the tokens from an account address given that the account entered has enough tokens. If not, you should receive an error saying "ERC20: burn amount exceeds balance."
- Transfer Function - requires an address to transfer tokens to and the amounts of tokens to be transferred.
- using any account, you can transfer tokens to any account given that you have enough balance for the transaction. If not, you should receive an error saying "ERC20: transfer amount exceeds balance."
- BalanceOf Function - requires the address of the account to be checked.
- to confirm if any of transactions made (mint, burn, transfer) were successful, you can use this function to check the token balance of the accounts involved in the transactions.
Mia Enciso