jj;ljl code example

Example: jj;ljl

SELECT
week,
SUM(transfer) over (order by week)
FROM 
 (
    SELECT
    date_trunc('week', evt_block_time) as week,
    sum(value/1e8) as transfer --Divide by relevant decimal number
    FROM erc20."ERC20_evt_Transfer"
    WHERE contract_address = '\x2260fac5e5542a773aa44fbcfedf7c193bc2c599' -- token contract address
    AND "from" = '\x0000000000000000000000000000000000000000'
    GROUP BY 1
UNION
    SELECT
    date_trunc('week', evt_block_time) as week,
    sum(-value/1e8) as transfer --Divide by relevant decimal number
    FROM erc20."ERC20_evt_Transfer"
    WHERE contract_address = '\x2260fac5e5542a773aa44fbcfedf7c193bc2c599' -- token contract address
    AND "to" = '\x0000000000000000000000000000000000000000'
    GROUP BY 1
) as net;

Tags:

Misc Example