Query editor
withfpi_target_price as (selectblock_time,cast(bytearray_to_uint256(output) as double) / pow(10, 18) as price_dec,bytearray_to_uint256(output) as price_bn,cast(bytearray_to_uint256(output) as double) / pow(10, 18) as price_dec_altfrom ethereum.tracesWHERE-- block_number >= 15353353block_number >= 14411508and tx_successand (to = 0x66B7DFF2Ac66dc4d6FBB3Db1CB627BBb01fF3146or to = 0x7086F2aCB5558043fF9cE3df346D8E3FB4F4f452or to = 0x04BaF30115D7bAC714709910Dd286718CfAd8808)and input = 0x3c09868e),uniswap_twap_oracle as (select-- bytearray_length(output) as length-- ,bytearray_substring(output, 1, 32) as roundId_bytes-- ,bytearray_substring(output, 33, 32) as answer_bytes-- ,bytearray_substring(output, 65, 32) as startedAt-- ,bytearray_substring(output, 97, 32) as updatedAt-- ,bytearray_substring(output, 129, 32) as answeredInRound-- ,bytearray_to_int256(bytearray_substring(output, 33, 32)) as price_bnblock_time,bytearray_to_int256(bytearray_substring(output, 33, 32)) as price_bn,cast(bytearray_to_int256(bytearray_substring(output, 33, 32)) as double) / 1e18 as price_dec,cast(bytearray_to_int256(bytearray_substring(output, 33, 32)) as double) / 1e18 as price_dec_alt-- ,*from ethereum.tracesWHEREblock_number >= 14495636and successand input = 0xfeaf968cand to = 0x59985D79E1e69f659f4aB97Db07A35cE73D9174B),fpi_dex_price as (selectdate_trunc('hour', block_time) as time-- ,sum(amount_usd) / sum(case when token_sold_address = 0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E then token_sold_amount else token_bought_amount end) as price,sum(amount_usd) / sum(abs(fpi_flow)) as pricefrom query_2224326 group by 1),fpi_curve_price as (selectevt_block_time as block_time,casewhen sold_id = cast(0 as uint256) then cast(tokens_sold as double) / cast(tokens_bought as double)else cast(tokens_bought as double) / cast(tokens_sold as double)end as price_decfrom curvefi_ethereum.FRAX_FPI_evt_TokenExchange