Query editor
with bend_liquidate as (select "user" as user, "loanId", "nftAsset" as nft_address,"nftTokenId" as token_id, "evt_tx_hash" as tx_id,"evt_block_time"::date as dtfrom bend."LendingPoolLoan_evt_LoanLiquidated"),nftfi_liquidate as (select l.borrower as user, l."loanId", l."nftCollateralContract" as nft_address,l."nftCollateralId" as token_id, l."evt_tx_hash" as tx_id,l."evt_block_time"::date as dtfrom nftfi."NFTfi_evt_LoanLiquidated" lleft join nftfi."NFTfi_evt_LoanStarted" b onl."loanId" = b."loanId"and l.borrower = b.borrowerunionselect l.borrower as user, l."loanId",decode(substring("loanTerms"->>'nftCollateralContract' FROM 3), 'hex')::bytea as nft_address,("loanTerms"->>'nftCollateralId')::decimal as token_id, l."evt_tx_hash" as tx_id,l."evt_block_time"::date as dtfrom nftfi."DirectLoanFixedOfferRedeploy_evt_LoanStarted" lleft join nftfi."NFTfi_evt_LoanStarted" b onl."loanId" = b."loanId"and l.borrower = b.borrower),depositor as (select "from" as depositor, "tokenId" as token_id, nft_collection,"contract_address" as nft_address, "evt_tx_hash" as tx_id, "evt_block_time"::date as dtfrom erc721."ERC721_evt_Transfer" tleft join dune_user_generated."cryptuschrist_nft_projects5" nft onnft."nft_contract" = t.contract_addresswhere evt_tx_hash in (select "call_tx_hash"from pawnfi_v201."AssetVault_call_onERC721Received")unionselect "from" as depositor, "tokenId" as token_id, nft_collection,"contract_address", "evt_tx_hash" as tx_id, "evt_block_time"::date as dtfrom erc721."ERC721_evt_Transfer" tleft join dune_user_generated."cryptuschrist_nft_projects5" nft onnft."nft_contract" = t.contract_addresswhere evt_tx_hash in (select "call_tx_hash"from pawnfi."AssetWrapper_call_depositERC721")),arcade_liq as (select "from" as user, "loanId" as loan_id, "tokenId" as token_id,p."evt_tx_hash" as tx_id, p."evt_block_time"::date as dtfrom (select *from pawnfi."LoanCore_evt_LoanClaimed"unionselect *from pawnfi_v2."LoanCore_evt_LoanClaimed"unionselect *from pawnfi_v201."LoanCore_evt_LoanClaimed") pleft join erc721."ERC721_evt_Transfer" t onp.evt_tx_hash = t.evt_tx_hashwhere t."to" != '\x0000000000000000000000000000000000000000'