fix: detection conversion currency check#1090
Merged
Conversation
yomarion
commented
Mar 23, 2023
| expect(balance.events[0].timestamp).toBe(1679579206); | ||
| }); | ||
|
|
||
| it('cannot trick getBalance with a payment denominated in the wrong currency', async () => { |
Contributor
Author
There was a problem hiding this comment.
This test was failing 😱
yomarion
commented
Mar 23, 2023
| PaymentTypes.IPaymentNetworkEvent<NearSubGraphPaymentEvent>[] | ||
| > { | ||
| const payments = await this.client.GetNearConversionPayments({ | ||
| const payments = await this.client.GetAnyToNativePayments({ |
Contributor
Author
There was a problem hiding this comment.
Not related but more consistent
yomarion
commented
Mar 23, 2023
Comment on lines
+40
to
+42
| contractAddress: $contractAddress | ||
| currency: null | ||
| tokenAddress: $tokenAddress |
Contributor
Author
There was a problem hiding this comment.
This is not related but similar, let's filter everything we can at the same place.
yomarion
commented
Mar 23, 2023
| /** Generic info retriever interface */ | ||
|
|
||
| /** Params for TheGraph-based getTransferEvents */ | ||
| export type TransferEventsParams = { |
Contributor
Author
There was a problem hiding this comment.
I moved the type here since things are getting pretty consistent between EVM and Near chains.
packages/integration-test/test/scheduled/any-to-erc20-detector.test.ts
Outdated
Show resolved
Hide resolved
packages/integration-test/test/scheduled/any-to-erc20-detector.test.ts
Outdated
Show resolved
Hide resolved
benjlevesque
approved these changes
Mar 24, 2023
packages/payment-detection/src/thegraph/conversion-info-retriever.ts
Outdated
Show resolved
Hide resolved
benjlevesque
approved these changes
Mar 24, 2023
leoslr
approved these changes
Mar 24, 2023
yomarion
commented
Mar 24, 2023
|
|
||
| const paymentsMockData = { | ||
| [hashedReference as string]: [ | ||
| // Correct reference but incorrect contract |
Contributor
Author
There was a problem hiding this comment.
FYI @mliu I removed this test as we now filter the contract address in GraphQL directly.
yomarion
commented
Mar 24, 2023
| $contractAddress: Bytes! | ||
| ) { | ||
| payments( | ||
| where: { reference: $reference, tokenAddress: $tokenAddress, contractAddress: $contractAddress } |
Contributor
Author
There was a problem hiding this comment.
@mliu you'll probably want to double-check this query
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.
Fixes #1045
Description of the changes
Important fix to filter payment detection on the currency used for denomination.