Query editor
with pendle_markets as (select market, yt, pt, sy, expiry, base from dune.infinifi.result_infinifi_pendle_markets), yts as (select name, symbol, contract_address as yt, decimalsfrom tokens.erc20whereblockchain = 'ethereum' andcontract_address in (select yt from pendle_markets)), yt_prices as (select * from query_7426449), txs as (select *from erc20_ethereum.evt_transferwhere contract_address in (select yt from pendle_markets)), transfers as ((selectevt_block_time as block_time,contract_address as yt,"from" as wallet, -1.0*value as value,evt_tx_hash as tx_hashfrom txswhere"from" not in (select yt from pendle_markets) and"from" != 0x0000000000000000000000000000000000000000)union all(selectevt_block_time as block_time,contract_address as yt,"to" as wallet, 1.0*value as value,evt_tx_hash as tx_hashfrom txswhere"to" not in (select yt from pendle_markets) and"to" != 0x0000000000000000000000000000000000000000)), transfers_h as (select t.block_time, t.yt, y.name, y.symbol, t.wallet, t.value/(pow(10,y.decimals)) as value, t.tx_hashfrom transfers tjoin yts yon t.yt = y.yt), transfers_usd as (select block_time, yt, name, symbol, wallet, value, yt_price, amount, tx_hashfrom (selectt.block_time, t.yt, t.name, t.symbol, t.wallet,t.value, p.yt_price,t.value * p.yt_price as amount,t.tx_hash,row_number() over (partition by t.block_timeorder by p.block_time) as rnfrom transfers_h tjoin yt_prices pon t.yt = p.yt and t.block_time = p.block_time)where rn=1