ERC-20 Token Basics:
ERC-20 is a standard for fungible tokens on Ethereum.
Sample Token Contract:
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;
contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20(“MyToken”, “MTK”) {
_mint(msg.sender, initialSupply * (10 ** decimals()));
}
}
Steps:
Use Remix β enable OpenZeppelin in the plugin manager
Paste the contract and deploy
Test transfers using MetaMask and Remix
Real Use:
Community rewards
In-app currencies
ICOs and fundraising