Create deflationary ERC20 token

I want an ERC20 token with burning function like this (How to create an ERC20 Token with burn and stop burn feature?) if an wallet have <=1,00 to XYZ token then when transfer from this wallet to any wallet any amount then 5% will burn, and if the wallet holding <=5,00 XYZ token then burn 4% and if the wallet holding <=1,000 XYZ then burn 3% like same way if <=5,000 XYZ burn 3%, if <=10,000 XYZ burn 2% and if holding >=20,000 then burn only 0%

Thanks for help and give your time ! :revolving_hearts:

1 Like

Hi @Rahaman,

First of all, I suggest looking at Points to consider when creating a fungible token (ERC20, ERC777)

Tokens should be appropriately tested and audited, along with ensuring regulatory compliance.

:warning: A deflationary token can cause issues such as this recent issue:

If you wanted to proceed, I suggest looking at extending from ERC20PresetMinterPauser.

You could then override _beforeTokenTransfer to make any modifications to the amount such as burning. See Using Hooks for more details.

You would need to check that both from and to are non-zero so that you only do this for transfers and not for mint or burn.