I thought it would be a better user-experience(as well as gas savings) if users didn't have to approve(give allowance) to the contract for transferring the tokens.
So in the ERC20 token contract i would just create a new function that allows transfers without allowance. And the function can only be called by a trusted contract
contract BlahBlah is ERC20 {
function transferToken(address sender, address recipient, uint256 amount) public returns (bool) {
require(msg.sender == trustedContract);
_transfer(sender, recipient, amount);
return true;
}
}
Is this a good idea? Most sites give infinite allowance anyways, so i think the security is about the same?
If someone managed to alter the address of the trustedContract they could hack the whole system anyways, so i think there are no security downfalls for this? Any critiques?