diff --git a/cowprotocol/accounting/rewards/mainnet/reduced_bonding_pools_query_4065709.sql b/cowprotocol/accounting/rewards/mainnet/reduced_bonding_pools_query_4065709.sql index 5de4c2e9..e234f27f 100644 --- a/cowprotocol/accounting/rewards/mainnet/reduced_bonding_pools_query_4065709.sql +++ b/cowprotocol/accounting/rewards/mainnet/reduced_bonding_pools_query_4065709.sql @@ -5,6 +5,7 @@ reduced_bonding_pools as ( select 'prod-Barter' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0xB6113c260aD0a8A086f1E31c5C92455252A53Fb8') as pool_address, from_hex('0xC7899Ff6A3aC2FF59261bD960A8C880DF06E1041') as solver_address, timestamp '2024-08-21 07:15:00' as creation_date @@ -12,6 +13,7 @@ reduced_bonding_pools as ( select 'barn-Barter' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0xB6113c260aD0a8A086f1E31c5C92455252A53Fb8') as pool_address, from_hex('0xA6A871b612bCE899b1CbBad6E545e5e47Da98b87') as solver_address, timestamp '2024-08-21 07:15:00' as creation_date @@ -19,13 +21,23 @@ reduced_bonding_pools as ( select 'prod-Copium_Capital' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0xc5Dc06423f2dB1B11611509A5814dD1b242268dd') as pool_address, from_hex('0x008300082C3000009e63680088f8c7f4D3ff2E87') as solver_address, timestamp '2024-07-25 07:42:00' as creation_date union distinct + select + 'prod-Copium_Capital' as solver_name, + 'Reduced-CoW-DAO' as pool_name, + 'gnosis' as blockchain, + from_hex('0xc5Dc06423f2dB1B11611509A5814dD1b242268dd') as pool_address, + from_hex('0xfaBBDf8a77005C00edBe0000bDC000644c024322') as solver_address, + timestamp '2024-07-25 07:42:00' as creation_date + union distinct select 'prod-Rizzolver' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0x0Deb0Ae9c4399C51289adB1f3ED83557A56dF657') as pool_address, from_hex('0x9DFc9Bb0FfF2dc96728D2bb94eaCee6ba3592351') as solver_address, timestamp '2024-10-10 02:03:00' as creation_date @@ -33,6 +45,23 @@ reduced_bonding_pools as ( select 'barn-Rizzolver' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, + from_hex('0x0deb0ae9c4399c51289adb1f3ed83557a56df657') as pool_address, + from_hex('0x26B5e3bF135D3Dd05A220508dD61f25BF1A47cBD') as solver_address, + timestamp '2024-10-10 02:03:00' as creation_date + union distinct + select + 'prod-Rizzolver' as solver_name, + 'Reduced-CoW-DAO' as pool_name, + 'arbitrum' as blockchain, + from_hex('0x0Deb0Ae9c4399C51289adB1f3ED83557A56dF657') as pool_address, + from_hex('0x23e868881dfe0531358B8FE0cbec43FD860cbF33') as solver_address, + timestamp '2024-10-10 02:03:00' as creation_date + union distinct + select + 'barn-Rizzolver' as solver_name, + 'Reduced-CoW-DAO' as pool_name, + 'arbitrum' as blockchain, from_hex('0x0deb0ae9c4399c51289adb1f3ed83557a56df657') as pool_address, from_hex('0x26B5e3bF135D3Dd05A220508dD61f25BF1A47cBD') as solver_address, timestamp '2024-10-10 02:03:00' as creation_date @@ -40,6 +69,7 @@ reduced_bonding_pools as ( select 'prod-Portus' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0x3075F6aab29D92F8F062A83A0318c52c16E69a60') as pool_address, from_hex('0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f') as solver_address, timestamp '2024-10-21 03:33:00' as creation_date @@ -47,6 +77,7 @@ reduced_bonding_pools as ( select 'barn-Portus' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0x3075F6aab29D92F8F062A83A0318c52c16E69a60') as pool_address, from_hex('0x5131590ca2E9D3edC182581352b289dcaE83430c') as solver_address, timestamp '2024-10-21 03:33:00' as creation_date @@ -54,6 +85,7 @@ reduced_bonding_pools as ( select 'prod-Fractal' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0xDdb0a7BeBF71Fb5d3D7FB9B9B0804beDdf9C1C88') as pool_address, from_hex('0x95480d3f27658e73b2785d30beb0c847d78294c7') as solver_address, timestamp '2024-10-29 11:57:00' as creation_date @@ -61,11 +93,11 @@ reduced_bonding_pools as ( select 'barn-Fractal' as solver_name, 'Reduced-CoW-DAO' as pool_name, + 'ethereum' as blockchain, from_hex('0xDdb0a7BeBF71Fb5d3D7FB9B9B0804beDdf9C1C88') as pool_address, from_hex('0x2a2883ade8ce179265f12fc7b48a4b50b092f1fd') as solver_address, timestamp '2024-10-29 11:57:00' as creation_date ) select * -from - reduced_bonding_pools +from reduced_bonding_pools diff --git a/cowprotocol/accounting/rewards/mainnet/service_fee_query_4298142.sql b/cowprotocol/accounting/rewards/mainnet/service_fee_query_4298142.sql index 7cfd3902..fc97c766 100644 --- a/cowprotocol/accounting/rewards/mainnet/service_fee_query_4298142.sql +++ b/cowprotocol/accounting/rewards/mainnet/service_fee_query_4298142.sql @@ -7,6 +7,7 @@ -- Parameters: -- {{start_time}}: the start date of an accounting week -- {{end_time}}: the end date of an accounting week +-- {{blockchain}}: the corresponding network with -- we first compute all active solvers of the CoW DAO bonding pool (this includes the ones that have their own reduced subpool) @@ -23,20 +24,20 @@ active_cow_dao_solver_names as ( solver as solver_address, pool_name from - "query_1541516(blockchain='ethereum',vouch_cte_name='named_results',end_time='{{end_time}}')" + "query_1541516(blockchain='{{blockchain}}',vouch_cte_name='named_results',end_time='{{end_time}}')" where pool_address = 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 -- CoW DAO bonding pool address ), --- we now take one step back and look at all solver accounts (not only the active ones) that have joined the CoW DAO bonding pool at some point, +-- we now take one step back and look at all solver accounts (not only the active ones) +-- that have joined the CoW DAO bonding pool at some point, -- and we recover the date of them joining -all_cow_dao_solvers as ( +all_cow_dao_solvers_ethereum as ( select --noqa: ST06 case when s.environment = 'new' then cast(v.solver as varchar) else s.name end as solver_name, - s.environment, v.evt_block_time from cow_protocol_ethereum.VouchRegister_evt_Vouch as v @@ -45,22 +46,61 @@ all_cow_dao_solvers as ( v.bondingPool = 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 ), +all_cow_dao_solvers_gnosis as ( + select --noqa: ST06 + case + when s.environment = 'new' then cast(v.solver as varchar) + else s.name + end as solver_name, + v.evt_block_time + from + cow_protocol_gnosis.VouchRegister_evt_Vouch as v + inner join cow_protocol_gnosis.solvers as s on v.solver = s.address + where + v.bondingPool = 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 +), + +all_cow_dao_solvers_arbitrum as ( + select --noqa: ST06 + case + when s.environment = 'new' then cast(v.solver as varchar) + else s.name + end as solver_name, + v.evt_block_time + from + cow_protocol_arbitrum.VouchRegister_evt_Vouch as v + inner join cow_protocol_arbitrum.solvers as s on v.solver = s.address + where + v.bondingPool = 0x5d4020b9261f01b6f8a45db929704b0ad6f5e9e6 +), + +all_cow_dao_solvers_all_networks as ( + select * + from all_cow_dao_solvers_ethereum + union all + select * + from all_cow_dao_solvers_gnosis + union all + select * + from all_cow_dao_solvers_arbitrum +), + -- we now process the all_cow_dao_solvers table so that we can associate the name of a solver under the CoW DAO bonding pool -- with its "real" join time, i.e., the first time that it joined the pool (using potentially an account that changed on the way) join_date_per_cow_dao_solver as ( select solver_name, - environment, min(evt_block_time) as join_time - from all_cow_dao_solvers group by solver_name, environment + from all_cow_dao_solvers_all_networks group by solver_name ), --- this is now the first calculation of whether a solver in the CoW DAO bonding pool needs to pay a service fee. --- note that we assume here no solver has its own subpool, and we will correct that later on. +-- this is now the first calculation of whether a solver +-- in the CoW DAO bonding pool needs to pay a service fee. +-- Note that we assume here no solver has its own subpool, and we will correct that later on. active_cow_dao_solvers_service_fee as ( select c.solver_name, - c.environment, + a.environment, a.solver_address, a.pool_name, case @@ -68,7 +108,7 @@ active_cow_dao_solvers_service_fee as ( else true end as service_fee_flag, c.join_time - from join_date_per_cow_dao_solver as c inner join active_cow_dao_solver_names as a on c.solver_name = a.solver_name and c.environment = a.environment + from join_date_per_cow_dao_solver as c inner join active_cow_dao_solver_names as a on c.solver_name = a.solver_name ), reduced_bonds as (