Helping programming auto burn and auto stop burn on erc20.sol 0.8.0

Hi,

I’m working on a smart contract right now and want to replace the cab burn fuction with an auto burn function that will burn 10% of all transactions. In addition to this I am wanting the contract to stop burning at 10,000,000 coins.

I’m fairly new to solidity, and while I understand everything the erc20.all contract is doing, I’m just to inexperienced to program that specific of a function and be certain of it working correctly.

So far I haven’t been able to find any resources on the creation or implementation of this exact function.

I’m open to either someone helping directly or pointing me towards a resource or implementation I can study and program on my own.

Thanks in advance for any help!

Hi @CodingIdiot welcome to the Open Zeppelin Forums.

So far I haven’t been able to find any resources on the creation or implementation of this exact function.

It might not exist. The point of resources and tutorials isn't to give you what you want exactly. It's to teach you so that you can do anything you want with your projects.

A great starting point is

Then refer to

Your spec can be created by making a global uin256 that tracks the amount burned.

If the amount burned is >= 10,000,000 token then don't do the burn.

For the burning operation itself, you would call the burn function upon transfer if the amount burned is less than 10,000,000.

Thank you for this, I’m happy to learn and try to come up with it on my own. But ya know, if there’s a prior implementation that can be used, makes life a lot easier. Haha.

I think with your advice and these resources I’ll get it down this weekend.

Thanks again!

1 Like

Good luck! If you’re confused about a specific thing we can help. There is a ton of innovation in this space yet to be done. If you can dream it up, you can also build it.