-- the number of swaps and USDC volume in the WBTC-WETH SushiSwap pool over the April 1 - April 15, 2022
-- get details for relevant pool
with pools as
(
select pool_name
, pool_address
, token0
, token1
from ethereum.core.dim_dex_liquidity_pools
where pool_address = lower('0xceff51756c56ceffca006cd410b03ffc46dd3a58') -- WBTC-WETH Pool (https://etherscan.io/address/0xceff51756c56ceffca006cd410b03ffc46dd3a58#tokentxns)
),
-- get details for tokens in relevant pool
decimals as
(
select address
, symbol
, decimals
from ethereum.core.dim_contracts
where address =
(
select lower(token1)
from pools
)
or address =
(
select lower(token0)
from pools
)
),
-- aggregate pool and token details
pool_token_details as
(
select pool_name
, pool_address
, token0