From 1100dba58e9678afa6785913cd31599ae95f9cab Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Fri, 6 Dec 2024 18:10:10 +0100 Subject: [PATCH] use new tables for fees for slippage --- .../accounting/fees/classified_fees_4058574.sql | 12 ++++++------ .../accounting/slippage/slippage_query_3427730.sql | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cowprotocol/accounting/fees/classified_fees_4058574.sql b/cowprotocol/accounting/fees/classified_fees_4058574.sql index 6bb83a22..d1767332 100644 --- a/cowprotocol/accounting/fees/classified_fees_4058574.sql +++ b/cowprotocol/accounting/fees/classified_fees_4058574.sql @@ -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) @@ -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) ), diff --git a/cowprotocol/accounting/slippage/slippage_query_3427730.sql b/cowprotocol/accounting/slippage/slippage_query_3427730.sql index 292112c3..5108b422 100644 --- a/cowprotocol/accounting/slippage/slippage_query_3427730.sql +++ b/cowprotocol/accounting/slippage/slippage_query_3427730.sql @@ -11,6 +11,6 @@ select '&slippage_table_name=slippage_per_transaction', '" target="_blank">link' ) 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