connorhAirdrop Flows
    Updated 2021-07-22
    with recursive eth_recurse
    -- Column names for the "view"/CTE
    (airdrop_recipient, to_address, degree_out,total_claimed,first_claim_time)
    as
    -- Common Table Expression
    (
    -- Anchor is airdrop recipients and the amounts they received
    select
    from_address as airdrop_recipient,
    to_address,
    1 AS degree_out,
    sum(amount) as total_claimed,
    min((((tctoflbrsttclaim_time
    from ethereum.udm_events where from_address = LOWER('0x090d4613473dee047c3f2706764f49e0821d256e')
    and block_timestamp > '2020-09-01' and block_timestamp < '2020-11-01'
    and symbol = 'UNI'
    and origin_function_name = 'claim'
    group by 1,2,3

    union all
    -- Recursive bit
    SELECT
    b.airdrop_recipient AS airdrop_recipient,
    a.to_address,
    a.degree_out + 1 AS degree_out,
    a.total_claimed,
    b.first_claim_time
    FROM eth_recurse b
    LEFT JOIN (
    select
    from_address as airdrop_recipient,
    to_address,
    1 AS degree_out,
    sum(amount) as total_claimed,
    min(block_timestamp) as first_claim_time
    Run a query to Download Data