Consensys / Tokens

Ethereum Token Contracts
MIT License
2.06k stars 1.19k forks source link

MAX_UINT256 #131

Closed mahuaibo closed 6 years ago

mahuaibo commented 6 years ago

contract EIP20 is EIP20Interface {

uint256 constant private MAX_UINT256 = 2**256 - 1;

function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    uint256 allowance = allowed[_from][msg.sender];
    require(balances[_from] >= _value && allowance >= _value);
    balances[_to] += _value;
    balances[_from] -= _value;
    if (allowance < MAX_UINT256) {
        allowed[_from][msg.sender] -= _value;
    }
    emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
    return true;
}

What is the function of x?

maurelian commented 6 years ago

What is the function of x?

Not sure what you mean by that.

However, based on the title, I think this discussion will provide the context you seek: https://github.com/ConsenSys/Tokens/pull/80