Query editor
-- 0xC73151DcA19ffF7A16aE421a9fb35455832d66d3 Curve.fi Factory USD Metapool: DUSD/FRAXBP-- 2023-06-28 pool created-- 17576616 Block Heightwith contract_address (address, name) as (values(0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508, 'ankrstaking.eth'),(0x9008D19f58AAbD9eD0D60971565AA8510560ab41, 'CoW Protocol: GPv2Settlement'),(0xdc64B2DcA7cd2f8A70cd8218f07D68c7131a0839, 'Uniswap V3: USDC-DUSD'),(0x854B004700885A61107B458f11eCC169A019b764, 'Frax Finance: Deployer 14'),(0x50347Cae376b0e3fe90b97858E2fdbeA6FEDFF40, 'MEV Bot'),(0xeF13101C5bbD737cFb2bF00Bbd38c626AD6952F7, 'Paraswap v5: Fee Claimer'),(0xb5087f95643a9a4069471a28d32c569d9bd57fe4, 'Bunni Protocol'),(0xdDAE006600000000eFEB4d7a6600007D6e1F001f, 'Arbitrage Bot'),(0xD5B927956057075377263aaB7f8AfC12F85100dB, 'mimic.fi: Smart Vault'),(0xb634316E06cC0B358437CbadD4dC94F1D3a92B3b, 'Yearn.Finance: TradeHandler'),(0xb0baBabE78a9be0810fAdf99Dd2eD31ed12568bE, 'MEV Bot'),(0xCf5540fFFCdC3d510B18bFcA6d2b9987b0772559, 'Odos Router V2'),(0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80, 'MEV Bot'),(0x1111111254EEB25477B68fb85Ed929f73A960582, '1inch Aggregation Router v5'),(0x3FAcE0004bC1003B9d0672e7B23134Cb80115fb6, 'MEV Bot'),(0x53FacEe52e897740B140F5304E9Cd9DC6238d735, 'MEV Bot'),(0xE37e799D5077682FA0a244D46E5649F71457BD09, '1inch'),(0xdef171fe48cf0115b1d80b88dc8eab59176fee57, 'Paraswap Protocol'),(0xF0d4c12A5768D806021F80a262B4d39d26C58b8D, 'Curve.fi Router v1.0')),events as (select evt_block_time, 'deposit' as event, "from" as address, (cast(value/1e18 as double)) as amountfrom davos_ethereum.DUSD_evt_Transferwhere evt_block_time >= cast('2023-06-28' as timestamp) -- Curve.fi Factory USD Metapool: DUSD/FRAXBP pool createdand "to" = 0xC73151DcA19ffF7A16aE421a9fb35455832d66d3 -- Curve Pooland "to" != 0x0000000000000000000000000000000000000000 -- Null Addressand cast(value as double) is not null and cast(value as double) > 0union allselect evt_block_time, 'withdraw' as event, "to" as address, (cast(value/1e18 as double)) as amountfrom davos_ethereum.DUSD_evt_Transferwhere evt_block_time >= cast('2023-06-28' as timestamp) -- Curve.fi Factory USD Metapool: DUSD/FRAXBP pool createdand "from" = 0xC73151DcA19ffF7A16aE421a9fb35455832d66d3-- Curve Pooland "from" != 0x0000000000000000000000000000000000000000 -- Null Addressand cast(value as double) is not null and cast(value as double) > 0),clarify_data as (select *,case when event = 'deposit' then amount else 0 end as amount_raw_deposit,case when event = 'withdrawal' then amount else 0 end as amount_raw_withdrawalfrom events -- pool transferswhere evt_block_time >= cast('2024-05-21' as timestamp) -- start Davos Apex Adventure),aggregated as (select event as action, address as lp, evt_block_time,sum(amount_raw_deposit - amount_raw_withdrawal) over (order by evt_block_time) as balance,sum(amount_raw_deposit) over (order by evt_block_time) as amount_raw_deposit,sum(amount_raw_withdrawal) over (order by evt_block_time) as amount_raw_withdrawal,coalesce(lead(evt_block_time) over (order by evt_block_time), current_timestamp) as next_updatefrom clarify_datawhere address not in (select address from contract_address)),