Query editor
with bend_dao as (select users, amount_weth as amount, token_address, "nftAsset", "nftTokenId", tx_id,dt, nft_collection, typesfrom (select "onBehalfOf" as users, ("amount"/1e18) as amount_weth, "reserve" as token_address,"nftAsset", "nftTokenId", "evt_block_time"::date dt,"evt_tx_hash" as tx_id, 'borrow' as typesfrom bend."LendingPool_evt_Borrow"unionselect "borrower" as users, ("amount"/1e18) as amount_weth, "reserve" as token_address,"nftAsset", "nftTokenId", "evt_block_time"::date dt,"evt_tx_hash" as tx_id, 'repay' as typesfrom bend."LendingPool_evt_Repay") bendleft join dune_user_generated."cryptuschrist_nft_projects5" nft onnft."nft_contract" = bend."nftAsset"),pine_repay_nft as (select *from (select "contract_address" as nft_address, nft_collection, "tokenId" as token_id,"to" as repayer, "evt_tx_hash" as nft_tx,row_number() over (partition by evt_tx_hash order by evt_index) as ordersfrom erc721."ERC721_evt_Transfer" tinner join dune_user_generated."cryptuschrist_nft_projects5" nft on nft."nft_contract" = t.contract_addresswhere "evt_tx_hash" in (select "tx_hash"from ethereum.logswhere topic1 = '\xb7faaf58a53a3a4bdfdd90dff44b713036c882f23772663c180bf72866f44c1c')) repaywhere orders = 1),pine_repay_coin as (select *from (select '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'::bytea as coin_address, "from" as coin_from, "tx_hash" as coin_tx,"to" as coin_to_router, "value"/1e18 as amount_weth,"tx_index" as index, "block_time"::date as dt,row_number() over (partition by tx_hash order by tx_index) as ordersfrom ethereum.traces twhere "tx_hash" in (select "tx_hash"from ethereum.logswhere topic1 = '\xb7faaf58a53a3a4bdfdd90dff44b713036c882f23772663c180bf72866f44c1c')and (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS null)and value > 0) borwhere orders = 1),pine_borrow_nft as (select *from (select "contract_address" as nft_address, nft_collection, "tokenId" as token_id,"from" as borrower, "evt_tx_hash" as nft_tx,row_number() over (partition by evt_tx_hash order by evt_index) as ordersfrom erc721."ERC721_evt_Transfer" t