I'm creating a contract which will transfer usdt token from users wallet to contract address
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract Contract {
IERC20 public token;
address public owner;
constructor(IERC20 _token) {
token = _token;
}
function approve(address spender, uint256 amount) external {
token.approve(spender, amount);
}
// Other important functions.
function transfer(address from, address to, uint256 amount) external {
token.transferFrom(from, to, amount);
}
}
Im setting up the usdt contract address in constructor while deploying my contract. The approve funtion is working but when i try to call transfer function its showing maximum allovance exceeded. My primary motive is that i need to create a mint function in mycontract which will take fee as usdt?