Sandeshaverage days held airdrop pirate
    Updated 2025-02-09
    -- Who are diamond hands ? They are users who have never had a balance of 0 after airdrop. So partital sellers are also considered as diamond hands as they are still part of the project.
    -- Caveat in this query: User might get multiple airdrops over time. We only look at the first airdrop and
    -- and look at if thier balance ever reached zero after that.
    -- Staking and unstaking transactions have been removed so. It will nor be displayed as selling it.

    -- Step 1: Identify wolves SBT holders
    WITH wolves_sbt_holders AS (
    (
    with users as
    (
    SELECT
    DATE_TRUNC('day', block_timestamp) AS member_since, tx_hash,
    nft_to_address AS member,
    tokenId
    FROM polygon.nft.ez_nft_transfers
    WHERE block_number >= '44071817' -- Consider only transactions from this block onwards (SBT airdrop block)
    AND nft_address = LOWER('0x0433882c60ada1077a9f652ca2d1d36422c62c6c') -- wolvesDAO sbt token
    QUALIFY ROW_NUMBER() OVER (PARTITION BY tokenId ORDER BY block_number DESC, event_index desc) = 1
    )
    select * from users
    where member != '0x0000000000000000000000000000000000000000' -- Ignore burn/mint address
    -- and member='0x9ff26d7e160a52064b328e38793e3569acbcae99'
    )
    ),
    -- Step 5: Identify airdrop recipients
    airdrop_table AS (
    (
    select
    block_timestamp,
    tx_hash,
    concat('0x',substr(data,27+64,40))::VARCHAR as to_address,
    (utils.udf_hex_to_int(substr(data,27+128,40))::DOUBLE)/1e18 AS airdrop_amount
    from ethereum.core.fact_event_logs
    where 1=1
    and block_timestamp>='2024-03-20'
    and topics[0]=lower('0x4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed026')
    Last run: 3 months ago
    AIRDROP_TIME
    AIRDROP_TX_HASH
    USER
    AIRDROP_AMOUNT
    EXIT_TX
    EXIT_TIME
    COUNTERPARTY
    EXIT_TYPE
    STATUS
    DAYS_HELD
    1
    2024-06-13 07:41:23.0000x16c622160a9f0193df08b3c432f603578dcd050cb0273096630d4f37f8b2c9240x46d7bef069afc328f8ccc091eaa3a61946ba54a1105518heldstill holding241
    2
    2024-06-16 18:50:47.0000x25593c4890138aafea5ca0ea47405f8849922b0988fd3042bbc9838e937e97720x1be393f5248a15a9e3e6c04dcbbf9edd7fbd7cf5768heldstill holding238
    3
    2024-06-13 09:57:11.0000xfd06e0a71c78fca30da699a0aa78d1b84236017c6fb264521f9ca20684902f1a0x29eb182b934780bb25c4656268df4c919225e7076912heldstill holding241
    4
    2024-06-13 14:16:23.0000xa18fa334f6b1dd84512195114dfa588fb80d5fa27e25c2ebc5a0d2d424ef78f70xfd817709270c06e096015a8fa70a0010e78bdec2413heldstill holding241
    5
    2024-06-13 03:52:35.0000x4ec700a9dce52edfb537cb990ea378d9d53b1c613c0e54fb1814d225ae77d5000xc64e917054073e919bd1bf2f2751cdef61fbacf71945heldstill holding241
    6
    2024-06-13 04:04:47.0000x9c3a4954f37930c28c2c8eb2e59eb115747ea4569da54f4b3fdc6d38af6f921f0xa9597e0dcd1be1c49ed844e1ba288893ccca132736674heldstill holding241
    7
    2024-06-13 03:31:11.0000x732803faeef41a9d1042698e6f07c45f565e53226b63098ffe4ecd1373f4bbbf0x669e69daf725648d187ad1b6b9b8476f3ae70d0958398heldstill holding241
    8
    2024-06-13 08:16:35.0000x61292d33ee94174afae05d409165d4f3c45ab39c09ddfd33300e2461c73adeb40x14759b2e39aab546d8b47342977e06ab5668290c12165heldstill holding241
    9
    2024-06-13 19:30:23.0000xd4c771b544c02b89a98dd74752f9245a6d7ef3c1f8963bf6a1c4c8f3a767545f0xde1860f55eb551ee63848dcedd922912f825bd36981heldstill holding241
    10
    2024-06-13 13:28:47.0000xa2e5d8acc255c298f925229d1b1c632a02c7e27b0a246c1acc84046adb65bedf0x88d7f7ec27f116f60b15ea66bd210094d0db034b17250heldstill holding241
    11
    2024-06-13 08:36:59.0000xb3e4e0bbc891b0ba720c367d242a0dfc0d5b88265298e2dfdd1ffc0a16f6676e0x86a1d85aa48343527d659a5682102d585a4b6fef85185heldstill holding241
    12
    2024-06-14 02:16:47.0000x8db569250f718232ae6e0838408537cd89f39b23ed88a656f090191762031c510xad5c39984149aa60663bbac47676f84192c04ca88483heldstill holding240
    13
    2024-06-14 22:26:35.0000x25c3e749210106c1ac2ab5b0bd0cd2552279c2cb44f664e46dfd5f853a55e4150x3843a8b71cacb65d11fbfef86c7863337ecf5894334heldstill holding240
    14
    2024-06-13 04:50:47.0000xcb0df1427b8128d958e3e732c8061202d84f4d8cbbdf89385ef689394654ebbe0xd171e53f2b06be6a30f8854228c76d5424c587c41668heldstill holding241
    15
    2024-06-13 07:21:59.0000xa07b633ba072db826d51fb5ed88a8cab9e0436e5c0f0959a8fc9abb7df47b6b20xdc1b140342966fd258885e51fcd16d2cf68be4bc1213heldstill holding241
    16
    2024-06-13 05:54:47.0000xaf9531be627eb21db7e83d57c48c40eac1106ca6c6d9e0ac8882bd6346087f310xd9ebc885674a93a7c119f37a6abf9dbed84e1ff815120heldstill holding241
    17
    2024-06-13 09:52:59.0000x90a19ddc595cd79c961e0589775f59ab7efa73c5312cb6f9f55e0ba715b29d8e0xe10cf142e3b83789b68e41ae2fa7151b317d589c334heldstill holding241
    18
    2024-06-13 05:44:11.0000x6ae5f00f822aa93b4663748b3cb18c6c88092a2c6939da8dab4ac3b7abe118540xdf5416a43ee3ed5fb34503778a9b4d6dfb2f244914918heldstill holding241
    19
    2024-06-13 09:23:47.0000x71c5e7cb23f11626b3f54cec8827890403c8971e56702a8f4a72a93a6b0bdf090x3096ce52ba75902240e73310af47264e22f2359320673heldstill holding241
    20
    2024-06-13 09:10:59.0000xe56ce857ce0d406dc7648a7ea3e60ef3cfd62a7a8edbe652785568a61feeae8a0x9ff26d7e160a52064b328e38793e3569acbcae99848heldstill holding241
    24
    4KB
    24s