Hello Community,
I am a new solidity developer and I have a question about a tax function.
Here is my current buy tax function:
For context I am using the openzeplin ERC20 template
function _applyTax(address sender, address recipient,uint amount,uint taxRate) private
{
require(balanceOf(sender)>=amount,"ERC20: transfer amount exceeds balance");
uint taxAmt=(amount*taxRate)/100 ;
uint transferAmt=amount-taxAmt;
super._transfer(sender,recipient,transferAmt);
super._transfer(sender,marketingWallet,taxAmt);
}
I want to modify the buy tax to where I collect half of the tax in eth before the eth gets swapped to my token ? Is their anyway that I can do this ? Any places I should look for template code ?