I have a contract which has transferFrom function
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
mapping (address => bool) public frozenAccount;
// Transfer token from spender account to receiver account
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(!transactionLock); // Check for transaction lock
require(!frozenAccount[from]); // Check if sender is frozen
require(!frozenAccount[to]); // Check if recipient is frozen
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
When i execute this function i am getting error :
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
gas required exceeds allowance or always failing transaction
I have read many answers in StackOverflow . No solution work for me
transactionLock
defined? is that set tofalse
?false
in constructor