Query editor
WITHboi_100_wallets AS (SELECT wallet, tokens_received_time, token_amount_recievedFROM query_5030075),token_transfers AS (SELECT "from" "wallet", -CAST(value / 1E18 AS DOUBLE) "value", evt_block_time "block_time", evt_tx_hash, FALSE "is_enter", bw.tokens_received_time "token_allocation_received_time", bw.token_amount_recieved "token_allocation_received_amt"FROM erc20_avalanche_c.evt_Transfer tINNER JOIN boi_100_wallets bwON t."from" = bw.walletWHERE contract_address = 0xACC95Afa65768aa74044E6f6e267AD6417CD3e55 --BoiUNION ALLSELECT to "wallet", CAST(value / 1E18 AS DOUBLE) "value", evt_block_time "block_time", evt_tx_hash, TRUE "is_enter", bw.tokens_received_time "token_allocation_received_time", bw.token_amount_recieved "token_allocation_received_amt"FROM erc20_avalanche_c.evt_Transfer tINNER JOIN boi_100_wallets bwON t.To = bw.walletWHERE contract_address = 0xACC95Afa65768aa74044E6f6e267AD6417CD3e55 --Boi),summarized_wallets AS (SELECT Wallet, SUM(s.value) "Amount", SUM(IF(is_enter, value, 0)) "total_received", SUM(IF(is_enter, 0, value)) "total_withdrawn", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' minute, value, 0)) "received_within_1m", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' minute, value, 0)) "withdrawn_within_1m", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '5' minute, value, 0)) "received_within_5m", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '5' minute, value, 0)) "withdrawn_within_5m", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '15' minute, value, 0)) "received_within_15m", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '15' minute, value, 0)) "withdrawn_within_15m", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' hour, value, 0)) "received_within_1h", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' hour, value, 0)) "withdrawn_within_1h", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '6' hour, value, 0)) "received_within_6h", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '6' hour, value, 0)) "withdrawn_within_6h", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' day, value, 0)) "received_within_1d", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' day, value, 0)) "withdrawn_within_1d", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '3' day, value, 0)) "received_within_3d", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '3' day, value, 0)) "withdrawn_within_3d", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '7' day, value, 0)) "received_within_1w", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '7' day, value, 0)) "withdrawn_within_1w", SUM(IF(s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' month, value, 0)) "received_within_1Month", SUM(IF(NOT s.is_enter AND s.block_time > token_allocation_received_time AND s.block_time <= token_allocation_received_time + interval '1' month, value, 0)) "withdrawn_within_1Month", MAX(IF(is_enter, s.block_time, NULL)) "max_received_datetime", MAX_BY(s.value, IF(is_enter, s.block_time, NULL)) "max_received_amount", MAX_BY(s.evt_tx_hash, IF(is_enter, s.block_time, NULL)) "max_received_tx_hash", MIN(IF(is_enter, s.block_time, NULL)) "min_received_datetime", MIN_BY(s.value, IF(is_enter, s.block_time, NULL)) "min_received_amount"