pinehearstSweat Economy - 3. Staking Metrics Overtime
    Updated 2025-02-03
    with logs AS (
    SELECT
    block_timestamp,
    tx_hash,
    status_value,
    replace(value, 'EVENT_JSON:') as json,
    regexp_substr(status_value, 'Success') as reg_success,
    try_parse_json(json):standard as standard,
    try_parse_json(json):event as event,
    try_parse_json(json):data as data_logs
    FROM near.core.fact_receipts,
    table(flatten(input => logs))
    WHERE 1=1
    AND receiver_id = 'token.sweat'
    AND reg_success is not null
    -- AND tx_hash = '4nhKMTp6e6cv4tqbCNXAZuHUuidU7pUvgSmxVZS6EzUB' -- ft_transfer
    -- AND tx_hash = '4Wr1y27zQsEoCK7pCwemfABxe3nccE8cve4SWGS4gsHJ' -- ft_mint
    ),
    sweat_transfer AS (
    SELECT
    block_timestamp,
    tx_hash,
    standard,
    event,
    value:amount/pow(10,18) as amount,
    value:owner_id as owner_id,
    value:old_owner_id as old_owner_id, -- ft_transfer
    value:new_owner_id as new_owner_id, -- ft_transfer
    -- case when event = 'ft_mint' then 'mint' when event = 'ft_transfer' then old_owner_id else 'null' end as from_address,
    nvl(old_owner_id, 'mint') as from_address,
    nvl(new_owner_id, owner_id) as to_address
    FROM logs,
    table(flatten(input => data_logs))
    WHERE amount > 0
    ),
    new_stakers AS (
    Last run: 2 months ago
    DATE
    Stakers
    10%
    25%
    50%
    75%
    90%
    Avg
    SWEAT Staked
    Total SWEAT Staked
    FIRST_STAKE_DATE
    New Stakers
    Total SWEAT Stakers
    Returning Stakers
    1
    2024-03-07 00:00:00.0003108.166120.415140.83285.91372.958223.94671.821104813144.10192
    2
    2024-03-06 00:00:00.000586.692205.3224.726519.73627.892331.47521657.3761104812472.281922024-03-06 00:00:00.000119878294
    3
    2024-03-05 00:00:00.0001300.41300.41300.41300.41300.41300.41300.411104810814.90592
    4
    2024-03-04 00:00:00.000382.386101.7133.89587.87860.258415.0833333331245.251104810514.495922024-03-04 00:00:00.000219878281
    5
    2024-03-03 00:00:00.000533.37266.45126.38196.77362.838174.894874.471104809269.245922024-03-03 00:00:00.000219878263
    6
    2024-03-01 00:00:00.000221.4222.87525.327.72529.1825.350.61104808394.775922024-03-01 00:00:00.000119878241
    7
    2024-02-29 00:00:00.0005132.642142.83185.63243405.924242.371211.851104808344.175922024-02-29 00:00:00.000119878234
    8
    2024-02-28 00:00:00.00075.8969.8457.91256.305406.444144.5314285711011.721104807132.325922024-02-28 00:00:00.000119878226
    9
    2024-02-27 00:00:00.000243.90179.7525139.505199.2575235.109139.505279.011104806120.605922024-02-27 00:00:00.000119878211
    10
    2024-02-26 00:00:00.0001392.98392.98392.98392.98392.98392.98392.981104805841.595922024-02-26 00:00:00.000119878200
    11
    2024-02-25 00:00:00.000291.92298.69109.97121.25128.018109.97219.941104805448.61592
    12
    2024-02-24 00:00:00.0002348.249371.0925409.165447.2375470.081409.165818.331104805228.67592
    13
    2024-02-23 00:00:00.00077.25213.7128.1641.15564.11632.882857143230.181104804410.345922024-02-23 00:00:00.000319878194
    14
    2024-02-22 00:00:00.000619.0627.187566.235172.7075284.575123.29739.741104804180.16592
    15
    2024-02-21 00:00:00.00036.20413.87526.66384.775599.644256.88770.641104803440.425922024-02-21 00:00:00.000119878162
    16
    2024-02-20 00:00:00.000472.686106.715249.715410.8625477.557267.86251071.451104802669.785922024-02-20 00:00:00.000219878152
    17
    2024-02-19 00:00:00.000560.47277.68101.58591.41693.536316.2581581.291104801598.335922024-02-19 00:00:00.000119878134
    18
    2024-02-18 00:00:00.00041.0211.052554.605170.2975282.181116.745466.981104800017.045922024-02-18 00:00:00.000219878122
    19
    2024-02-17 00:00:00.0002270.344278.345291.68305.015313.016291.68583.361104799550.06592
    20
    2024-02-16 00:00:00.000175.8975.8975.8975.8975.8975.8975.891104798966.70592
    ...
    542
    78KB
    1142s