tycho_simulation/rfq/protocols/
utils.rs1use std::{collections::HashSet, str::FromStr};
2
3use tycho_common::{models::Chain, Bytes};
4
5use crate::rfq::errors::RFQError;
6
7fn str_to_bytes(address: &str) -> Result<Bytes, RFQError> {
8 Bytes::from_str(address).map_err(|_| {
9 RFQError::FatalError(format!("Failed to parse default quote token: {address}"))
10 })
11}
12
13pub fn default_quote_tokens_for_chain(chain: &Chain) -> Result<HashSet<Bytes>, RFQError> {
15 match chain {
16 Chain::Ethereum => Ok(HashSet::from([
17 str_to_bytes("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")?, str_to_bytes("0xdac17f958d2ee523a2206206994597c13d831ec7")?, str_to_bytes("0x6b175474e89094c44da98b954eedeac495271d0f")?, ])),
21 Chain::Base => Ok(HashSet::from([
22 str_to_bytes("0x833589fcd6edb6e08f4c7c32d4f71b54bda02913")?, str_to_bytes("0xfde4c96c8593536e31f229ea8f37b2ada2699bb2")?, ])),
25 _ => Ok(HashSet::new()),
26 }
27}