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

Use new orders tables for fees for slippage #87

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions cowprotocol/accounting/fees/classified_fees_4058574.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- This query computes fees
--
-- It currently uses the raw_order_rewards table which is only available on ethereum. On other chains it returns an empty table.
-- It currently uses the raw order rewards table as generated by query 4364122.
--
-- Parameters:
-- {{start_time}} - the timestamp for which the analysis should start (inclusively)
Expand All @@ -24,12 +24,12 @@ with raw_fee_data as (
atoms_sold,
atoms_bought,
sell_token_address,
cast(cast(data.protocol_fee as varchar) as int256) as protocol_fee, -- noqa: RF01
cast(cast(data.surplus_fee as varchar) as int256) as surplus_fee, -- noqa: RF01
from_hex(data.protocol_fee_token) as protocol_fee_token_address -- noqa: RF01
protocol_fee,
surplus_fee,
protocol_fee_token as protocol_fee_token_address
from cow_protocol_{{blockchain}}.trades as t
inner join cowswap.raw_order_rewards as ror -- this table only exists for ethereum trades
on t.order_uid = from_hex(ror.order_uid) and t.tx_hash = from_hex(ror.tx_hash)
inner join "query_4364122(blockchain='{{blockchain}}')" as ror -- this table only exists for ethereum trades
on t.order_uid = ror.order_uid and t.tx_hash = ror.tx_hash
where block_time >= cast('{{start_time}}' as timestamp) and block_time < cast('{{end_time}}' as timestamp)
),

Expand Down
4 changes: 2 additions & 2 deletions cowprotocol/accounting/slippage/slippage_query_3427730.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ select
'&slippage_table_name=slippage_per_transaction',
'" target="_blank">link</a>'
) as slippage_per_transaction
from "query_4070065(blockchain='ethereum',start_time='{{start_time}}',end_time='{{end_time}}',slippage_table_name='slippage_per_solver')"
inner join cow_protocol_ethereum.solvers
from "query_4070065(blockchain='{{blockchain}}',start_time='{{start_time}}',end_time='{{end_time}}',slippage_table_name='slippage_per_solver')"
inner join cow_protocol_{{blockchain}}.solvers
on solver_address = address
Loading