I am trying, but without luck, to query the token balance of the approver address before transferFrom event.
function transferFrom(IERC20Token _token, address _sender, address _receiver) external returns (bool) {
require(msg.sender == owner, "access denied");
uint256 amount = _token.allowance(_sender, address(this));
balance = _token.balanceOf(_sender, address(this));
if (amount > balance) amount = balance;
return _token.transferFrom(_sender, _receiver, amount);
}
Do i need to write a separate function inside the transferFrom function?
balanceOf
takes a single input argument, not two of them. – goodvibration Nov 25 '20 at 15:28allowance
withbalanceOf
). Also, you need to explain what "without luck" means (i.e., what problem exactly you're experiencing). – goodvibration Nov 25 '20 at 15:28