sakineh5021-nIQRzBtotal TVL (polygon)
    Updated 2022-03-26
    with inflow as (
    SELECT SYMBOL , sum(AMOUNT_USD) as inpu , sum(amount) as inpu_num
    from polygon.udm_events
    where (to_address = '0x0319000133d3ada02600f0875d2cf03d442c3367'
    or to_address = '0xe2f736b7d1f6071124cbb5fc23e93d141cd24e12')
    and event_type = 'erc20_transfer'
    and symbol is not null
    group by 1
    ) ,

    outflow as (
    SELECT SYMBOL , sum(AMOUNT_USD) as outpu , sum(amount) as outpu_num
    from polygon.udm_events
    where (from_address = '0x0319000133d3ada02600f0875d2cf03d442c3367'
    or from_address = '0xe2f736b7d1f6071124cbb5fc23e93d141cd24e12')
    and event_type = 'erc20_transfer'
    and symbol is not null


    group by 1
    )

    ,
    lock as (
    SELECT o.SYMBOL as locked_token ,inpu_num-outpu_num as NUMBER_OF_LOCKED_TOKENS
    , inpu-outpu as AMOUNT_USD
    from inflow I , outflow o
    where O.symbol= I.Symbol
    order by 3 DESC
    limit 40 )
    SELECT sum( AMOUNT_USD)
    from lock



    Run a query to Download Data