Query editor
-- lsMatic-info (liquid Matic tokenomics)with TIME_OF_RUN as (select now() as time -- note: this will always return 1 row),WALLET_TXS as (select "to" as wallet,round(cast(value as double) / 1e18, 4) as amtFROM erc20_polygon.evt_TransferWHERE contract_address = 0x858bCEE0E62dd0c961611ddDDB908767B0ce801Cunion allselect "from",round(-cast(value as double) / 1e18, 4)FROM erc20_polygon.evt_TransferWHERE contract_address = 0x858bCEE0E62dd0c961611ddDDB908767B0ce801C),HOLDERS as (select wallet,sum(amt) as amountfrom wallet_txsgroup by 1order by 2 desc),-- find price of the lsMatic token by the average of last 10 days using USDC/RVRS lpprice as (SELECT--tx_hash,token_bought_symbol, token_bought_address, token_bought_amount,token_sold_symbol, token_sold_address, token_sold_amount,token_bought_amount_raw as amt, amount_usd, 'buy' as type,amount_usd / (token_bought_amount_raw / 1e18) as priceFROM balancer.tradeswheretoken_bought_address = 0x858bCEE0E62dd0c961611ddDDB908767B0ce801Cand token_sold_symbol = 'USDC'and amount_usd is not nullAND block_time >= NOW() - interval '10' dayunion allSELECT--tx_hash,token_bought_symbol, token_bought_address, token_bought_amount,token_sold_symbol, token_sold_address, token_sold_amount,token_sold_amount_raw, amount_usd, 'sold',amount_usd / (token_sold_amount_raw / 1e18)FROM balancer.tradeswheretoken_sold_address = 0x858bCEE0E62dd0c961611ddDDB908767B0ce801Cand token_bought_symbol = 'USDC'and amount_usd is not nullAND block_time >= NOW() - interval '5' day),recent_price as (SELECT'0x858bCEE0E62dd0c961611ddDDB908767B0ce801C' as wallet,cast(round(sum(amount_usd) / sum(amt / 1e18), 4) as varchar) as priceFROM PRICE