title: how to create a fee function that goes through desired wallet address in solidity?
body: <p>Is it possible create a fee function that goes through desired wallet address in solidity?
  if yes, can anybody tell me what's wrong with my code? coz my fee function doesn't work.
  thanks in advance.</p>
  <pre><code>//SPDX-License-Identifier: Unlicense
  pragma solidity ^0.8.4;
  
  contract Token {
      mapping(address =&gt; uint) public balances;
      mapping(address =&gt; mapping(address =&gt; uint)) public allowance;
      uint public totalSupply = 1000000000 * 1e18;
      string public name = &quot;MAT COIN&quot;;
      string public symbol = &quot;MAT&quot;;
      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;
      }
  
      address admin = address(0x01FDD35e1263B9593fcf0ebd1f45415A22f1615d);
  
      function transfer(address to, uint value) external returns (bool) {
      uint256 fee = (value / 100) * 3; // Calculate 3% fee
      balances[msg.sender] -= value; // subtract the full amount
      balances[admin] += fee; // add the fee to the admin balance
      balances[to] += (value - fee); // add the remainder to the recipient balance
      emit Transfer(msg.sender, to, value);
      return true;
      }
  
      function balanceOf(address owner) public view returns(uint) {
          return balances[owner];
      }
      // function transfer(address to, uint value) public returns(bool) {
      //     require(balanceOf(msg.sender) &gt;= value, 'balance 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) &gt;= value, 'balance too low');
          require(allowance[from][msg.sender] &gt;= 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;
      }
  }
  </code></pre>
  <p>hope it's possible and sorry for a noob question.</p>