I keep gettting a "Gas exceeds limit" on a simple function trying to transfer ERC20 Tokens from one wallet to another. My first question is what is the most efficient way to debug such an error ? Second would be does anyone see anything wrong with my function as it is ?
Here is the error:
Transact to browser/SmartLoan.sol:Loan.sendFunds errored: Gas required exceeds limit: 3000000. An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).
And here is the function that errors when it is called:
function sendFunds(address dest, uint amount) public {
if(totalPayments < loanStatics.totalAmount){
address addressToken = 0xfef45491b96af14c98b81325cbb7a3fbb83bb7a0;
abstractToken Token = abstractToken(addressToken);
Token.transferFrom(msg.sender, dest, amount);
totalPayments = totalPayments.add(amount);
payments[msg.sender] = payments[msg.sender].add(amount);
company = dest;
}
if(totalPayments == loanStatics.totalAmount){
status = Status.funded;
} else {
status = Status.partially_funded;
}
LoanFunded(status, amount);
}
Here is how I create the contract abstract:
contract abstractToken {
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
}
UPDATE
Here is a print screen of the console, seems like my transaction doensn't even get created, or at least I don't know how to get the hash for it and therefore I am not sure how to debug it...