Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CoW AMM bounty query to handle uncatalogued solvers #67

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
-- {{cow_budget}} -- the amount of COW that needs to be distributed

with cow_surplus_per_batch_ethereum as (
select
select --noqa: ST06
'ethereum' as blockchain,
cow_per_batch.block_time,
cow_per_batch.tx_hash,
solvers.name as solver_name,
case
when solvers.environment = 'new' then cast(solvers.address as varchar)
else solvers.name
end as solver_name,
naive_cow, -- fraction of batch volume traded within a CoW
trades.surplus_usd as surplus_in_usd, -- surplus of the executed CoW AMM order, expressed in USD
naive_cow * trades.surplus_usd as realized_cow_surplus_in_usd -- surplus of the CoW AMM that is assumed to be generated via a CoW.
Expand All @@ -24,11 +27,14 @@ with cow_surplus_per_batch_ethereum as (
),

cow_surplus_per_batch_gnosis as (
select
select --noqa: ST06
'gnosis' as blockchain,
cow_per_batch.block_time,
cow_per_batch.tx_hash,
solvers.name as solver_name,
case
when solvers.environment = 'new' then cast(solvers.address as varchar)
else solvers.name
end as solver_name,
naive_cow, -- fraction of batch volume traded within a CoW
trades.surplus_usd as surplus_in_usd, -- surplus of the executed CoW AMM order, expressed in USD
naive_cow * trades.surplus_usd as realized_cow_surplus_in_usd -- surplus of the CoW AMM that is assumed to be generated via a CoW.
Expand All @@ -40,11 +46,14 @@ cow_surplus_per_batch_gnosis as (
),

cow_surplus_per_batch_arbitrum as (
select
select --noqa: ST06
'arbitrum' as blockchain,
cow_per_batch.block_time,
cow_per_batch.tx_hash,
solvers.name as solver_name,
case
when solvers.environment = 'new' then cast(solvers.address as varchar)
else solvers.name
end as solver_name,
naive_cow, -- fraction of batch volume traded within a CoW
trades.surplus_usd as surplus_in_usd, -- surplus of the executed CoW AMM order, expressed in USD
naive_cow * trades.surplus_usd as realized_cow_surplus_in_usd -- surplus of the CoW AMM that is assumed to be generated via a CoW.
Expand Down Expand Up @@ -79,7 +88,10 @@ reward_addresses as (
select
solver as solver_address,
reward_target,
substring(solver_name, 6, 100) as solver_name
case
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')"
),

Expand Down
Loading