From 15c0bfa194a03098d139d9d06e84e0181c24677d Mon Sep 17 00:00:00 2001 From: harisang Date: Mon, 2 Dec 2024 02:32:09 +0200 Subject: [PATCH] extend blockrange query to multiple chains --- cowprotocol/accounting/rewards/mainnet/.sqlfluff | 1 + .../block_number_interval_from_time_interval_query_3333356.sql | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cowprotocol/accounting/rewards/mainnet/.sqlfluff b/cowprotocol/accounting/rewards/mainnet/.sqlfluff index afa8fcca..7d84dff3 100644 --- a/cowprotocol/accounting/rewards/mainnet/.sqlfluff +++ b/cowprotocol/accounting/rewards/mainnet/.sqlfluff @@ -10,3 +10,4 @@ min_absolute_slippage_tolerance=100 relative_slippage_tolerance=0.3 significant_slippage_value=1000 time='2024-08-27 00:00:00' +blockchain=ethereum diff --git a/cowprotocol/accounting/rewards/mainnet/block_number_interval_from_time_interval_query_3333356.sql b/cowprotocol/accounting/rewards/mainnet/block_number_interval_from_time_interval_query_3333356.sql index f40bbd9c..99649f26 100644 --- a/cowprotocol/accounting/rewards/mainnet/block_number_interval_from_time_interval_query_3333356.sql +++ b/cowprotocol/accounting/rewards/mainnet/block_number_interval_from_time_interval_query_3333356.sql @@ -4,9 +4,10 @@ -- Parameters: -- {{start_time}} - the start date timestamp for the accounting period (inclusively) -- {{end_time}} - the end date timestamp for the accounting period (exclusively) +-- {{blockchain}} -- the corresponding chain select min("number") as start_block, max("number") as end_block -from ethereum.blocks +from {{blockchain}}.blocks where time >= cast('{{start_time}}' as timestamp) and time < cast('{{end_time}}' as timestamp)