hypercall_db/traits/
rfq.rs1use anyhow::Result;
6use hypercall_types::WalletAddress;
7use rust_decimal::Decimal;
8use uuid::Uuid;
9
10use crate::QuoteProviderRecord;
11
12pub trait RfqReader: Send + Sync {
14 fn get_all_quote_providers_sync(&self) -> Result<Vec<QuoteProviderRecord>>;
16}
17
18pub trait RfqWriter: RfqReader {
20 fn upsert_quote_provider_sync(&self, qp: &QuoteProviderRecord) -> Result<()>;
22
23 fn update_quote_provider_status_sync(&self, wallet: &WalletAddress, status: &str)
25 -> Result<()>;
26
27 fn persist_rfq_record_sync(
29 &self,
30 rfq_id: &Uuid,
31 taker_wallet: &WalletAddress,
32 underlying: &str,
33 status: &str,
34 taker_signature: &str,
35 taker_nonce: u64,
36 legs_hash: &[u8; 32],
37 legs: &[(String, String, Decimal)],
38 expires_at_ms: u64,
39 ) -> Result<()>;
40
41 fn persist_rfq_quote_sync(
43 &self,
44 quote_id: &Uuid,
45 rfq_id: &Uuid,
46 qp_wallet: &WalletAddress,
47 net_premium: Decimal,
48 valid_for_ms: u64,
49 qp_signature: &str,
50 qp_nonce: u64,
51 legs: &[(String, String, Decimal, Decimal)],
52 expires_at_ms: u64,
53 ) -> Result<()>;
54
55 fn update_rfq_status_sync(&self, rfq_id: &Uuid, status: &str) -> Result<()>;
57}