tycho_common/simulation/
indicatively_priced.rs

1use std::collections::HashMap;
2
3use async_trait::async_trait;
4use num_bigint::BigUint;
5
6use crate::{
7    models::protocol::GetAmountOutParams,
8    simulation::{errors::SimulationError, protocol_sim::ProtocolSim},
9    Bytes,
10};
11
12pub struct SignedQuote {
13    pub base_token: Bytes,
14    pub quote_token: Bytes,
15    pub amount_in: BigUint,
16    pub amount_out: BigUint,
17    // each RFQ will need different attributes
18    pub quote_attributes: HashMap<String, Bytes>,
19}
20
21#[async_trait]
22pub trait IndicativelyPriced: ProtocolSim {
23    // this will be true when the price is only an estimation/indicative price
24    fn is_indicatively_priced() -> bool {
25        false
26    }
27
28    // if it is indicatively priced, then we need to request a signed quote for the final price
29    async fn request_signed_quote(
30        &self,
31        _params: GetAmountOutParams,
32    ) -> Result<SignedQuote, SimulationError> {
33        Err(SimulationError::FatalError("request_signed_quote not implemented".into()))
34    }
35}