CryptoIcicleOptimism-10.Velodrome Health - Common Duration
    Updated 2022-08-14
    -- Velodrome Health
    -- Q10. Create 3 dashboards on Velodrome with a description for each that showcase traction and success in a data-driven manner.
    -- Most importantly, your insights should help our readers answer the question "How healthy is this project?"
    -- Payout 150 USDC
    -- Grand Prize 450 USDC
    -- Payout Network Ethereum
    -- Level Advanced
    -- Difficulty Elite

    WITH base AS (
    SELECT
    *,
    CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 42)) AS provider,
    ethereum.public.udf_hex_to_int(
    topics [2] :: STRING
    ) :: DATE AS locked_date,
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
    ethereum.public.udf_hex_to_int(
    segmented_data [0] :: STRING
    ) AS tokenID,
    ethereum.public.udf_hex_to_int(
    segmented_data [1] :: STRING
    )/pow(10,18) AS VALUE,
    ethereum.public.udf_hex_to_int(
    segmented_data [2] :: STRING
    ) AS deposit_type,
    ethereum.public.udf_hex_to_int(
    segmented_data [3] :: STRING
    ) AS TIMESTAMP
    FROM
    optimism.core.fact_event_logs
    WHERE 1=1
    -- and block_number = 12097159
    and topics [0] :: STRING = '0xff04ccafc360e16b67d682d17bd9503c4c6b9a131f6be6325762dc9ffc7de624'
    and block_timestamp >= CURRENT_DATE - {{n_days}}
    ),
    Run a query to Download Data