Query editor
-- Finds SFM v1 liquidity adds:-- * only when added by the contract owner (3 owner addresses over time)-- * to PancakeSwap v1 or v2, Safeswap v1, and BiswapSELECT-- lp_tt.contract_address AS pair,-- sfmv1_tt."from" AS sfm_from,-- sfmv1_tt.to AS sfm_to,ROUND(CAST(sfmv1_tt.value AS double) / 1e9) AS sfm_amount,sfmv1_tt.value AS sfm_amount_raw,-- sfmv1_price.price AS sfm_price,-- (CAST(sfmv1_tt.value AS double) / 1e9 * sfmv1_price.price) AS sfm_usd_total,-- wbnb_tt.src AS bnb_from,-- wbnb_tt.dst AS bnb_to,ROUND(CAST(wbnb_tt.wad AS double) / 1e18) AS bnb_amount,wbnb_tt.wad AS bnb_amount_raw,bnb_price.price AS bnb_price,(CAST(wbnb_tt.wad AS double) / 1e18 * bnb_price.price) AS bnb_usd_total,lp_tt.evt_block_time AS time,-- lp_tt.evt_tx_hash AS tx,CONCAT('https://bscscan.com/tx/', CAST(lp_tt.evt_tx_hash AS varchar)) AS linkFROM erc20_bnb.evt_Transfer lp_ttINNER JOIN safemoon_v1_bnb.SafeMoon_evt_Transfer sfmv1_ttON sfmv1_tt.evt_tx_hash = lp_tt.evt_tx_hashINNER JOIN bnb_bnb.WBNB_evt_Transfer wbnb_ttON wbnb_tt.evt_tx_hash = lp_tt.evt_tx_hashINNER JOIN prices.usd bnb_priceON date_trunc('minute', lp_tt.evt_block_time) = bnb_price.minuteAND bnb_price.symbol = 'WBNB'-- Dune's "prices" table only tracks the SFM price from 2021-05-25 onwards, so it doesn't help us with getting the SFM value from early LP removals.-- However, we can infer the value of SFM was the same as the value of the BNB due to how liquidity is always a 50/50 split.-- Therefore we don't need to query the prices table for the SFM price.-- LEFT JOIN prices.usd sfmv1_price-- ON date_trunc('minute', lp_tt.evt_block_time) = sfmv1_price.minute-- AND sfmv1_price.contract_address = from_hex('0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3') -- SFM v1 tokenWHERE lp_tt.contract_address IN (from_hex('0x9adc6fb78cefa07e13e9294f150c1e8c1dd566c0'), -- SFMv1/WBNB PCSv1from_hex('0xff3dd404afba451328de089424c74685bf0a43c9'), -- SFMv1/WBNB PCSv2from_hex('0x9eca52d3b9ec0cc2f2d62c0dba155952ae6d57d2'), -- SFMv1/WBNB Safeswap1from_hex('0x3668ca2009af4c0a4a9e258ef69ead1fabbfb7da') -- SFMv1/WBNB Biswap)AND lp_tt."from" = from_hex('0x0000000000000000000000000000000000000000') -- Minting LP tokens = adding liquidityAND sfmv1_tt."from" IN (from_hex('0xc95063d946242f26074a76c8a2e94c9d735dfc78'), -- SFM v1 deployerfrom_hex('0x79c4af7c43f500b9ccba9396d079cc03dfcafda1'), -- SFM v1 old owner (Thomas)from_hex('0xcd198be08a33cbe2172f3be45cdb431e060076bc') -- SFM v1 owner (post-Thomas))AND sfmv1_tt."to" IN (from_hex('0x9adc6fb78cefa07e13e9294f150c1e8c1dd566c0'), -- SFMv1/WBNB PCSv1from_hex('0xff3dd404afba451328de089424c74685bf0a43c9'), -- SFMv1/WBNB PCSv2from_hex('0x9eca52d3b9ec0cc2f2d62c0dba155952ae6d57d2'), -- SFMv1/WBNB Safeswap1from_hex('0x3668ca2009af4c0a4a9e258ef69ead1fabbfb7da') -- SFMv1/WBNB Biswap)ORDER BY lp_tt.evt_block_time ASC, sfmv1_tt.evt_index DESC, wbnb_tt.evt_index DESC