Query editor
-- Aave v3 Plasma USDe/sUSDe loop of 0xa11B…ADC5 — daily PnL (levered USDe/sUSDe -> USDT0 loop, e-mode 2)-- address 0xa11BE438F1961dB47F6660BDAF59b05C0200ADC5, Aave v3 Plasma pool 0x925a2A7214Ed92428B5b1B090F80b25700095e12-- Balances: scaled from aToken / variableDebtToken Mint, Burn, BalanceTransfer (since inception, 2026-06),-- x reserve index at day end (last ReserveDataUpdated, extrapolated to day end at its rate).-- Interest per leg = balance change - flows (event amounts in underlying) - reward transfers (exact form).-- Rewards: Merkl claims; the claimed wrapped aTokens arrive in the position as aToken BalanceTransfer in the claim tx.-- sUSDe valued at its Ethereum share price at day end, the contract's own math (StakedUSDeV2):-- price = totalAssets / totalSupply, totalAssets = USDe balance of the sUSDe contract - unvested rewards,-- unvested(t) = vestingAmount * max(0, 8h - (t - lastDistribution)) / 8h (vestingAmount = last RewardsReceived amount);-- USDe balance = all USDe transfers in - out since inception; totalSupply = sUSDe mints - burns since inception.-- Reference only: sUSDe market price = VWAP of the day's Ethereum DEX trades vs USDe/USDC/USDT (stables = 1 USD,-- trades >= 1000 sUSDe) and its discount to the share price, in bp. PnL keeps the share price.withlegs (leg, tok, asset, dec, is_debt) as (values('susde', 0xc1a318493ff07a68fe438cee60a7ad0d0dba300e, 0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2, 18, false),('usde', 0x7519403e12111ff6b710877fcd821d0c12caf43a, 0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34, 18, false),('usdt0', 0x5d72a9d9a9510cd8cbdba12ac62593a58930a948, 0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb, 6, false),('debt', 0xcbbc427b5658672768e11bfda00879839db4785f, 0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb, 6, true)),days as (select d, cast(d as timestamp) as t_start,least(cast(d + interval '1' day as timestamp), cast(now() as timestamp)) as t_endfrom unnest(sequence(date '2026-10-17', current_date, interval '1' day)) as s(d)),claims as (select evt_tx_hash, evt_block_time, evt_block_date, token, cast(amount as double) as amountfrom merkl_plasma.distributor_evt_claimedwhere evt_block_date >= date '2026-06-01' and "user" = 0xa11be438f1961db47f6660bdaf59b05c0200adc5),ev as (select contract_address as tok, evt_block_time as t,cast(value as double) - cast(balanceIncrease as double) as amt,(cast(value as double) - cast(balanceIncrease as double)) * 1e27 / cast(index as double) as scaled,false as is_rewardfrom aave_v3_plasma.atoken_evt_mintwhere evt_block_date >= date '2026-06-01' and onBehalfOf = 0xa11be438f1961db47f6660bdaf59b05c0200adc5and contract_address in (select tok from legs)union allselect contract_address, evt_block_time,-(cast(value as double) + cast(balanceIncrease as double)),-(cast(value as double) + cast(balanceIncrease as double)) * 1e27 / cast(index as double),falsefrom aave_v3_plasma.atoken_evt_burnwhere evt_block_date >= date '2026-06-01' and "from" = 0xa11be438f1961db47f6660bdaf59b05c0200adc5and contract_address in (select tok from legs)union allselect b.contract_address, b.evt_block_time,cast(b.value as double) * cast(b.index as double) / 1e27,cast(b.value as double),c.evt_tx_hash is not nullfrom aave_v3_plasma.atoken_evt_balancetransfer bleft join (select distinct evt_tx_hash from claims) c on c.evt_tx_hash = b.evt_tx_hashwhere b.evt_block_date >= date '2026-06-01' and b."to" = 0xa11be438f1961db47f6660bdaf59b05c0200adc5and b.contract_address in (select tok from legs)union allselect contract_address, evt_block_time,-cast(value as double) * cast(index as double) / 1e27,-cast(value as double),false