Query editor
with locks as (select distinctlog.tx_hash,-- log.index,log.tx_from as address,CONCAT('<a href="https://debank.com/profile/',COALESCE(CAST(log.tx_from AS VARCHAR), ''),'" target="_blank">',COALESCE(NULLIF(ens.reverse_latest.name,''), CAST(log.tx_from AS VARCHAR), ''),'</a>') AS wallet,log.block_time,log.block_number,log.tx_index,log.contract_address,varbinary_to_int256(BYTEARRAY_SUBSTRING(data, 1, 32)) / 1e18 AS locked,varbinary_to_int256(BYTEARRAY_SUBSTRING(data, 33, 32)) AS starts_at,varbinary_to_int256(BYTEARRAY_SUBSTRING(data, 66, 32)) as locked_for_raw,varbinary_to_int256(log.topic2) as token_idfrom ethereum.logs logLEFT JOIN ens.reverse_latest ON ens.reverse_latest.address = log.tx_fromwhere log.block_number >= 18930110and log.contract_address = 0xed96E69d54609D9f2cFf8AaCD66CCF83c8A1B470and log.topic0 = 0x1b25091f383cba212d5e47f30dcc73a111f1304bf07e7f2c8503c7c311ddc6f0), clean as (select *,casewhen locked_for_raw = 2 then 1when locked_for_raw = 8 then 9when locked_for_raw = 32 then 25when locked_for_raw = 64 then 36when locked_for_raw = 128 then 49when locked_for_raw = 4 then 4when locked_for_raw = 16 then 16else locked_for_rawend AS locked_for,casewhen locked_for_raw = 2 then 0.5when locked_for_raw = 8 then 4.5when locked_for_raw = 32 then 12.5when locked_for_raw = 64 then 18when locked_for_raw = 128 then 24.5when locked_for_raw = 4 then 2when locked_for_raw = 16 then 8else 0end AS streaming_yield_multiplierfrom locks)select *,starts_at - 2820 as interval,case when starts_at = 2820 then 0 else starts_at - 2821 end as interval2,starts_at + locked_for_raw as ends_at,starts_at + locked_for_raw - 2820 as ends_at_interval,starts_at + locked_for as ends_at_ui,starts_at + locked_for - 2820 as ends_at_interval_ui,-- date_add('day', cast(locked_for * 7 as bigint) + 7, block_time) as unlocked_at,