通过工厂部署的ERC20合约,但是这个ERC20合约的owner是工厂地址 不是发送者,这个是什么问题 好像是is Ownable这个导致的? 怎么解决
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract TeamToken is ERC20, Ownable {
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _supply,
address _owner
) ERC20(_name, _symbol) {
_mint(_owner, _supply * 10 **_decimals);
}
}
pragma solidity ^0.8.0;
contract TeamTokenFactory is Ownable{
address[] public allTeamTokens;
address public feeWallet;
uint256 private ethFee;
event TeamTokenCreated(address token, string name, string symbol, uint8 decimals, uint256 supply);
function setEthFee(uint256 _ethFee) public onlyOwner{
ethFee = _ethFee;
}
function createTeamToken(string memory _name, string memory _symbol, uint8 _decimals, uint256 _supply,address _owner)payable external returns (address teamTokenAddr) {
require(_decimals >=8 && _decimals <= 18, "Not valid decimals");
TeamToken token = new TeamToken(_name, _symbol, _decimals, _supply, _owner);
allTeamTokens.push(address(token));
emit TeamTokenCreated(address(token), _name, _symbol, _decimals, _supply);
payable(feeWallet).transfer(ethFee);
return address(token);
}
function allTeamTokensLength() external view returns (uint256) {
return allTeamTokens.length;
}
}