Query editor
WITHGNP_base AS(select lockAddress as contract_address, count(evt_block_time) as num_transfers, tokenAddress, sum(value) as total_value, 'base' as context from unlock_base.Unlock_evt_GNPChangedwhere evt_block_time > (now() - Interval '2' year)GROUP BY lockAddress, tokenAddress),lock_name_table_base AS(select distinct created_at, address, ltrim(from_utf8(bytearray_substring(code,bytearray_length(code)-91,91))) as lock_name from base.contractswhere namespace = 'unlock'),GNP_arbitrum AS(select lockAddress as contract_address, count(evt_block_time) as num_transfers, tokenAddress, sum(value) as total_value, 'arbitrum' as context from unlock_arbitrum.Unlock_evt_GNPChangedwhere evt_block_time > (now() - Interval '2' year)GROUP BY lockAddress, tokenAddress),lock_name_table_arbitrum AS(select distinct created_at, address, ltrim(from_utf8(bytearray_substring(code,bytearray_length(code)-91,91))) as lock_name from arbitrum.contractswhere namespace = 'unlock'),GNP_ethereum AS(select lockAddress as contract_address, count(evt_block_time) as num_transfers, tokenAddress, sum(value) as total_value, 'ethereum' as context from unlock_ethereum.Unlock_evt_GNPChangedwhere evt_block_time > (now() - Interval '2' year)GROUP BY lockAddress, tokenAddress),lock_name_table_ethereum AS(select distinct created_at, address,CASEWHEN address = 0x741f2a0e228fdc752b0ba12b811e40dff86f7252 THEN 'DeFi-Robot Monthly Membership - Tier 3'ELSE ltrim(from_utf8(bytearray_substring(code,bytearray_length(code)-91,91)))END as lock_name from ethereum.contractswhere namespace = 'unlock'),GNP_avalanche_c AS(select lockAddress as contract_address, count(evt_block_time) as num_transfers, tokenAddress, sum(value) as total_value, 'avalanche_c' as context from unlock_avalanche_c.Unlock_evt_GNPChangedwhere evt_block_time > (now() - Interval '2' year)GROUP BY lockAddress, tokenAddress),lock_name_table_avalanche_c AS(select distinct created_at, address, ltrim(from_utf8(bytearray_substring(code,bytearray_length(code)-91,91))) as lock_name from avalanche_c.contractswhere namespace = 'unlock'),GNP_optimism AS(select lockAddress as contract_address, count(evt_block_time) as num_transfers, tokenAddress, sum(value) as total_value, 'optimism' as context from unlock_optimism.Unlock_evt_GNPChangedwhere evt_block_time > (now() - Interval '2' year)GROUP BY lockAddress, tokenAddress),lock_name_table_optimism AS(select distinct created_at, address, ltrim(from_utf8(bytearray_substring(code,bytearray_length(code)-91,91))) as lock_name from optimism.contractswhere namespace = 'unlock'),