ERC20 Burn on transfer (deflationary token)

I have an issue I need help on with the burn function of my contract. For example, if my token has a total supply of 5000 and It starts burning each transaction by 10% until it hits 3500 supply then increases burn on transactions to 20% until the supply is 2000 then finally increasing the burn per transaction to 30% until 500 supply is reached where at that point I can stop the burn function. How would I implement that?

Any help would be greatly appreciated!

1 Like

Write logic in the transfer and transferFrom, in your case, maybe just like

if (totalSupply <= 5000 && totalSupply > 3500) {
} else if (totalSupply <= 3500 && totalSupply > 2000) {
} else if (totalSupply <= 2000 && totalSupply > 500) {

Ohhhh, just write in this internal function: function _transfer(address sender, address recipient, uint256 amount) internal


Hi @RC5858,

Welcome to the community. :wave:

I recommend looking at the following too:

1 Like

Thankyou both of you for the input. I wasn’t aware of the risks to making a deflationary token. How are devs getting around this currently? Obviously doing my research on that part now that you brought it to my attention.

1 Like

Hi @RC5858,

I don’t know how developers of deflationary tokens are dealing with these issues.

Feel free to share what research you find. Though I would be very cautious with deflationary tokens and have appropriate system testing on all services that you plan to use and appropriate auditing.