Create deflationary ERC20 token

Hi
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: https://medium.com/balancer-protocol/incident-with-non-standard-erc20-deflationary-tokens-95a0f6d46dea


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.

2 Likes

2 posts were split to a new topic: Help with SafeMath subtraction

A post was split to a new topic: How would you distribute a fee to all token holders?