crabtriumph-3379Legendary Farm - Top Rice Bag
    Updated 2024-05-16
    -- forked from sssstatistic / TOP Rice Bag @ https://flipsidecrypto.xyz/sssstatistic/q/g2LfIseOt9AX/top-rice-bag
    With total AS (
    select
    SUM(
    CASE
    event_name
    WHEN 'ClaimPoint' THEN decoded_log ['points']
    WHEN 'ClaimPointOfLand' THEN decoded_log ['totalPoints']
    WHEN 'LandWithdrawRewardFromPool' THEN decoded_log ['points'] * -1
    WHEN 'WithdrawRewardFromPool' THEN decoded_log ['points'] * -1
    ELSE 0
    END / pow(10, 18)
    ) AS bag
    from
    blast.core.ez_decoded_event_logs
    where
    contract_address = '0xc48f6213a1a4d3ead79db812c2b91817980532c3'
    and event_name in (
    'ClaimPointOfLand',
    'ClaimPoint',
    'LandWithdrawRewardFromPool',
    'WithdrawRewardFromPool'
    )
    )
    select
    coalesce(
    decoded_log ['account'],
    concat('#', decoded_log ['landId'])
    ) AS account,
    round(
    SUM(
    CASE
    event_name
    WHEN 'ClaimPoint' THEN decoded_log ['points']
    WHEN 'ClaimPointOfLand' THEN decoded_log ['totalPoints']
    WHEN 'LandWithdrawRewardFromPool' THEN decoded_log ['points'] * -1
    QueryRunArchived: QueryRun has been archived