# Tax fee allocation question

Hi - I am trying to create a simple coin and want to allocate tax fees equally to all existing holders. I was able to write the code below, but this contract gives all tax fees to just the owner/admin. Can you please help me edit the code to incorporate the allocation the fees to all holders?

contract ABC is ERC20
{
using SafeMath for uint256;
uint TAX_FEE = 5;
uint BURN_FEE = 5;
mapping (address => bool) public excludedFromTax;

constructor() public ERC20("ABC", "ABC")
{
_mint(msg.sender, 1000 * 10 ** 18);
owner = msg.sender;
excludedFromTax[msg.sender] = true;
}

function transfer(address recipient, uint256 amount) public override returns (bool)
{
if (excludedFromTax[msg.sender] == true)
{
_transfer(_msgSender(), recipient, amount);
}
else
{
uint burnt = amount.mul(BURN_FEE)/100;
_burn(_msgSender(), burnt);
}
return true;
}

}

Sorry I don't get it. You are currently taxing everyone except yourself and you want to split the tax collected with everyone?

Sorry for the confusion. I want 5% of the transaction fee to be burned. And 5% to be redistributed to all current holders in the proportion of their holdings. The code I have written is such that 5% redistribution only comes to me. The reason for doing so is that I could not figure out how to redistribute to all existing holders. Thats what I need some guidance on. Does that make sense?

Got it. It is computationally infeasible to push the fees to all token holders so the only workaround is to get them to claim their share of the fee. There are different ways of doing it but perhaps you can consider looking at how long the token holders have held their tokens for (does number of tokens held matter?) as a measure of how much fee they can claim.

Got it. So how is Safemoon doing exactly this? Or even Baby Doge. They are sharing 5% of the fee with all existing holders. Please let me know if I am missing something. Am quite a newbie.