From 24528e1de476bb984e48aff7ab98ee138937a155 Mon Sep 17 00:00:00 2001 From: harisang Date: Tue, 19 Nov 2024 13:25:59 +0200 Subject: [PATCH] update cow amm bounty query to handle uncatalogued solvers --- ...m_cow_with_users_surplus_query_4031724.sql | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql b/cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql index b6f0cf73..861d00dd 100644 --- a/cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql +++ b/cowamm/cow_amm_cow_with_users_surplus_query_4031724.sql @@ -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. @@ -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. @@ -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. @@ -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')" ),