Query editor
WITH events as (SELECTt."from" as user,- CAST(value AS DOUBLE) AS amountFROMerc20_ethereum.evt_Transfer AS tWHEREt.contract_address = {{curve_token}}and "to" not in ( {{yearn_pool}}, {{curve_gauge}} )UNION ALLSELECTt."to" as address,CAST(value AS DOUBLE) AS amountFROMerc20_ethereum.evt_Transfer AS tWHEREt.contract_address = {{curve_token}}and "from" not in ( {{yearn_pool}}, {{curve_gauge}} )UNION ALLSELECTuser,CAST(amount AS DOUBLE) as amountFROMconvex_ethereum.Booster_evt_Deposited AS dWHERECAST( poolid as INTEGER ) = {{pool}}UNION ALLSELECTuser,- CAST(amount AS DOUBLE)FROMconvex_ethereum.Booster_evt_Withdrawn AS dWHERECAST( poolid as INTEGER ) = {{pool}})SELECTuser,amount,SUM(amount) OVER(ORDER BY amount DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "Cumulative amount",ROW_NUMBER() OVER (ORDER BY amount DESC) as rowFROM (SELECTuser,SUM( amount/1e18 ) as amountFROM eventsGROUP BY 1ORDER by 2 DESC)ORDER BY amount DESC