Query editor
-- Aave V4 Coinbase Stocks spoke (Base): event-level ledger (supply/withdraw/borrow/repay/liquidation) for flow + cohort analysiswith sp as (select 0x17905Db0e4A3514467539956c084180616AE7B8D a)select evt_block_time t, evt_block_number b, evt_index i, evt_tx_hash tx, 'supply' k, user wallet, caller, cast(reserveId as integer) rid, cast(suppliedAmount as double) amt, cast(suppliedShares as double) sh from aave_v4_base.mag7spokeinstance_evt_supply where contract_address=(select a from sp)union all select evt_block_time, evt_block_number, evt_index, evt_tx_hash, 'withdraw', user, caller, cast(reserveId as integer), -cast(withdrawnAmount as double), -cast(withdrawnShares as double) from aave_v4_base.mag7spokeinstance_evt_withdraw where contract_address=(select a from sp)union all select evt_block_time, evt_block_number, evt_index, evt_tx_hash, 'borrow', user, caller, cast(reserveId as integer), cast(drawnAmount as double), cast(drawnShares as double) from aave_v4_base.mag7spokeinstance_evt_borrow where contract_address=(select a from sp)union all select evt_block_time, evt_block_number, evt_index, evt_tx_hash, 'repay', user, caller, cast(reserveId as integer), -cast(totalAmountRepaid as double), -cast(drawnShares as double) from aave_v4_base.mag7spokeinstance_evt_repay where contract_address=(select a from sp)union all select evt_block_time, evt_block_number, evt_index, evt_tx_hash, 'liq_coll', user, liquidator, cast(collateralReserveId as integer), -cast(collateralAmountRemoved as double), -cast(collateralSharesLiquidated as double) from aave_v4_base.mag7spokeinstance_evt_liquidationcall where contract_address=(select a from sp)union all select evt_block_time, evt_block_number, evt_index, evt_tx_hash, 'liq_debt', user, liquidator, cast(debtReserveId as integer), -cast(debtAmountRestored as double), -cast(drawnSharesLiquidated as double) from aave_v4_base.mag7spokeinstance_evt_liquidationcall where contract_address=(select a from sp)order by 1,2,3