Newb Question: Transaction Fee to Charity Wallet

Hi guys, Super Newb here with very limited coding skills. I am creating a ERC20 token using the OpenZeppelin sourcecode and want to add a feature to my token.

Namely for every transaction I want to charge a Transaction Fee that is paid to a Charity Wallet.

So for example if the Transaction Fee is Z % then the economics would look like:

  • Sellers Transfers 100 Tokens to Buyer
  • Buyer Receives 100 *(1- Z%) Tokens
  • Charity Receives 100 * Z% Tokens

Been watching some videos and want to keep the code simple so have done the basic mint function thus far in Remix:


pragma solidity ^0.8.9;

import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol';

contract Trial Token is ERC20 {
    address public admin;
    constructor () ERC20('Trial Token', 'TRIAL') {
        _mint(msg.sender, 100);
        admin = msg.sender; 
    }
    
}