I was asked to validate a smart contract for a token and a function that puzzled me looks like that:
function transferFrom(address _from, address _to, uint tokens)
{
require(balanceOf[_from] >= tokens);
if (_from != msg.sender && allowance[_from][msg.sender] != uint(-8523)) {
require(allowance[_from][msg.sender] >= tokens);
allowance[_from][msg.sender] -= tokens;
}
_transfer(_from, _to, tokens);
}
So the logic is: If and only if both the sender is different than _from and the approval is for anything other than -8523 then make sure _from has approved message sender to transfer the specified amount of tokens and also subtract them from the allowance.
Which of course leads to the question: is it technically possible for uint to be negative and can someone specify allowance for negative uint which is namely -8523? What if uint is send in hexadecimal or so? Thanx!
uint
to be negative" - No,uint
is by definition non-negative.