Skip to content

Commit

Permalink
Adapt vouch query to other chains (#83)
Browse files Browse the repository at this point in the history
* add missing parameter

* adapt vouch query to other chains

* add parameter to call sites of query
  • Loading branch information
fhenneke authored Dec 4, 2024
1 parent 0fa3a1b commit 8c82ae2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ reward_addresses as (
when solver_name = 'new-Uncatalogued' then cast(solver as varchar)
else substring(solver_name, 6, 100)
end as solver_name
from "query_1541516(end_time='{{end_time}}',vouch_cte_name='named_results')"
from "query_1541516(blockchain='ethereum',end_time='{{end_time}}',vouch_cte_name='named_results')"
),

final_results_per_solver as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ solver_slippage as (
),

named_results as (
select * from "query_1541516(end_time='{{end_time}}',vouch_cte_name='named_results')"
select * from "query_1541516(blockchain='ethereum',end_time='{{end_time}}',vouch_cte_name='named_results')"
),

-- BEGIN SOLVER REWARDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ active_cow_dao_solver_names as (
solver as solver_address,
pool_name
from
"query_1541516(vouch_cte_name='named_results',end_time='{{end_time}}')"
"query_1541516(blockchain='ethereum',vouch_cte_name='named_results',end_time='{{end_time}}')"
where
pool_address = 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 -- CoW DAO bonding pool address
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
-- and are properly vouched for by a full bonding pool
-- Parameters:
-- {{end_time}} - the end date timestamp for the accounting period (exclusively)
-- {{blockchain}} - network the query is run on
-- {{vouch_cte_name}} - valid_vouches for the vouches only or named_results for additional information on solver and pool name

with
last_block_before_timestamp as (
select end_block from "query_3333356(blockchain='ethereum',start_time='2018-01-01 00:00:00',end_time='{{end_time}}')"
select end_block from "query_3333356(blockchain='{{blockchain}}',start_time='2018-01-01 00:00:00',end_time='{{end_time}}')"
),

-- Query Logic Begins here!
Expand All @@ -17,7 +20,7 @@ vouches as (
pool_address,
initial_funder,
True as active
from cow_protocol_ethereum.VouchRegister_evt_Vouch
from cow_protocol_{{blockchain}}.VouchRegister_evt_Vouch
inner join query_4056263
on
pool_address = bondingPool
Expand All @@ -34,7 +37,7 @@ invalidations as (
pool_address,
initial_funder,
False as active
from cow_protocol_ethereum.VouchRegister_evt_InvalidateVouch
from cow_protocol_{{blockchain}}.VouchRegister_evt_InvalidateVouch
inner join query_4056263
on
pool_address = bondingPool
Expand Down Expand Up @@ -97,7 +100,7 @@ named_results as (
bp.pool_name,
concat(environment, '-', s.name) as solver_name
from valid_vouches as vv
inner join cow_protocol_ethereum.solvers as s
inner join cow_protocol_{{blockchain}}.solvers as s
on vv.solver = s.address
inner join query_4056263 as bp
on vv.pool_address = bp.pool_address
Expand Down

0 comments on commit 8c82ae2

Please sign in to comment.