Skip to content

Commit

Permalink
[Easy] Reorder payout dashboard columns (#40)
Browse files Browse the repository at this point in the history
* [Easy] Reorder payout dashboard columns

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

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

* adding columns

---------

Co-authored-by: Felix Henneke <[email protected]>
  • Loading branch information
fleupold and fhenneke authored Sep 18, 2024
1 parent b940fe9 commit 99f2c7e
Showing 1 changed file with 34 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,33 +168,39 @@ extended_payout_data as (
cd.primary_reward_cow as total_cow_reward,
cd.primary_reward_eth as total_eth_reward
from combined_data_after_service_fee as cd
),

final_results as (
select --noqa: ST06
epd.*,
case
when is_overdraft then null
when reimbursement_eth > 0 and total_cow_reward < 0
then reimbursement_eth + total_eth_reward
when reimbursement_eth < 0 and total_cow_reward > 0
then 0
else reimbursement_eth
end as eth_transfer,
case
when is_overdraft then null
when reimbursement_eth > 0 and total_cow_reward < 0
then 0
when reimbursement_eth < 0 and total_cow_reward > 0
then reimbursement_cow + total_cow_reward
else total_cow_reward
end as cow_transfer,
case
when is_overdraft then total_outgoing_eth
end as overdraft,
reward_target
from extended_payout_data as epd
left join named_results as nr on epd.solver = nr.solver
)

select * from final_results
select --noqa: ST06
name,
epd.solver as solver_address,
reward_target,
quote_reward,
case
when is_overdraft then null
when reimbursement_eth > 0 and total_cow_reward < 0
then reimbursement_eth + total_eth_reward
when reimbursement_eth < 0 and total_cow_reward > 0
then 0
else reimbursement_eth
end as eth_transfer,
case
when is_overdraft then null
when reimbursement_eth > 0 and total_cow_reward < 0
then 0
when reimbursement_eth < 0 and total_cow_reward > 0
then reimbursement_cow + total_cow_reward
else total_cow_reward
end as cow_transfer,
case
when is_overdraft then total_outgoing_eth
end as overdraft,
slippage_eth,
slippage_per_tx,
service_fee_enabled,
reimbursement_eth,
reimbursement_cow,
total_cow_reward,
network_fee_eth,
execution_cost_eth
from extended_payout_data as epd
left join named_results as nr on epd.solver = nr.solver

0 comments on commit 99f2c7e

Please sign in to comment.