KyberNetwork / smart-contracts

Main smart contracts for Kyber Network, including the main platform contract, reserve contracts etc.
https://kyber.network
MIT License
378 stars 340 forks source link

update token.approve to max allowance in kyberNetwork contract. from '2**255' to '2*256-1' #1027

Closed ilanDoron closed 4 years ago

ilanDoron commented 4 years ago

When trying to list COMP token (compound) we found we can't use approve(2**255)

has this code in approve function:

function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits"); }

    allowances[msg.sender][spender] = amount;

    emit Approval(msg.sender, spender, amount);
    return true;
}