Query editor
WITH fr_price AS (SELECT dex_pricesFROM query_4221302LIMIT 1), entity_fr_holdings AS (SELECTCASEWHEN address = '7FpNhnCQvqZXyeCLULEwXLEvzC2T4e7CCELZcoQ1bPja' then 'Treasury Reserved Locked'WHEN address = '6kH1BbK3pV9gUcDSPT8Aob41CfFAKvcFe6dxcwvKwFgZ' then 'Distributor'WHEN address = '4eTDo4cCi4ykE2VgCcEYSraJiKSdsormLrUXENPj4Qmu' then 'FR Liquidity Pool'WHEN address = 'D2qPu84yYBZDveYhCHqQ8F1aFHa4f32zBmwwLzbz4QH5' then 'Protocol Treasury'WHEN address = 'fz1YmhoNY62X9FMq9XMEadJdB2RBVPzLCypfGzAcyn7' then 'Marketing'WHEN address = 'Br6nfKhtqmMswekMBGKuUqxsBJ52YJg9KYPNgXubT8xE' then 'Team Vesting'WHEN address = 'FMErKiXrU7sCyDepYYF3WScjnfdgn9iZhq2DxJy4Wpxa' then 'Vault by Protocol Treasury 1'WHEN address = '22CKUm6eLqMGRsbJjDSGWaYqyg9bNbTdWJkJCZ7zMVvv' then 'Vault by Protocol Treasury 2'ELSE 'Others'END AS Entity, sum(token_balance_change) AS fr_token_holdings, sum(token_balance_change)*(SELECT dex_prices FROM fr_price) AS fr_valueFROM(SELECTtx_id, block_time, token_balance_change, solana.account_activity.token_mint_address, token_balance_owner, addressFROMsolana.account_activityWHEREtx_successAND token_mint_address = '4aU642ras3Dnaddk44hjUTNUSM7hpgeMdeUj2sexiZkK'AND block_time > TIMESTAMP '2024-10-01'ORDER BYblock_time DESC)group by 1)SELECT efh.*from entity_fr_holdings as efhLEFT JOIN(values('Treasury Reserved Locked', 1),('Distributor', 2),('FR Liquidity Pool', 3),('Protocol Treasury', 4),('Marketing', 5),('Team Vesting', 6),('Vault by Protocol Treasury 1', 7),('Vault by Protocol Treasury 2', 8),('Others', 9)) as order_table (Entity, order_num)on efh.Entity = order_table.Entityorder by order_table.order_num ASC