This commit is contained in:
2026-05-13 20:11:29 +02:00
parent 693a456e62
commit cfa1ff2289
36 changed files with 2035 additions and 103 deletions

View File

@@ -31,6 +31,10 @@ pub struct TokenBackfillResult {
pub wallet_participation_count: usize,
/// Total number of trade-aggregation results produced during this run.
pub trade_event_count: usize,
/// Total number of liquidity event materialization results produced during this run.
pub liquidity_event_count: usize,
/// Total number of pool lifecycle event materialization results produced during this run.
pub pool_lifecycle_event_count: usize,
/// Total number of pair-candle aggregation results produced during this run.
pub pair_candle_count: usize,
}
@@ -60,6 +64,10 @@ pub struct PoolBackfillResult {
pub wallet_participation_count: usize,
/// Total number of trade-aggregation results produced during this run.
pub trade_event_count: usize,
/// Total number of liquidity event materialization results produced during this run.
pub liquidity_event_count: usize,
/// Total number of pool lifecycle event materialization results produced during this run.
pub pool_lifecycle_event_count: usize,
/// Total number of pair-candle aggregation results produced during this run.
pub pair_candle_count: usize,
}
@@ -80,6 +88,7 @@ pub struct TokenBackfillService {
launch_origin_service: crate::LaunchOriginService,
pool_origin_service: crate::PoolOriginService,
wallet_observation_service: crate::WalletObservationService,
non_trade_materialization_service: crate::NonTradeEventMaterializationService,
trade_aggregation_service: crate::TradeAggregationService,
pair_candle_aggregation_service: crate::PairCandleAggregationService,
transaction_classification_service: crate::TransactionClassificationService,
@@ -100,6 +109,8 @@ impl TokenBackfillService {
let launch_origin_service = crate::LaunchOriginService::new(database.clone());
let pool_origin_service = crate::PoolOriginService::new(database.clone());
let wallet_observation_service = crate::WalletObservationService::new(database.clone());
let non_trade_materialization_service =
crate::NonTradeEventMaterializationService::new(database.clone());
let trade_aggregation_service = crate::TradeAggregationService::new(database.clone());
let pair_candle_aggregation_service =
crate::PairCandleAggregationService::new(database.clone());
@@ -121,6 +132,7 @@ impl TokenBackfillService {
launch_origin_service,
pool_origin_service,
wallet_observation_service,
non_trade_materialization_service,
trade_aggregation_service,
pair_candle_aggregation_service,
transaction_classification_service,
@@ -149,6 +161,8 @@ impl TokenBackfillService {
pool_origin_count: 0,
wallet_participation_count: 0,
trade_event_count: 0,
liquidity_event_count: 0,
pool_lifecycle_event_count: 0,
pair_candle_count: 0,
};
let mut seen_signatures = std::collections::HashSet::<std::string::String>::new();
@@ -221,6 +235,8 @@ impl TokenBackfillService {
"poolOriginCount": result.pool_origin_count,
"walletParticipationCount": result.wallet_participation_count,
"tradeEventCount": result.trade_event_count,
"liquidityEventCount": result.liquidity_event_count,
"poolLifecycleEventCount": result.pool_lifecycle_event_count,
"pairCandleCount": result.pair_candle_count
});
let observation_result = self
@@ -359,6 +375,8 @@ impl TokenBackfillService {
pool_origin_count: 0,
wallet_participation_count: 0,
trade_event_count: 0,
liquidity_event_count: 0,
pool_lifecycle_event_count: 0,
pair_candle_count: 0,
});
}
@@ -424,6 +442,14 @@ impl TokenBackfillService {
Ok(wallet_observations) => wallet_observations,
Err(error) => return Err(error),
};
let non_trade_materialization_result = self
.non_trade_materialization_service
.record_transaction_by_signature(signature.as_str())
.await;
let non_trade_materialization = match non_trade_materialization_result {
Ok(non_trade_materialization) => non_trade_materialization,
Err(error) => return Err(error),
};
let trade_aggregations_result = self
.trade_aggregation_service
.record_transaction_by_signature(signature.as_str())
@@ -456,6 +482,8 @@ impl TokenBackfillService {
pool_origin_count: pool_origins.len(),
wallet_participation_count: wallet_observations.len(),
trade_event_count: trade_aggregations.len(),
liquidity_event_count: non_trade_materialization.liquidity_event_count,
pool_lifecycle_event_count: non_trade_materialization.pool_lifecycle_event_count,
pair_candle_count: pair_candle_aggregations.len(),
});
}
@@ -479,6 +507,8 @@ impl TokenBackfillService {
pool_origin_count: 0,
wallet_participation_count: 0,
trade_event_count: 0,
liquidity_event_count: 0,
pool_lifecycle_event_count: 0,
pair_candle_count: 0,
};
let mut seen_addresses = std::collections::BTreeSet::<std::string::String>::new();
@@ -562,6 +592,8 @@ impl TokenBackfillService {
result.pool_origin_count += replay_result.pool_origin_count;
result.wallet_participation_count += replay_result.wallet_participation_count;
result.trade_event_count += replay_result.trade_event_count;
result.liquidity_event_count += replay_result.liquidity_event_count;
result.pool_lifecycle_event_count += replay_result.pool_lifecycle_event_count;
result.pair_candle_count += replay_result.pair_candle_count;
}
}
@@ -578,6 +610,8 @@ impl TokenBackfillService {
"poolOriginCount": result.pool_origin_count,
"walletParticipationCount": result.wallet_participation_count,
"tradeEventCount": result.trade_event_count,
"liquidityEventCount": result.liquidity_event_count,
"poolLifecycleEventCount": result.pool_lifecycle_event_count,
"pairCandleCount": result.pair_candle_count,
"scannedAddressCount": addresses_to_scan.len(),
"effectiveSignatureLimit": effective_limit
@@ -651,6 +685,8 @@ struct TokenBackfillSignatureResult {
pool_origin_count: usize,
wallet_participation_count: usize,
trade_event_count: usize,
liquidity_event_count: usize,
pool_lifecycle_event_count: usize,
pair_candle_count: usize,
}
@@ -666,6 +702,8 @@ fn merge_token_backfill_signature_result(
aggregate.pool_origin_count += value.pool_origin_count;
aggregate.wallet_participation_count += value.wallet_participation_count;
aggregate.trade_event_count += value.trade_event_count;
aggregate.liquidity_event_count += value.liquidity_event_count;
aggregate.pool_lifecycle_event_count += value.pool_lifecycle_event_count;
aggregate.pair_candle_count += value.pair_candle_count;
}