# Adding burn in reflect finance code

**URL:** <https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740>\
**Category:** Smart Contracts\
**Created:** [August 29, 2021, 3:46pm UTC](https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740 "2021-08-29T15:46:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RahulK](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@RahulK](https://forum.openzeppelin.com/u/RahulK)\
**Post date:** [August 29, 2021, 3:46pm UTC](https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740/1 "2021-08-29T15:46:39Z")

</div>

Hi All  
I am trying to add a burn function into the reflect finance code - trying to burn x% and redistribute y%. I made a small edit to the transfer function and I feel it should work. Could you please look at this and let me know if I am missing something:

```auto
function transfer(address recipient, uint256 amount) public override returns (bool) 
{
  uint burnAmt = amount.mul(_burnFee)/100; // calculate the burn Amount
_transfer(_msgSender(), recipient, amount.sub(burnAmt)); // in current reflect code
_tTotal -= burnAmt; // reducing the total supply by burn amount. For this I had to make the tTotal number not constant
Transfer (_msgSender(), address(0), burnAmt); // tranferring burn amount to a zero address

return true;
}

```

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [August 29, 2021, 4:28pm UTC](https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740/2 "2021-08-29T16:28:37Z")

</div>

I do not have a full source code, so I am not sure for your function `_transfer()`, and what does the variable `_tTotal` mean? Does it just mean the total supply?

---

<div class="post-metadata">

**Author:** ![RahulK](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@RahulK](https://forum.openzeppelin.com/u/RahulK)\
**Post date:** [August 29, 2021, 4:40pm UTC](https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740/3 "2021-08-29T16:40:26Z")

</div>

Thank you for your response.

Yes \_tTotal means total supply.

The entire source code for reflect finance is at [https://github.com/reflectfinance/reflect-contracts/blob/main/contracts/REFLECT.sol](https://github.com/reflectfinance/reflect-contracts/blob/main/contracts/REFLECT.sol)

It is tough to read since there are no comments.

---

<div class="post-metadata">

**Author:** ![AmirHossein484](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@AmirHossein484](https://forum.openzeppelin.com/u/AmirHossein484)\
**Post date:** [September 21, 2021, 10:51pm UTC](https://forum.openzeppelin.com/t/adding-burn-in-reflect-finance-code/14740/4 "2021-09-21T22:51:01Z")

</div>

Hi,  
This is my question too, Because, Due to the definition Total Supply is the current amount of a cryptocurrency that has already been mined or created. Unlike circulating supply, coins are not required to be available for use. This number also removes any coins that have been knowingly burned or destroyed. So, in rate calculation formula we should subtract that X% from tTotal ..  
And I think after that we come up with a new formula ..

Check this:

> [@A Technical Whitepaper for Reflect Contracts](https://forum.openzeppelin.com/t/a-technical-whitepaper-for-reflect-contracts/14297):
>
> I wrote a technical whitepaper for Reflect Contracts. ↓ [https://reflect-contract-doc.netlify.app/](https://reflect-contract-doc.netlify.app/) In short, reflect contracts are tokens that have auto-staking mechanism built in. Safemoon, Octa, Lunarswap tokens, are some examples. I decided to write the technical paper because there wasn’t one. In fact, if you look at the [program](https://github.com/reflectfinance/reflect-contracts/blob/main/contracts/REFLECT.sol), it is very hard to read and understand. I spent some time digging it to the program, tried to understand how it works, and then finally wrote the paper. I thin…

I do not think this can be done as easily as you did. As you know, even in a project like Safemoon, Tokens are not really burned. Rather, they are transferred to an address that also receives a profit.
