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

**URL:** <https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413>\
**Category:** General\
**Tags:** erc20, design\
**Created:** [May 15, 2021, 12:31am UTC](https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413 "2021-05-15T00:31:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingIdiot](https://avatars.discourse-cdn.com/v4/letter/c/a587f6/32.png) [@CodingIdiot](https://forum.openzeppelin.com/u/CodingIdiot)\
**Post date:** [May 15, 2021, 12:31am UTC](https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413/1 "2021-05-15T00:31:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Yoshiko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/yoshiko/32/6858_2.png) [@Yoshiko](https://forum.openzeppelin.com/u/Yoshiko)\
**Post date:** [May 15, 2021, 5:16am UTC](https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413/2 "2021-05-15T05:16:06Z")

</div>

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

> [@OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat](https://forum.openzeppelin.com/t/openzeppelin-upgrades-step-by-step-tutorial-for-hardhat/3580):
>
> OpenZeppelin Hardhat Upgrades Smart contracts deployed with the OpenZeppelin Upgrades plugins can be upgraded to modify their code, while preserving their address, state, and balance. This allows you to iteratively add new features to your project, or fix any bugs you may find in production. In this guide, we will show the lifecycle using OpenZeppelin Hardhat Upgrades and Gnosis Safe from creating, testing and deploying, all the way through to upgrading with Gnosis Sa…

Then refer to

> [@Solidity learning resources](https://forum.openzeppelin.com/t/solidity-learning-resources/4242):
>
> The following is a list of Solidity learning resources. This is a wiki post that you can edit and add to. OpenZeppelin Learn Guides [https://docs.openzeppelin.com/learn/](https://docs.openzeppelin.com/learn/)Play [Ethernaut](https://ethernaut.openzeppelin.com/) + [Ethernaut Community Solutions](https://forum.openzeppelin.com/t/ethernaut-community-solutions/561)[Damn Vulnerable DeFi](https://www.damnvulnerabledefi.xyz/) + [Community Solutions to Damn Vulnerable DeFi](https://forum.openzeppelin.com/t/community-solutions-to-damn-vulnerable-defi/4744)books Read Security Audits Best practices [https://consensys.github.io/smart-contract-best-practices/](https://consensys.github.io/smart-contract-best-practices/)Books Articles/Posts [What are your top three recommendations for a new developer in the spa…](https://forum.openzeppelin.com/t/what-are-your-top-three-recommendations-for-a-new-developer-in-the-space/862)

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.

---

<div class="post-metadata">

**Author:** ![CodingIdiot](https://avatars.discourse-cdn.com/v4/letter/c/a587f6/32.png) [@CodingIdiot](https://forum.openzeppelin.com/u/CodingIdiot)\
**Post date:** [May 16, 2021, 3:05am UTC](https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413/3 "2021-05-16T03:05:35Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Yoshiko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/yoshiko/32/6858_2.png) [@Yoshiko](https://forum.openzeppelin.com/u/Yoshiko)\
**Post date:** [May 16, 2021, 6:18am UTC](https://forum.openzeppelin.com/t/helping-programming-auto-burn-and-auto-stop-burn-on-erc20-sol-0-8-0/8413/4 "2021-05-16T06:18:47Z")

</div>

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.
