Query editor
WITH all_bins AS (with bin_array AS (SELECT sequence(cast(1 AS bigint), cast(40 AS bigint), cast(5 AS bigint)) AS bins)SELECT bin FROM bin_arrayCROSS JOIN unnest(bins) as bins(bin)),all_vests AS (SELECT block_time, bytearray_substring(topic1, 1 + 12, 20) AS user, bytearray_to_uint256(bytearray_substring(data, 1, 32))/(60*60*24*7) as duration_weeks, 1+5*FLOOR((bytearray_to_uint256(bytearray_substring(data, 1, 32))-1)/(60*60*24*7*5)) as week_bin, bytearray_to_uint256(bytearray_substring(data, 1 + 32, 32)) * 1e-18 as o_amount, bytearray_to_uint256(bytearray_substring(data, 1 + 64, 32)) * 1e-18 as pair_amount, bytearray_to_uint256(bytearray_substring(data, 1 + 96, 32)) as token_id, tx_hashFROM arbitrum.logsWHEREtopic0 = 0xdc6cbf8e9408cc595ca2ec5f126a5d2c09d5e2069237dc96f1d93188515a6366 -- vesting startedAND bytearray_to_uint256(bytearray_substring(data, 1, 32)) > 0 -- zero-duration vesting events are instant unlocks, not 'locked'AND contract_address = 0xec0f08bc015a0d0fba1df0b8b11d4779f5a04326)SELECTbin,CONCAT(CAST(bin AS varchar), '-', CAST(bin+4 AS varchar), ' weeks') as title,coalesce(sum(o_amount), 0) as o_amount,coalesce(sum(pair_amount), 0) AS pair_amount,count(o_amount) AS vestsFROM all_bins LEFT JOIN all_vests ON all_bins.bin = all_vests.week_binGROUP BY binORDER BY bin ASC