I am learning solidity and have decided to program my own ERC-20 token. I have inherited the ERC-20 Open Zeppelin standard, but would like to add some functionality that calculates 5% of every transfer, and then burns that amount from the total supply. Here is what I have so far:
- I have created two functions: calculateBurnAmount, and burn. These functions calculate 5% of the amount being transferred, and then call the OpenZeppelin burn function while passing it that amount.
- In order for the smart contract to "know" to burn tokens on transfer, they have to be called in the transfer function itself, correct? Did I correctly implement this by listing the transfer function and then calling the two burn functions in the logic body?