Multipartite(Auto-updating) Cumulative liquidity fees and pool rewards (full history)
Updated 2024-05-20
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
/*
Note that block reward rate was doubled in 2022-01-07 (block 3704556, EmissionCurve Mimir value).
https://midgard.thorchain.info/v2/debug/block/3704556
Reasoning:
'liquidity fees (in RUNE)' represents the transfer of value from swappers to the network, via pool Asset depths.
'pool rewards (in RUNE)' represents the change of pool RUNE depths by fee collection and block rewards.
An ideal is for Asset depths to deepen faster than RUNE depths deepen, RUNE's price-as-measured-in-Asset thus increasing.
As block rewards are distributed according to the incentive pendulum, only the net pool rewards need be considered for pool depths.
I have addressed elsewhere the magnitude of outbound fees compared to liquidity fees.
( https://app.flipsidecrypto.com/dashboard/2022-09-outbound-fees-comparison-kDEWY5 )
( https://app.flipsidecrypto.com/dashboard/reserve-cumulative-income-health-rOUjF2 )
*/
WITH
range AS (
SELECT '2001-11-01' AS starting_date
),
liqfees AS (
SELECT DATE(block_timestamp) AS date,
pool_name,
SUM(liq_fee_in_rune_e8) AS liq_fee_in_rune_e8,
NULL AS pool_rewards_rune_e8
FROM thorchain.defi.fact_swaps_events
WHERE date >= (SELECT starting_date FROM range)
GROUP BY date, pool_name
),
pool_rewards AS (
SELECT DATE(block_timestamp) AS date,
pool_name,
QueryRunArchived: QueryRun has been archived