SalehGovernance Statistics-Number of voters on Sushiswap
    Updated 2022-01-26
    with lst_addLiquidity_pool as (
    select ORIGIN_ADDRESS as wallet,TO_ADDRESS_NAME as pool_name,TO_ADDRESS as pool_address,amount from ethereum.udm_events
    WHERE to_label='sushiswap'
    and ORIGIN_FUNCTION_NAME='addLiquidity'
    and pool_address ='0x795065dcc9f64b5614c407a6efdc400da6221fb0' --SUSHI-ETH pool
    and symbol='SUSHI' --token sushi
    -- and symbol='SUSHI'
    )
    , lst_removeLiquidity_pool as (
    select ORIGIN_ADDRESS as wallet,from_ADDRESS_NAME as pool_name,from_ADDRESS as pool_address,-1*amount from ethereum.udm_events
    WHERE from_label='sushiswap'
    and ORIGIN_FUNCTION_NAME='removeLiquidity'
    and pool_address ='0x795065dcc9f64b5614c407a6efdc400da6221fb0' --SUSHI-ETH pool
    and symbol='SUSHI' --token sushi
    -- and symbol='SUSHI'
    )
    ,lst_result as (
    select * from lst_addLiquidity_pool
    union all select * from lst_removeLiquidity_pool
    )
    , lst_wallet_sushi_token_amount as (
    select WALLET,sum(amount) as sum_amount from lst_result
    group by 1
    having sum_amount>0
    )


    ,lst_wallets_voter as (
    select USER_ADDRESS from ethereum.erc20_balances
    where CONTRACT_ADDRESS='0x8798249c2e607446efb7ad49ec89dd1865ff4272'
    and balance_date=(select max(balance_date) from ethereum.erc20_balances)
    and BALANCE>0
    union all select WALLET from lst_wallet_sushi_token_amount
    )
    select count(DISTINCT USER_ADDRESS) as Number_of_voters from lst_wallets_voter

    Run a query to Download Data