This commit is contained in:
2026-04-24 12:01:35 +02:00
parent 54778373b8
commit 0ad6145091
23 changed files with 1653 additions and 5 deletions

View File

@@ -0,0 +1,38 @@
// file: kb_lib/src/db/entities/swap.rs
//! Swap entity.
/// Persisted normalized swap row.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
pub struct KbSwapEntity {
/// Numeric primary key.
pub id: i64,
/// Related DEX id.
pub dex_id: i64,
/// Related pool id.
pub pool_id: i64,
/// Optional related pair id.
pub pair_id: std::option::Option<i64>,
/// Transaction signature.
pub signature: std::string::String,
/// Instruction index inside the transaction.
pub instruction_index: i64,
/// Optional slot number.
pub slot: std::option::Option<i64>,
/// Optional trader wallet.
pub trader_wallet: std::option::Option<std::string::String>,
/// Base token id.
pub base_token_id: i64,
/// Quote token id.
pub quote_token_id: i64,
/// Base amount as decimal text.
pub base_amount: std::string::String,
/// Quote amount as decimal text.
pub quote_amount: std::string::String,
/// Optional price in quote units as decimal text.
pub price_quote: std::option::Option<std::string::String>,
/// Trade side stored as stable integer.
pub trade_side: i16,
/// Execution timestamp encoded as RFC3339 UTC text.
pub executed_at: std::string::String,
}