Uniswap / permit2

🔑🔑🔑 next generation token approvals mechanism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allowance is not being updated when 2**160-1 is approved

codeislight1 opened this issue · comments

i was wondering in _transfer whether the bypass of updating the allowed.amount when approved amount is 2**160-1 is intended to save on gas, as i have tried to test in 2 cases, for any value under the max, it did deduct from the allowance accordingly. and also I was looking into the test cases and there is a lack of checking for allowance when permit2.transferFrom takes place.

Hey!

bypass of updating the allowed.amount when approved amount is 2**160-1 is intended to save on gas

Yeah, this is a gas optimization (also used in many standard ERC20 tokens) where if the approval is max, we save an sstore on transfer by simply keeping it at max.

I was looking into the test cases and there is a lack of checking for allowance

ah, if we're missing test cases we'd love a PR adding extra coverage!

ohh cool, i ll try to add test cases for them, thank you!