Skip to content
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

Update and extend unusual slippage query to all chains #98

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,43 @@
-- {{significant_slippage_value}} -- the absolute threshold above which a tx is always flagged as high-slippage
with
results_per_tx as (
select * from "query_4070065(blockchain='ethereum',start_time='{{start_time}}',end_time='{{end_time}}',slippage_table_name='slippage_per_transaction')"
select * from "query_4070065(blockchain='{{blockchain}}',start_time='{{start_time}}',end_time='{{end_time}}',slippage_table_name='slippage_per_transaction')"
),

url_helper as (
select
case
when '{{blockchain}}' = 'ethereum' then 'eth'
else '{{blockchain}}'
end
)

select --noqa: ST06
rpt.block_time,
concat(environment, '-', name) as solver_name,
concat(
'<a href="https://dune.com/queries/4059683',
'?blockchain=ethereum',
'?blockchain={{blockchain}}',
'&start_time={{start_time}}',
'&end_time={{end_time}}',
'&slippage_table_name=raw_slippage_breakdown',
'" target="_blank">link</a>'
) as token_breakdown,
rpt.tx_hash,
concat(
'<a href="https://phalcon.blocksec.com/explorer/tx/',
(select * from url_helper),
'/0x',
to_hex(rpt.tx_hash),
'" target="_blank">0x',
to_hex(rpt.tx_hash),
'</a>'
) as tx_hash,
slippage_usd,
batch_value,
100 * slippage_usd / batch_value as relative_slippage
from results_per_tx as rpt
inner join cow_protocol_ethereum.batches as b on rpt.tx_hash = b.tx_hash
inner join cow_protocol_ethereum.solvers on address = rpt.solver_address
inner join cow_protocol_{{blockchain}}.batches as b on rpt.tx_hash = b.tx_hash
inner join cow_protocol_{{blockchain}}.solvers on address = rpt.solver_address
where (
abs(slippage_usd) > {{min_absolute_slippage_tolerance}}
and
Expand Down
Loading