Skip to content

Commit

Permalink
Extend blockrange query to multiple chains (#78)
Browse files Browse the repository at this point in the history
* extend blockrange query to multiple chains

* update other queries

* Update cowprotocol/accounting/rewards/mainnet/block_number_interval_from_time_interval_query_3333356.sql

Co-authored-by: Felix Leupold <[email protected]>

---------

Co-authored-by: Felix Leupold <[email protected]>
  • Loading branch information
harisang and fleupold authored Dec 2, 2024
1 parent f6ee105 commit 95a6b4d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions cowprotocol/accounting/rewards/mainnet/.sqlfluff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
with

block_range as (
select * from "query_3333356(start_time='{{start_time}}',end_time='{{end_time}}')"
select * from "query_3333356(blockchain='ethereum',start_time='{{start_time}}',end_time='{{end_time}}')"
),

solver_slippage as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- {{end_time}} - the end date timestamp for the accounting period (exclusively)
with
last_block_before_timestamp as (
select end_block from "query_3333356(start_time='2018-01-01 00:00:00',end_time='{{end_time}}')"
select end_block from "query_3333356(blockchain='ethereum',start_time='2018-01-01 00:00:00',end_time='{{end_time}}')"
),

-- Query Logic Begins here!
Expand Down

0 comments on commit 95a6b4d

Please sign in to comment.