Query editor
with locker_transfer as (selectblock_time,varbinary_substring (topic1, 13) as "from",varbinary_substring (topic2, 13) as "to",varbinary_to_uint256 (topic3) as token_idfrom ethereum.logswhere block_number >= 21734878 -- deployment block of lockerand contract_address = 0xe127cE638293FA123Be79C25782a5652581Db234 -- wenllama nftand topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef -- Transferand (topic1 = 0x00000000000000000000000099c3f30bbc9137f6e917b03c74aed8a4309b3e1b -- locker senderor topic2 = 0x00000000000000000000000099c3f30bbc9137f6e917b03c74aed8a4309b3e1b --or receiver) -- the padding is to avoid having to run substring() on the whole table),last_transfer as (SELECT a.*FROM locker_transfer aINNER JOIN(SELECT token_id,max(block_time) as block_timeFROM locker_transferGROUP BY token_id) AS bON a.token_id = b.token_idAND a.block_time = b.block_time),locked as (selectblock_time as lock_time,"from" as owner,token_idfrom last_transferwhere "to" = 0x99c3f30bbc9137f6e917b03c74aed8a4309b3e1b),unlock_time as (selecttoken_id,date_add('second', 28*24*3600*(((array_max(array[date_diff('second', lock_time, now()),7 * 24 * 3600 + 1]) - 7*24*3600)/(28*24*3600)) + 1), lock_time) as unlock_start,date_add('second', 28*24*3600*(((array_max(array[date_diff('second', lock_time, now()),7 * 24 * 3600 + 1]) - 7*24*3600)/(28*24*3600)) + 1) +7*24*3600, lock_time) as unlock_stop,owner,lock_timefrom locked)select*from unlock_timeorder by unlock_start