I am trying to transfer a token from any address to my contract or another address using solidity but it is not working. the TransferTokenAddress function is the one I'm running.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
contract CArbi{
constructor() {
}
function TransferTokenAddress(address token, address from, address to, uint monto) public {
IERC20(token).approve(from, monto);
transferFrom(token, from, to, monto);
}
}
I tried with the transfer function the error persists