Query editor
/*** Query Description:* Manager Fee is cumultaive sum of the fee from the event ManagerFeeMinted for each fund** For each fund, we get all the events of the type ManagerFeeMinted.* To do this, we first find out the event topic using ethers.js library* Next for each event, extract the manager fee in bytes* Convert the bytes to numeric using dune's abstractions bytea2numeric()**/WITHdhedge_v2_pools AS (SELECTDISTINCT output_fund AS fund_address,e."_fundName" AS fund_nameFROMdhedge_v2_base."PoolFactory_call_createFund" eWHEREcall_success = true),pool_manager_fees AS (SELECTmanager_fee,fund_name,DATE_TRUNC('day',date) as datefrom(SELECTDISTINCT dhedge_v2_pools.fund_name as fund_name,(cast(bytearray_to_uint256(bytearray_substring(data, 129, 32))as double) *cast(bytearray_to_uint256(bytearray_substring(data, 161, 32))as double)) / 1e36 as manager_fee,block_time as dateFROMbase.logs,dhedge_v2_poolsWHEREcontract_address = dhedge_v2_pools.fund_addressAND topic0 = 0x755a8059d66d8d243bc9f6913f429a811f154599d0538bb0b6a2ac23f23d2ccd -- ManagerFeeMinted event topic) e)SELECTsum(manager_fee) as fee,dateFROMpool_manager_feesgroup by pool_manager_fees.dateorder by date asc