I write the etheric fang intelligent contract, why transferFrom the method with the require of method would be a mistake
Gas estimation errored have the following message (see below). The transaction execution will likely fail. Do you want to force the sending?
But I change this method into the if judgment is not the mistake
Does anyone know why this in hopes to find the answer,
Attach transferFrom code
The function transferFrom (
Address _from,
Address _to,
Uint256 _value
)
Public
Returns (bool)
{
Require (_to!=address (0));
If (_value & lt;=balances [_from]) return false;
If (_value & lt;=allowed [_from] [MSG. Sender]) return false.
//the require (_value & lt;=balances [_from]);//use the require method will lead to each transferFrom trading error cannot be computed gas, so using the if judgment
//the require (_value & lt;=allowed [_from] [MSG. Sender]);
Balances [_from]=balances [_from]. Sub (_value);
Balances [_to]=balances [_to]. Add (_value);
Allowed [_from] [MSG. Sender]=allowed [_from] [MSG. Sender]. Sub (_value);
Emit Transfer (_from, _to _value);
return true;
}