Skip to content

Commit

Permalink
use new tables for fees for slippage
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed Dec 6, 2024
1 parent 0e1128c commit 1100dba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 1100dba

Please sign in to comment.