I am trying to compile WETH.sol found on Ethereum mainnet, which was compiled using a very old version (0.4.x). I changed the compiler version to ^0.8.0 and got the following error message.
TypeError: Explicit type conversion not allowed from "int_const -1" to "uint256".
--> contracts/WETH9.sol:78:64:
|
78 | if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {}
| ^^^^^^^^
Error HH600: Compilation failed
**The code is as follows.**
if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
require(allowance[src][msg.sender] >= wad);
allowance[src][msg.sender] -= wad;
}
How can I correct this error?