-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Paraswap Ethereum trades #6581
Fix Paraswap Ethereum trades #6581
Conversation
…ok into fix-paraswap-base-trades
…raswap-base-trades
Split tables for trades by version and project to get more precise trade data using data specific for each table; Replace inner join to left join and remove is_eth condition: for ETH/ERC20 is_eth for token_in was true and for token_out was false. Later inner join just filtered such transactions. Also token_out has had two is_eth = false conditions which filtered all transactions that included ETH.
…raswap-ethereum-trades
…llbook into fix-paraswap-ethereum-trades
Workflow run id 10469285857 approved. |
Workflow run id 10469286205 approved. |
Workflow run id 10469318035 approved. |
Workflow run id 10469318314 approved. |
Workflow run id 10529589658 approved. |
Workflow run id 10529589305 approved. |
…raswap-ethereum-trades
Workflow run id 10529607018 approved. |
Workflow run id 10529607335 approved. |
Workflow run id 10560412413 approved. |
Workflow run id 10560412206 approved. |
Add checking for TokenTransferProxy because "event from" is not always Augustus caller
b4f6300
to
e2da218
Compare
Workflow run id 10562598893 approved. |
Workflow run id 10562599195 approved. |
Workflow run id 11180626853 approved. |
Workflow run id 11180627049 approved. |
Workflow run id 11183084720 approved. |
Workflow run id 11183084822 approved. |
Workflow run id 11183102092 approved. |
Workflow run id 11183102233 approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall lgtm.✅
Thank you @PablloZz
c.swap_in_pair_token_in, | ||
c.swap_out_pair_token_out, | ||
t."from" AS caller, | ||
concat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems a bit complated.
Do you want to use ||
syntax to concat string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Updated trades:
v5-fantom: https://dune.com/queries/4176714
v5-ethereum: https://dune.com/queries/4176725
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
…raswap-ethereum-trades
Thank you for contributing to Spellbook 🪄
Update!
Please build spells in the proper subproject directory. For more information, please see the main readme, which also links to a GH discussion with the option to ask questions.
Contribution type
Please check the type of contribution this pull request is for:
For bug fixes
If you are fixing a bug, please provide the following information:
Transaction Data Source Update:
Previously, data for calls, i.e. values of tokens, who called, received, etc., were taken from the beginning and the end of a transaction. I modified it so that the data is now taken from the actual caller of the Augustus contract.
Fix for Filtering ETH Transactions:
For all calls from the
ethereum.transactions
table, theis_eth
value was taken based on whether thevalue
was sent in the call. Inswap_detail_out
, there were two filters withis_eth = false
. This meant that all transactions that sent ETH were filtered out, even if the Augustus call itself didn't involve ETH. This bug caused the most missed transactions. The check was removed and the code was refactored without it.Examples: 1, 2, 3, 4, 5.
Use of
union all
for Grouping Calls:Previously, calls were grouped using
union
, and only one call was selected for transactions with multiple calls. This was replaced withunion all
for accuracy and performance.CTE Restructure for Better Data Extraction:
To more accurately join the
events
andtraces
tables and extract all the calls in one transaction, one CTE was split into three (for UniswapV2, Uniswap, and ZeroX).Remove join with the
traces
table for UniswapV2 and Uniswap:For these calls, I used only the
events
table and removedtraces
, which allowed handling of positive slippage and performing aninner join
.Handling Identical Calls:
Some transactions had identical calls except for the
trace_address
, like this one, I handled this by usingswap_in_row_number
andswap_out_row_number
for the call, andevt_row_number
for the event.Duplicate Filtering:
To avoid possible duplicates, I compared the number of initial calls in a transaction with the final rows and filtered out any mismatches.
Result:
The total number of calls increased by 350,807, transactions by 345,737, and the total USD volume increased by $1,073,360,636.
Here is a table for more detailed info:
Statistics.xlsx
Additional events tables were added.
Thank you for your contribution!