cowprotocol/solver-rewards

Computing slippage for individual transactions not possible

Opened this issue · 0 comments

Restricting the slippage query to an individual transaction hash in this query is currently broken due to the table

,raw_protocol_fee_data as (
select
order_uid,
tx_hash,
cast(cast(data.protocol_fee as varchar) as int256) as protocol_fee,
data.protocol_fee_token as protocol_fee_token,
cast(cast(data.surplus_fee as varchar) as int256) as surplus_fee,
solver,
symbol
from cowswap.raw_order_rewards ror
join tokens.erc20 t
on t.contract_address = from_hex(ror.data.protocol_fee_token)
and blockchain = 'ethereum'
where
block_number >= (select start_block from block_range) and block_number <= (select end_block from block_range)
and data.protocol_fee_native_price > 0
)

which does not use the same filtering as all the other tables at the top.

Other queries for slippage do work but do not implement the correction for charging protocol fees in the correct token.

Potentially, joining on filtered_trades might help. Then the filtering on block numbers could be removed as well.