While I am making a toy project that has some web3 feature, I am trying to make ERC20 token that the issuer can control the tokens wherever they are. For example, the issuer can send the tokens from user A to user B without getting allowance. Since it also has all ERC20 features, I am considering to add a function "trasnferFromOwner" to the normal ERC20 contract such that
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
constructor() ERC20("MyToken", "MTK") {
_mint(msg.sender, 10000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
function transferFromIssuer(address sender, address recipient, uint256 amount) public onlyOwner {
}
}
But I have no idea where to start and how I would make this function as I wish. Please help. Thank you.