How to add fees while transfer tokens amount on my token?

i want to transfer fee while sending or transfer tokens

If you are using OZ ERC20 you have to override the transfer() and transferFrom() functions to add the fee there. Any other contract trying to transfer your token will have to call one of those 2 functions to transfer the amount.

I also just saw that the same conversation is happening here: How to add a transaction fee on my token?

you can even override _transfer to avoid code duplication.

1 Like