2% Transaction fee and Burn Function

:computer: Environment

I am new to Smart contract. I am trying to help someone to laucnh a Token and then put it on Pancake swap to sell. The 2% Transaction fee has to be charged. 1% is given to the Purchaser and 1% goes to Owner to spend on future development. Manual Burn funtion is also required where owner can burn number Tokens on each milestone. Below is the code so far. Can you please help?

pragma solidity ^0.8.2;

  library SafeMath {
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
      if (a == 0) {
        return 0;
      uint256 c = a * b;
      assert(c / a == b);
      return c;
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
      // assert(b > 0); // Solidity automatically throws when dividing by 0
      uint256 c = a / b;
      // assert(a == b * c + a % b); // There is no case in which this doesn't hold
      return c;
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
      assert(b <= a);
      return a - b;
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
      uint256 c = a + b;
      assert(c >= a);
      return c;

contract Token1 {
    mapping(address => uint) public balances;
    mapping(address => mapping(address => uint)) public allowance;
    uint public totalSupply = 10000000000 * 10 ** 18;
    string public name = "FREINDSHIP";
    string public symbol = "FRND";
    uint public decimals = 18;
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed Owner, address indexed spender, uint value);
    constructor() {
        balances[msg.sender] = totalSupply;
    function balanceOf(address Owner) public view returns(uint) {
        return balances[Owner];
    function transfer(address to, uint value) public returns(bool) {
        require(balanceOf(msg.sender) >= value, "Blance Too Low");
        balances[to] += value;
        balances[msg.sender] -= value;
        emit Transfer(msg.sender, to, value);
        return true;
    function transferFrom(address from, address to, uint value) public returns(bool) {
        require(balanceOf(from) >= value, "Balance Too Low");
        require(allowance[from][msg.sender] >= value, "allowance too low");
        balances[to] += value;
        balances[from] -= value;
        emit Transfer(from, to, value);
        return true;
    function approve(address spender, uint value) public returns(bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;

Hello CryptoManiac, welcome to the forums.

If you are new please follow the tutorial at OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat

To learn how to get a dev environment up and how to deploy a contract. From there follow the information found in Open Zeppelin’s contracts https://docs.openzeppelin.com/contracts/4.x/ to learn about burning.

For your transaction fees take a look at Reflect and how they handle transaction fees.

Thanks very much. I will have a look and come back.
Do you do consultation or token coding at charge?


Please post in https://forum.openzeppelin.com/tag/developer-wanted

I do not require payment. I want to help people learn and to be able to dev their own tokens.

Tsushima highly appreciated