mlhShare of lenders whom farmed their lending position for extra yield
    Updated 2022-07-20
    with kashi_lp_stake_transactions AS (SELECT deposit.tx_hash,
    deposit.block_timestamp,
    deposit.event_inputs['sender']::string AS wallet,
    deposit.event_name,
    transfer.contract_address AS lp_token_address,
    transfer.symbol,
    transfer.amount
    FROM ethereum.core.fact_event_logs AS deposit
    INNER JOIN ethereum.core.ez_token_transfers AS transfer ON transfer.tx_hash = deposit.tx_hash
    AND transfer.from_address = deposit.event_inputs['sender']::string
    AND transfer.to_address = '0xc2edad668740f1aa35e4d8f227fb8e17dca888cd'
    AND transfer.raw_amount = try_cast(deposit.event_inputs['amount']::STRING AS BIGINT)
    AND transfer.contract_address IN (SELECT lending_pool_address
    FROM (SELECT DISTINCT lending_pool_address
    FROM ethereum.sushi.ez_borrowing
    UNION
    SELECT DISTINCT lending_pool_address
    FROM ethereum.sushi.ez_lending
    )
    )
    AND transfer.amount > 0
    WHERE deposit.contract_address = '0xc2edad668740f1aa35e4d8f227fb8e17dca888cd' -- Masterchef
    AND deposit.event_name = 'Deposit'
    AND try_cast(deposit.event_inputs['amount']::STRING AS BIGINT) > 0
    ),

    kashi_lp_unstake_transactions AS (SELECT withdraw.tx_hash,
    withdraw.block_timestamp,
    withdraw.event_inputs['account']::string AS wallet,
    withdraw.event_name,
    transfer.symbol,
    transfer.amount ,
    transfer.contract_address AS lp_token_address
    FROM ethereum.core.fact_event_logs AS withdraw
    INNER JOIN ethereum.core.ez_token_transfers AS transfer ON transfer.tx_hash = withdraw.tx_hash
    AND transfer.to_address = withdraw.event_inputs['account']::string
    Run a query to Download Data