How to burn tokens on every transfer?

Hello,
I want to burn 1% of each transfer transaction for tokens. I would appreciate it if you could help me how to do this on a standard contract.

sample:
If we want to transfer 100 tokens, it will send 1 token to 0x000 … The remaining 99 tokens will be delivered to the address.

note: I have little experience in coding, so I expect your support.

1 Like

Hey, there is a hook in the _transfer()for you: _beforeTokenTransfer(), you can rewrite this function to do the things above you want to do.
But for deflationary tokens, as @abcoathup mentioned before, you should take care of this feature, for more details, you can read this article: https://medium.com/balancer-protocol/incident-with-non-standard-erc20-deflationary-tokens-95a0f6d46dea

1 Like

I’m very new on this subject. Can you write an example function?
I read the article you specified but since I only work on the test network, it is not a problem for me.

1 Like

If you are learning smart contract, you had better do it by yourself, if you just want to get the final result, this is another thing.

1 Like

I definitely want to learn but I have almost zero knowledge about it. I thought the best way to learn was to do a project and I’m trying to write a contrat in the testnet so I wanted to see it on the code.

1 Like

Okay, so you just need some basic theoretical knowledge, maybe you can read the Solidity Document, then try to do it, if you have any questions, come back to ask, we are all happy to help you.

1 Like

yes, you are absolutely right, thank you very much for your interest.

1 Like

Hi @crpowell,

:warning: If you create a fee on transfer or deflationary token (burn a percentage on transfer) this can cause issues with use in other contracts such as: https://medium.com/balancer-protocol/incident-with-non-standard-erc20-deflationary-tokens-95a0f6d46dea

Also I recommend looking at Points to consider when creating a fungible token (ERC20, ERC777)

There are some examples in the forum of a deflationary token, though these have not been tested or audited and shouldn’t be used in production: Update deflationary ERC20 from OpenZeppelin Contracts 2.x to 3.x