Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Simplify protocol fee calculations and remove consistency rewards (mi…
Browse files Browse the repository at this point in the history
…rroring solver rewards changes) (#114)

This PR mirrors the changes in the solver rewards repo from the
following two PRs:
- cowprotocol/solver-rewards#401
- cowprotocol/solver-rewards#404

Concretely, the calculation of protocol fees in the sql query is
simplified by a lot, and consistency rewards are removed as they are no
longer used.

**Note**: some tests needed updating since the new way of fetching
protocol fees is not available for the block range the test was set up
for. The tests were updated accordingly, and one (bit strange) way to
verify the numbers is to run the following dune query, as the data for
that block range on Dune have been uploaded via the old (and NOT the
proposed) and tested way. The tiny discrepancies are a result of
rounding "errors", but they are very small.

For the batch rewards test, this query should be used

```
select
    block_number,
    block_deadline,
    tx_hash,
    solver,
    data.execution_cost,
    data.surplus,
    data.protocol_fee,
    data.fee,
    data.uncapped_payment_eth,
    data.capped_payment,
    data.winning_score,
    data.reference_score
from cowswap.raw_batch_rewards where block_deadline >= 20936269 and block_deadline <= 20936280
```

while for the order rewards test, this query should be used

```
select
    block_number,
    order_uid,
    solver,
    data.quote_solver,
    tx_hash,
    data.surplus_fee,
    data.amount,
    data.protocol_fee,
    data.protocol_fee_token,
    data.protocol_fee_native_price,
    data.quote_sell_amount,
    data.quote_buy_amount,
    data.quote_gas_cost,
    data.quote_sell_token_price,
    data.partner_fee,
    data.partner_fee_recipient,
    data.protocol_fee_kind
from cowswap.raw_order_rewards where block_number>= 20934809 and block_number <= 20934808 + 17 order by block_number ASC
```

As for the integrator fees test, this range on Dune should be user:
`block_number>= 20934805 and block_number <= 20934809`

---------

Co-authored-by: Felix Henneke <felix.henneke@protonmail.com>
  • Loading branch information
harisang and fhenneke authored Oct 23, 2024
1 parent fe11663 commit a35f5fb
Show file tree
Hide file tree
Showing 5 changed files with 530 additions and 1,343 deletions.
Loading

0 comments on commit a35f5fb

Please sign in to comment.