Filter for all ETH-USDC swap prices on Uniswap
const ETH_USDC_PAIR_CONTRACT_ADDRESS = "CONTRACT_ADDRESS"
export collection filtered_receipts_logs = @input("ETHEREUM_RECEIPTS_LOGS")
.filter(log => log.address == ETH_USDC_PAIR_CONTRACT_ADDRESS)operator parse_swap_logs<T> {
input logs: T
output logs
.map(closure_parse_swap_logs)
}
operator calc_swap_token0_price<T> {
input swaps: T
output swaps
.map(swap => swap.amount1Out / swap.amount0In)
}
export collection token0_prices = filtered_receipts_logs
.parse_swap_logs()
.calc_swap_token0_price()PreviousZip and binary mapNextCalculate a 24-hour block-by-block moving average of the ETH-USDC pair on Uniswap
Last updated