Repository navigation
Conversation
Some tokens store the allowance as uint96, instead of uint256. So even if you approve the max, the allowance will return 79228162514264337593543950335 (the highest value for uint96) instead of 115792089237316195423570985008687907853269984665640564039457584007913129639935 (highest value for uint256)
Some tokens store the allowance as uint96, instead of uint256. So even if you approve the max, the allowance will return 79228162514264337593543950335 (the highest value for uint96) instead of 115792089237316195423570985008687907853269984665640564039457584007913129639935 (highest value for uint256)
Closed
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #305 +/- ##
==========================================
- Coverage 84.35% 84.06% -0.29%
==========================================
Files 10 10
Lines 1042 1042
==========================================
- Hits 879 876 -3
- Misses 163 166 +3
☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
More of a workaround than a solution
Some tokens store the allowance as uint96, instead of uint256. So even if you approve the max, the allowance will return 79228162514264337593543950335 (the highest value for uint96) instead of 115792089237316195423570985008687907853269984665640564039457584007913129639935 (highest value for uint256)
The new max approval check would be 1208925819614629174706175
This can be seen on some tokens, such as UNI on Goerli
https://goerli.etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#readContract
CVP on mainnet:
https://etherscan.io/address/0x38e4adb44ef08f22f5b5b76a8f0c2d0dcbe7dca1#readContract
INST on mainnet:
https://etherscan.io/token/0x6f40d4a6237c257fff2db00fa0510deeecd303eb#readProxyContract
Here's a table with the max value for each type
https://velvetshark.com/articles/max-int-values-in-solidity