Query editor
/*All in a single block (Looping on Aave)(1) User: deposit USDC / rUSD / srUSD to contango as margin(2) Contango: Loop on Aave to borrow USDC(3) Enso: Deposit USDC to mint rUSD (stablecoin) at Reservoir(4) Enso: Burn rUSD to mint srUSD (yield bearing token) at Reservoir(5) Contango: Deposit srUSD to Morpho to borrow USDC to repay Aave*/with margintable as(selectevt_block_time as time, concat(cast(substr("from", 1, 2) as varchar),'...') as user, case when contract_address = 0x738d1115B90efa71AE468F1287fc864775e23a31 then 'srUSD'when contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 then 'USDC'when contract_address = 0x09D4214C03D01F49544C0448DBE3A27f768F2b34 then 'rUSD'end as margin, case when contract_address = 0x738d1115B90efa71AE468F1287fc864775e23a31 then value*1e-18when contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 then value*1e-6when contract_address = 0x09D4214C03D01F49544C0448DBE3A27f768F2b34 then value*1e-18end as value, get_href(concat('https://etherscan.io/tx/', cast(evt_tx_hash as varchar)), concat(cast(substr(evt_tx_hash, 1, 2) as varchar),'...')) as hash, evt_tx_hash as hash0from erc20_ethereum.evt_transferwhere ((to = 0x3F37C7d8e61C000085AAc0515775b06A3412F36band "from" != 0x9E092cb431e5F1aa70e47e052773711d2Ba4917E -- balancer wrapperand "from" != 0x6Cae28b3D09D8f8Fc74ccD496AC986FC84C0C24E -- contango proxyand contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) --contango vault proxy, USDC marginor (to = 0x3F37C7d8e61C000085AAc0515775b06A3412F36band contract_address = 0x738d1115B90efa71AE468F1287fc864775e23a31and "from" != 0xdfea386f471d15d8b2ddb931f5e57713974c7899) --contango vault proxy, srUSD marginor (to = 0xdFEA386f471d15d8B2DDB931F5e57713974c7899and contract_address = 0x09D4214C03D01F49544C0448DBE3A27f768F2b34)) --contango simplespotexecutor, rUSD marginand evt_block_time >= cast('2025-02-20' as date)),--rUSD (stablecoin) burnt--rUSDtable as (selectevt_block_time as time_rUSD, value*1e-18 as rUSD_burnt, evt_tx_hash as rUSDhashfrom erc20_ethereum.evt_transferwhere to = 0x0000000000000000000000000000000000000000and ("from" = 0x7d585B0e27BBb3D981b7757115EC11F47c476994 or "from" = 0x4Fe93ebC4Ce6Ae4f81601cC7Ce7139023919E003) --ensoand contract_address = 0x09D4214C03D01F49544C0448DBE3A27f768F2b34 --rUSDand evt_block_time >= cast('2025-02-20' as date)),--srUSD (yield bearing token) minted--srUSDtable as (selectevt_block_time as time_srUSD, value*1e-18 as srUSD_minted, evt_tx_hash as srUSDhashfrom erc20_ethereum.evt_transferwhere "from" = 0x0000000000000000000000000000000000000000and to = 0x9bbd78BF99fF21D75a0d1d94582Cb7DD70f07339 --contango spot executorand contract_address = 0x738d1115B90efa71AE468F1287fc864775e23a31 --srUSDand evt_block_time >= cast('2025-02-20' as date))selecttime, user, margin, value, rUSD_burnt, srUSD_minted, srUSD_minted/value as leverage, hash