fix(privateListings): reject mixed ERC20 payment tokens - #1991
Open
MrFaruk0 wants to merge 1 commit into
Open
Conversation
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.
Summary
Prevent private listing counter orders from aggregating payment items that use different ERC20 token contracts.
constructPrivateListingCounterOrderpreviously validated that all payment items were currency items and shared the sameitemType, but did not verify that ERC20 items referenced the same token.Problem
When multiple ERC20 consideration items use different token contracts, the helper currently aggregates their amounts into a single counter-order offer using the token from the first payment item.
For example:
would produce a single counter-order offer for:
The resulting fulfillment is later rejected by Seaport because offer and consideration components must match on token.
Solution
Extend the existing currency validation to also require payment items to reference the same token address before aggregation.
Token comparison is case-insensitive so differently-cased representations of the same Ethereum address remain valid.
This preserves the existing behavior for:
Testing
Added regression coverage for:
Validation performed:
npx vitest run test/orders/privateListings.spec.tsnpx vitest runnpm run check-typesnpm run buildgit diff --check