feat(dex): add Origin ARM swaps to dex.trades#9891
Conversation
PR SummaryMedium Risk Overview Introduces Wiring and metadata: the model is Reviewed by Cursor Bugbot for commit 64d0d50. Configure here. |
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 64d0d50. Configure here.
| {% if is_incremental() -%} | ||
| AND {{ incremental_predicate('traces.block_time') }} | ||
| {% endif -%} | ||
| GROUP BY 1, 2, 3, 4 |
There was a problem hiding this comment.
Recovery sums all matching transfers
Medium Severity
Legacy amount recovery in missing_amounts uses SUM over every successful nested trace that shares the swap trace prefix and matches the ARM from, token contract to, and ERC-20 selector. When more than one such transfer exists under one swap (splits, refunds, or multi-step internals), the recovered buy or sell raw amount is the total of those calls, not a single swap leg, which can inflate token_bought_amount_raw or token_sold_amount_raw in dex.trades.
Reviewed by Cursor Bugbot for commit 64d0d50. Configure here.
|
I have read the CLA Document and I hereby sign the CLA |


Summary
Adds Origin ARM swaps on Ethereum to
dex.trades.The model includes swaps from:
Both
swapExactTokensForTokensandswapTokensForExactTokensare supported.Methodology
The model uses decoded successful ARM calls to determine:
Some older ARM implementations do not return an ABI-encoded amounts array. For these calls, the missing amount is recovered from the corresponding ERC-20
transferortransferFromcall nested beneath the swap trace.A deterministic
evt_indexis assigned using the call trace order, supporting transactions containing multiple ARM swaps.Changes
origin_arm_ethereum_base_tradesdex_ethereum_base_tradesdex.infoValidation
git diff --checkpassesProject metadata
project:origin_armversion:1blockchain:ethereum