Query editor
-- Finds SFM v1 liquidity removals:-- * only when removed by the contract owner (3 owner addresses over time)-- * from 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_ttLEFT JOIN safemoon_v1_bnb.SafeMoon_evt_Transfer sfmv1_ttON sfmv1_tt.evt_tx_hash = lp_tt.evt_tx_hashLEFT JOIN bnb_bnb.WBNB_evt_Transfer wbnb_ttON wbnb_tt.evt_tx_hash = lp_tt.evt_tx_hashLEFT 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 Safeswap1-- from_hex('0x3668ca2009af4c0a4a9e258ef69ead1fabbfb7da') -- SFMv1/WBNB Biswap-- from_hex('0xc223a5ceecd9088c92c76504755507d18913a944'), -- SFMv2/BUSD Safeswap1-- from_hex('0x87d7fd8c446cb5d3da3ca23f429e7b7504d1931c'), -- SFMv2/WBNB PCSv2-- from_hex('0x8fb9bbfd97fff7bba69c0162a9632c9503b29cd4'), -- SFMv2/WBNB Safeswap1-- from_hex('0x856a1c95bef293de7367b908df2b63ba30fbdd59'), -- SFMv2/WBNB Safeswap2-- from_hex('0x8e0301e3bde2397449fef72703e71284d0d149f1') -- SFMv2/WBNB Safeswap3)AND lp_tt.to = from_hex('0x0000000000000000000000000000000000000000') -- Burning LP tokens = removing liquidityAND sfmv1_tt.to IN (from_hex('0xc95063d946242f26074a76c8a2e94c9d735dfc78'), -- SFM v1 deployerfrom_hex('0x79c4af7c43f500b9ccba9396d079cc03dfcafda1'), -- SFM v1 old owner (Thomas)from_hex('0xcd198be08a33cbe2172f3be45cdb431e060076bc') -- SFM v1 owner (post-Thomas))ORDER BY lp_tt.evt_block_time ASC