'MyToken' Smart Contract is the implementation of a custom-made token on the Ethereum blockchain. It contains functionalities for minting and burning tokens. It also maintains the total supply and keeps track of balances for each address.
- Public Token Information: The contract stores and provides public access to the token's name, abbreviation, and total supply.
- Mapping of Addresses to Balances: A mapping is used to associate each address with its respective balance of tokens.
- Mint Function: Allows new tokens to be created and assigned to a specified address.
- Burn Function: Allows tokens to be destroyed from a specified address, provided the address has enough tokens.
- TokenName: The name of the token.
- TokenAbbrv: The abbreviation (symbol) of the token.
- TotalSupply: The total supply of tokens currently in circulation.
BalanceOf: Maps each address to its balance of tokens.
Mints new tokens to the specified address and increases the total supply.
Burns tokens from the specified address and decreases the total supply, ensuring the address has enough tokens.
- _address: The address from which the tokens will be burned.
- _value: The amount of tokens to burn.
The function checks if the address has a balance greater than or equal to the amount to be burned. If the address has sufficient balance, the tokens are burned and the total supply is reduced. If the balance is insufficient, the burn operation is not executed.
- Open the Remix IDE or any other Solidity-compatible IDE.
- Copy and paste the contract code into a new Solidity file.
- Compile the contract using the Solidity compiler version 0.8.18.
- Deploy the contract to an Ethereum network (e.g., Ethereum mainnet, testnet, or local blockchain).
Paras Aggarwal
Parasaggarwal7172gmail.com