Query editor
with flows as (selectblock_time,casewhen topic0 = 0xa7c2e65a1acb60d7ad1de1c523988ccedba739d1184defb9c84afaeb6479b261then bytearray_to_uint256(bytearray_substring(data, 1, 32)) -- mintelse bytearray_to_uint256(bytearray_substring(data, 33, 32)) -- redeemend as fpi_flow,casewhen topic0 = 0xa7c2e65a1acb60d7ad1de1c523988ccedba739d1184defb9c84afaeb6479b261then bytearray_to_uint256(bytearray_substring(data, 33, 32)) -- mintelse bytearray_to_uint256(bytearray_substring(data, 1, 32)) -- redeemend as frax_flow,casewhen topic0 = 0xa7c2e65a1acb60d7ad1de1c523988ccedba739d1184defb9c84afaeb6479b261 then 'redeem'when topic0 = 0xf4c708dad0640bb97b06e573b39b194c40301c581997805cbc86390ace5848c7 then 'mint'-- else 'mint'end as operation,tx_hash,block_number,index,tx_index,topic0from ethereum.logswhereblock_number >= 14524115and (contract_address = 0x2397321b301b80a1c0911d6f9ed4b6033d43cf51or contract_address = 0x309AC8840f9b4C7eEB5bAb1e89669d8dbb86c060)and (topic0 = 0xa7c2e65a1acb60d7ad1de1c523988ccedba739d1184defb9c84afaeb6479b261 -- redeemor topic0 = 0xf4c708dad0640bb97b06e573b39b194c40301c581997805cbc86390ace5848c7 -- mint))-- select * from flows-- We need to cross with traces to exclude transactions from frax wallets,traces as (select*,case when bytearray_substring(input, 1, 4) = 0x4d6f9ef2 then 'mint' else 'redeem' end as operationfrom ethereum.traceswhere successand block_number >= 14524115and (("to" = 0x2397321b301b80a1c0911d6f9ed4b6033d43cf51or "to" = 0x309AC8840f9b4C7eEB5bAb1e89669d8dbb86c060)and (bytearray_substring(input, 1, 4) = 0x4d6f9ef2 -- mintor bytearray_substring(input, 1, 4) = 0xc5a36df1 -- redeem))),_join as (selectf.block_time