feat: support permit2 on superchainweth #12596
Merged
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.
Description
Permit2 functionality added to the
SuperchainWETH
contract.Changes made to
WETH98
to support this:allowance
mapping tointernal
and created a public getter.balanceOf
mapping tointernal
and created a public getter for consistency.In
SuperchainWETH
:allowance
getter to return the maximum allowance when using Permit2.Tests
New unit tests to cover the Permit2 integration with
SuperchainWETH
.Additional context
The
SuperchainWETH
contract inherits fromWETH98
, which hasallowance
as a public mapping, making it non-overridable. Our approach was to follow OpenZeppelin's pattern by renamingallowance
to_allowance
and making it an internal state variable. This allowed us to add anallowance
getter and make it virtual, enabling easy overriding. Some logic in this contract, as well as inDelayedWETH
, had to be modified accordingly.The change in
balanceOf
is only for consistency to follow theallowance
pattern.Metadata
#11899