diff --git a/docs/cql/account_exclusive_trading.cql b/docs/cql/account_exclusive_trading.cql new file mode 100644 index 0000000..fe5b386 --- /dev/null +++ b/docs/cql/account_exclusive_trading.cql @@ -0,0 +1,13 @@ +MATCH (a)-[r:Swap]-(b) +WITH a, b, count(r) AS ab_count +WHERE ab_count >= 5 +MATCH (a)-[r_all:Swap]-() +WITH a, b, ab_count, count(r_all) AS total_a_count +RETURN + a, + b, + ab_count, + total_a_count, + (toFloat(ab_count) / total_a_count) * 100 AS exclusivity_percentage +ORDER BY ab_count DESC, exclusivity_percentage DESC +LIMIT 100 diff --git a/docs/cql/cycling_coins_between_pairs.cql b/docs/cql/cycling_coins_between_pairs.cql new file mode 100644 index 0000000..4d44d5a --- /dev/null +++ b/docs/cql/cycling_coins_between_pairs.cql @@ -0,0 +1,2 @@ +MATCH p=SHORTEST 1 (a:SwapAccount)-[r:Swap]->(b:SwapAccount)-[r2:Swap]->(a:SwapAccount) +RETURN p diff --git a/docs/cql/find_pump_stats.cql b/docs/cql/find_pump_stats.cql new file mode 100644 index 0000000..d1938e2 --- /dev/null +++ b/docs/cql/find_pump_stats.cql @@ -0,0 +1,14 @@ +MATCH (a)-[r:Swap]-() + +WITH a, + count(r) AS total_trades, + sum(CASE WHEN r.shill_bid = true THEN 1 ELSE 0 END) AS shill_bid_count, + sum(CASE WHEN r.price_vs_rms_hour > 1.0 THEN 1 ELSE 0 END) AS pump_count +WHERE total_trades > 100 +RETURN + a, + total_trades, + shill_bid_count, + (toFloat(shill_bid_count) / total_trades) AS shill_bid_percentage, + (toFloat(pump_count) / total_trades) AS pump_percentage +ORDER BY shill_bid_percentage DESC diff --git a/docs/cql/find_shill_in_range.cql b/docs/cql/find_shill_in_range.cql new file mode 100644 index 0000000..67e3a2b --- /dev/null +++ b/docs/cql/find_shill_in_range.cql @@ -0,0 +1,4 @@ +MATCH p=()-[r:Swap {`shill_bid`: TRUE }]->() +WHERE date(r.filled_at) > date("2024-02-10") +AND date(r.filled_at) < date("2024-03-02") +RETURN p diff --git a/docs/cql/find_top_exchange_depositors.cql b/docs/cql/find_top_exchange_depositors.cql new file mode 100644 index 0000000..2eb9654 --- /dev/null +++ b/docs/cql/find_top_exchange_depositors.cql @@ -0,0 +1,19 @@ +WITH "0xf57d3968d0bfd5b3120fda88f34310c70bd72033f77422f4407fbbef7c24557a" AS olswap_deposit + +// Step 1: Get the list of all depositors +MATCH (depositor:Account)-[tx:Tx]->(onboard:Account {address: olswap_deposit}) +WITH COLLECT(DISTINCT depositor) AS all_depositors, olswap_deposit, tx + +// Step 2: Match depositors and amounts within the date range + +UNWIND all_depositors AS depositor + +OPTIONAL MATCH (depositor)-[tx2:Tx]->(onboard:Account {address: olswap_deposit}) +WHERE tx2.block_datetime >= datetime('2024-01-07') AND tx2.block_datetime <= datetime('2024-01-09') + + +RETURN + depositor.address AS depositor_address, + COALESCE(SUM(tx2.V7_OlAccountTransfer_amount), 0) AS deposit_amount, + count(tx2) +ORDER BY deposit_amount DESC diff --git a/docs/cql/frequent_exchange_traders.cql b/docs/cql/frequent_exchange_traders.cql new file mode 100644 index 0000000..778cd2f --- /dev/null +++ b/docs/cql/frequent_exchange_traders.cql @@ -0,0 +1,6 @@ +MATCH (from:SwapAccount)-[r:Swap]-(to:SwapAccount) +WITH from, to, COUNT(r) AS transaction_count +ORDER BY transaction_count DESC +LIMIT 500 +MATCH p=(from)-[r:Swap]-(to) +RETURN p, transaction_count diff --git a/docs/cql/shill_trader_pairs.cql b/docs/cql/shill_trader_pairs.cql new file mode 100644 index 0000000..d1fe5fe --- /dev/null +++ b/docs/cql/shill_trader_pairs.cql @@ -0,0 +1,15 @@ +MATCH (a)-[r:Swap]-(b) +WITH a, b, + count(r) AS total_count, + sum(CASE WHEN r.shill_bid = true THEN 1 ELSE 0 END) AS shill_bid_count, + sum(CASE WHEN r.price_vs_rms_hour > 1 THEN 1 ELSE 0 END) AS price_vs_rms24h_count +WHERE total_count >= 5 +ORDER BY total_count DESC +RETURN + a, + b, + total_count, + shill_bid_count, + (toFloat(shill_bid_count) / total_count) * 100 AS shill_bid_percentage, + price_vs_rms24h_count, + (toFloat(price_vs_rms24h_count) / total_count) * 100 AS price_vs_rms24h_percentage diff --git a/docs/cql/top_exchange_funding_required.cql b/docs/cql/top_exchange_funding_required.cql new file mode 100644 index 0000000..e115b46 --- /dev/null +++ b/docs/cql/top_exchange_funding_required.cql @@ -0,0 +1,6 @@ +MATCH p=(e:SwapAccount)-[d:DailyLedger]-(ul:UserLedger) +WHERE d.date < datetime("2024-01-16") +WITH e.swap_id AS id, max(ul.`total_funded`) as funded + +RETURN id, funded +ORDER BY funded DESCENDING diff --git a/docs/cql/trace_owner.cql b/docs/cql/trace_owner.cql new file mode 100644 index 0000000..bf43486 --- /dev/null +++ b/docs/cql/trace_owner.cql @@ -0,0 +1,19 @@ +WITH [ +// olswap onboarding +'0xf57d3968d0bfd5b3120fda88f34310c70bd72033f77422f4407fbbef7c24557a', +// ignore superspreader +'0x85b68bdeb3bd8ca47f1cf90dfb332404290afda582c586cb645b3b045b54825b' +] AS exclude + +MATCH p = SHORTEST 1 (o:Owner {alias: 'name'})-[r *..3]->(:SwapAccount) +WHERE NONE( + r IN relationships(p) + WHERE r.relation IS NOT NULL + AND NOT r.relation IN ["Vouch"] + ) + AND NONE( + n IN nodes(p) + WHERE n.address IS NOT NULL + AND n.address IN exclude + ) +RETURN p