use std::borrow::Cow;
use prost::Message;
use serde::{Deserialize, Serialize};
use tracing::debug;
use tycho_common::{
models::{protocol::GetAmountOutParams, Chain},
Bytes,
};
use crate::{
book::{
levels::{InvalidLevel, Levels, PriceLevel},
wire::EntryReader,
},
rfq::errors::RFQError,
snapshot_feed::errors::FeedError,
};
#[derive(Clone, PartialEq, Message)]
pub struct BebopPricingUpdate {
#[prost(message, repeated, tag = "1")]
pub pairs: Vec<BebopPriceData>,
}
#[derive(Clone, PartialEq, Message)]
pub struct BebopPriceData {
#[prost(bytes, tag = "1")]
pub base: Vec<u8>,
#[prost(bytes, tag = "2")]
pub quote: Vec<u8>,
#[prost(uint64, tag = "3")]
pub last_update_ts: u64,
#[prost(float, repeated, packed = "true", tag = "4")]
pub bids: Vec<f32>,
#[prost(float, repeated, packed = "true", tag = "5")]
pub asks: Vec<f32>,
}
impl BebopPriceData {
fn levels(flat: &[f32]) -> Result<Levels, InvalidLevel> {
Levels::new(
flat.as_chunks::<2>()
.0
.iter()
.map(|[price, quantity]| PriceLevel {
price: f64::from(*price),
quantity: f64::from(*quantity),
})
.collect(),
)
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BebopBook {
pub base: Bytes,
pub quote: Bytes,
pub last_update_ts: u64,
pub bids: Levels,
pub asks: Levels,
}
impl TryFrom<BebopPriceData> for BebopBook {
type Error = InvalidLevel;
fn try_from(price_data: BebopPriceData) -> Result<Self, InvalidLevel> {
Ok(BebopBook {
bids: BebopPriceData::levels(&price_data.bids)?,
asks: BebopPriceData::levels(&price_data.asks)?,
base: Bytes::from(price_data.base),
quote: Bytes::from(price_data.quote),
last_update_ts: price_data.last_update_ts,
})
}
}
impl BebopBook {
pub fn calculate_tvl(&self, quote_book: Option<&BebopBook>) -> f64 {
let mut total_tvl = (self.bids.notional() + self.asks.notional()) / 2.0;
if let Some(quote_book) = quote_book {
if let Some(price_of_quote_token) = quote_book.get_mid_price(total_tvl, &self.quote) {
total_tvl *= price_of_quote_token;
} else {
return 0.0;
}
}
total_tvl
}
pub fn get_mid_price(&self, amount: f64, sell_token: &Bytes) -> Option<f64> {
if sell_token != &self.base && sell_token != &self.quote {
return None;
}
let (bids, asks) = if sell_token == &self.quote {
(Cow::Owned(self.bids.invert()), Cow::Owned(self.asks.invert()))
} else {
(Cow::Borrowed(&self.bids), Cow::Borrowed(&self.asks))
};
let asks_price = asks.average_price(amount)?;
let bids_price = bids.average_price(amount)?;
Some((asks_price + bids_price) / 2.0)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BebopQuoteResponse {
Success(Box<BebopQuotePartial>),
Error(BebopApiError),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BebopApiError {
pub error: BebopErrorDetail,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BebopErrorDetail {
pub error_code: u32,
pub message: String,
pub request_id: String,
}
impl BebopErrorDetail {
const INSUFFICIENT_LIQUIDITY: u32 = 102;
const MIN_SIZE: u32 = 104;
pub fn declines_the_trade(&self) -> bool {
matches!(self.error_code, Self::INSUFFICIENT_LIQUIDITY | Self::MIN_SIZE)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BebopQuotePartial {
pub status: String,
pub settlement_address: Bytes,
pub tx: TxData,
pub to_sign: BebopOrderToSign,
pub partial_fill_offset: u64,
}
impl BebopQuotePartial {
pub fn validate(&self, params: &GetAmountOutParams) -> Result<(), RFQError> {
match &self.to_sign {
BebopOrderToSign::Single(single) => {
if single.taker_token != params.token_in {
return Err(RFQError::FatalError(format!(
"Base token mismatch: expected {}, got {}",
params.token_in, single.taker_token
)));
}
if single.maker_token != params.token_out {
return Err(RFQError::FatalError(format!(
"Quote token mismatch: expected {}, got {}",
params.token_out, single.maker_token
)));
}
self.validate_taker_and_receiver(&single.taker_address, &single.receiver, params)?;
let amount_in = params.amount_in.to_string();
if single.taker_amount != amount_in {
return Err(RFQError::FatalError(format!(
"Base token amount mismatch: expected {}, got {}",
amount_in, single.taker_amount
)));
}
}
BebopOrderToSign::Aggregate(aggregate) => {
self.validate_taker_and_receiver(
&aggregate.taker_address,
&aggregate.receiver,
params,
)?;
}
}
Ok(())
}
fn validate_taker_and_receiver(
&self,
taker_address: &Bytes,
receiver: &Bytes,
params: &GetAmountOutParams,
) -> Result<(), RFQError> {
if *taker_address == self.tx.to {
if receiver != taker_address {
return Err(RFQError::FatalError(format!(
"Receiver address mismatch for router-mode quote: expected {taker_address}, got {receiver}"
)));
}
} else {
if *taker_address != params.sender {
return Err(RFQError::FatalError(format!(
"Taker address mismatch: expected {}, got {taker_address}",
params.sender
)));
}
if *receiver != params.receiver {
return Err(RFQError::FatalError(format!(
"Receiver address mismatch: expected {}, got {receiver}",
params.receiver
)));
}
}
Ok(())
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BebopOrderToSign {
Single(Box<SingleOrderToSign>),
Aggregate(Box<AggregateOrderToSign>),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TxData {
pub to: Bytes,
pub data: Bytes,
pub value: String,
pub from: Bytes,
pub gas: u64,
pub gas_price: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SingleOrderToSign {
pub maker_address: Bytes,
pub taker_address: Bytes,
pub maker_token: Bytes,
pub taker_token: Bytes,
pub maker_amount: String,
pub taker_amount: String,
pub maker_nonce: String,
pub expiry: u64,
pub receiver: Bytes,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AggregateOrderToSign {
pub taker_address: Bytes,
pub maker_tokens: Vec<Vec<Bytes>>,
pub taker_tokens: Vec<Vec<Bytes>>,
pub maker_amounts: Vec<Vec<String>>,
pub taker_amounts: Vec<Vec<String>>,
pub expiry: u64,
pub receiver: Bytes,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BebopSupportedChain {
Ethereum,
Optimism,
Bsc,
Polygon,
HyperEvm,
Robinhood,
Base,
Arbitrum,
}
impl TryFrom<Chain> for BebopSupportedChain {
type Error = String;
fn try_from(chain: Chain) -> Result<Self, Self::Error> {
match chain {
Chain::Ethereum => Ok(BebopSupportedChain::Ethereum),
Chain::Bsc => Ok(BebopSupportedChain::Bsc),
Chain::Polygon => Ok(BebopSupportedChain::Polygon),
Chain::Robinhood => Ok(BebopSupportedChain::Robinhood),
Chain::Base => Ok(BebopSupportedChain::Base),
Chain::Arbitrum => Ok(BebopSupportedChain::Arbitrum),
other => match other.try_id() {
Ok(10) => Ok(BebopSupportedChain::Optimism),
Ok(999) => Ok(BebopSupportedChain::HyperEvm),
Ok(chain_id) => Err(format!("Bebop does not serve {chain} (chain id {chain_id})")),
Err(error) => Err(format!("Bebop: no chain id for {chain}: {error}")),
},
}
}
}
impl BebopSupportedChain {
pub fn as_str(self) -> &'static str {
match self {
BebopSupportedChain::Ethereum => "ethereum",
BebopSupportedChain::Optimism => "optimism",
BebopSupportedChain::Bsc => "bsc",
BebopSupportedChain::Polygon => "polygon",
BebopSupportedChain::HyperEvm => "hyperevm",
BebopSupportedChain::Robinhood => "robinhood",
BebopSupportedChain::Base => "base",
BebopSupportedChain::Arbitrum => "arbitrum",
}
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BebopPrices {
pub pairs: Vec<BebopBook>,
}
impl BebopPrices {
pub(super) fn from_update(update: BebopPricingUpdate) -> Result<Self, FeedError> {
let mut reader = EntryReader::new();
let pairs = reader.read(update.pairs, BebopBook::try_from);
reader
.finish()
.map_err(|reason| FeedError::Parsing(format!("Bebop pricing update: {reason}")))?;
debug!(pairs = pairs.len(), "decoded pricing update");
Ok(BebopPrices { pairs })
}
}
#[cfg(test)]
mod tests {
use std::collections::HashMap;
use super::*;
#[test]
fn calculate_tvl_no_normalization() {
let price_data = BebopPriceData {
base: hex::decode("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").unwrap(), quote: hex::decode("A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48").unwrap(), last_update_ts: 1234567890,
bids: vec![2000.0f32, 1.0f32, 1999.0f32, 2.0f32],
asks: vec![2001.0f32, 1.5f32, 2002.0f32, 1.0f32],
};
let tvl = BebopBook::try_from(price_data.clone())
.unwrap()
.calculate_tvl(None);
assert!((tvl - 5500.75).abs() < 0.01);
}
#[test]
fn calculate_tvl_with_normalization() {
let price_data_eth_tamara = BebopPriceData {
base: hex::decode("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").unwrap(), quote: hex::decode("1234567890123456789012345678901234567890").unwrap(), last_update_ts: 1234567890,
bids: vec![99.0f32, 1.0f32, 98.0f32, 2.0f32],
asks: vec![101.0f32, 1.0f32, 102.0f32, 2.0f32],
};
let price_data_tamara_usdc = BebopPriceData {
base: hex::decode("1234567890123456789012345678901234567890").unwrap(), quote: hex::decode("A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48").unwrap(), last_update_ts: 1234567890,
bids: vec![9.0f32, 300.0f32, 8.0f32, 300.0f32],
asks: vec![11.0f32, 300.0f32, 12.0f32, 300.0f32],
};
let tvl = BebopBook::try_from(price_data_eth_tamara)
.unwrap()
.calculate_tvl(Some(&BebopBook::try_from(price_data_tamara_usdc).unwrap()));
assert_eq!(tvl, 3000.0);
}
#[test]
fn calculate_tvl_with_inverted_normalization() {
let price_data_eth_tamara = BebopPriceData {
base: hex::decode("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").unwrap(), quote: hex::decode("1234567890123456789012345678901234567890").unwrap(), last_update_ts: 1234567890,
bids: vec![99.0f32, 1.0f32, 98.0f32, 2.0f32],
asks: vec![101.0f32, 1.0f32, 102.0f32, 2.0f32],
};
let price_data_usdc_tamara = BebopPriceData {
base: hex::decode("A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48").unwrap(), quote: hex::decode("1234567890123456789012345678901234567890").unwrap(), last_update_ts: 1234567890,
bids: vec![0.09f32, 3000.0f32, 0.08f32, 3000.0f32],
asks: vec![0.11f32, 3000.0f32, 0.12f32, 3000.0f32],
};
let tvl = BebopBook::try_from(price_data_eth_tamara)
.unwrap()
.calculate_tvl(Some(&BebopBook::try_from(price_data_usdc_tamara).unwrap()));
assert!((tvl - 3051.14).abs() < 1.0);
}
#[test]
fn mid_price_averages_the_levels_a_swap_would_fill() {
let weth_addr =
Bytes::from(hex::decode("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").unwrap()); let usdc_addr =
Bytes::from(hex::decode("A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48").unwrap());
let price_data = BebopPriceData {
base: weth_addr.to_vec(),
quote: usdc_addr.to_vec(),
last_update_ts: 1234567890,
bids: vec![2000.0f32, 2.0f32, 1999.0f32, 3.0f32],
asks: vec![2001.0f32, 3.0f32, 2002.0f32, 1.0f32],
};
let mid_price_large = BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(3.0, &weth_addr);
assert!((mid_price_large.unwrap() - 2000.3333333333335).abs() < 0.01);
let weth_price = BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(6000.0, &usdc_addr)
.unwrap();
assert!((weth_price - 0.0005).abs() < 0.0001);
let dai_addr =
Bytes::from(hex::decode("6B175474E89094C44Da98b954EedeAC495271d0F").unwrap());
assert_eq!(
BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(100.0, &dai_addr),
None
);
let price_data = BebopPriceData {
base: weth_addr.to_vec(),
quote: usdc_addr.to_vec(),
last_update_ts: 1234567890,
bids: vec![],
asks: vec![2001.0f32, 3.0f32, 2002.0f32, 1.0f32],
};
assert_eq!(
BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(3.0, &weth_addr),
None
);
let price_data = BebopPriceData {
base: weth_addr.to_vec(),
quote: usdc_addr.to_vec(),
last_update_ts: 1234567890,
bids: vec![2000.0f32, 2.0f32, 1999.0f32, 3.0f32],
asks: vec![],
};
assert_eq!(
BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(3.0, &weth_addr),
None
);
let price_data = BebopPriceData {
base: weth_addr.to_vec(),
quote: usdc_addr.to_vec(),
last_update_ts: 1234567890,
bids: vec![2000.0f32, 2.0f32, 1999.0f32, 3.0f32],
asks: vec![2001.0f32, 3.0f32, 2002.0f32, 1.0f32],
};
let insufficient_mid = BebopBook::try_from(price_data.clone())
.unwrap()
.get_mid_price(10.0, &weth_addr);
assert_eq!(insufficient_mid, Some(2000.325));
}
#[cfg(test)]
mod bebop_quote_partial_validate_tests {
use std::str::FromStr;
use num_bigint::BigUint;
use tycho_common::models::protocol::GetAmountOutParams;
use super::*;
fn hex_to_bytes(hex: &str) -> Bytes {
Bytes::from_str(hex).unwrap()
}
fn single_order() -> SingleOrderToSign {
SingleOrderToSign {
maker_address: hex_to_bytes("0x1111111111111111111111111111111111111111"),
taker_address: hex_to_bytes("0x2222222222222222222222222222222222222222"),
maker_token: hex_to_bytes("0x3333333333333333333333333333333333333333"),
taker_token: hex_to_bytes("0x4444444444444444444444444444444444444444"),
maker_amount: "2000".to_string(),
taker_amount: "1000".to_string(),
maker_nonce: "1".to_string(),
expiry: 123456,
receiver: hex_to_bytes("0x5555555555555555555555555555555555555555"),
}
}
fn aggregate_order() -> AggregateOrderToSign {
AggregateOrderToSign {
taker_address: hex_to_bytes("0x2222222222222222222222222222222222222222"),
maker_tokens: vec![vec![hex_to_bytes(
"0x3333333333333333333333333333333333333333",
)]],
taker_tokens: vec![vec![hex_to_bytes(
"0x4444444444444444444444444444444444444444",
)]],
maker_amounts: vec![vec!["2000".to_string()]],
taker_amounts: vec![vec!["1000".to_string()]],
expiry: 123456,
receiver: hex_to_bytes("0x5555555555555555555555555555555555555555"),
}
}
fn params() -> GetAmountOutParams {
GetAmountOutParams {
amount_in: BigUint::from(1000u32),
token_in: hex_to_bytes("0x4444444444444444444444444444444444444444"),
token_out: hex_to_bytes("0x3333333333333333333333333333333333333333"),
sender: hex_to_bytes("0x2222222222222222222222222222222222222222"),
receiver: hex_to_bytes("0x5555555555555555555555555555555555555555"),
origin: None,
}
}
fn quote_partial_single() -> BebopQuotePartial {
BebopQuotePartial {
status: "success".to_string(),
settlement_address: hex_to_bytes("0x9999999999999999999999999999999999999999"),
tx: TxData {
to: hex_to_bytes("0x8888888888888888888888888888888888888888"),
data: hex_to_bytes("0x1234"),
value: "0".to_string(),
from: hex_to_bytes("0x7777777777777777777777777777777777777777"),
gas: 21000,
gas_price: 100,
},
to_sign: BebopOrderToSign::Single(Box::new(single_order())),
partial_fill_offset: 0,
}
}
fn quote_partial_aggregate() -> BebopQuotePartial {
BebopQuotePartial {
status: "success".to_string(),
settlement_address: hex_to_bytes("0x9999999999999999999999999999999999999999"),
tx: TxData {
to: hex_to_bytes("0x8888888888888888888888888888888888888888"),
data: hex_to_bytes("0x1234"),
value: "0".to_string(),
from: hex_to_bytes("0x7777777777777777777777777777777777777777"),
gas: 21000,
gas_price: 100,
},
to_sign: BebopOrderToSign::Aggregate(Box::new(aggregate_order())),
partial_fill_offset: 0,
}
}
#[test]
fn validate_single_success() {
let quote = quote_partial_single();
let params = params();
assert!(quote.validate(¶ms).is_ok());
}
#[test]
fn validate_single_base_token_mismatch() {
let mut quote = quote_partial_single();
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.taker_token = hex_to_bytes("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Base token mismatch"));
}
#[test]
fn validate_single_quote_token_mismatch() {
let mut quote = quote_partial_single();
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.maker_token = hex_to_bytes("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Quote token mismatch"));
}
#[test]
fn validate_single_taker_address_mismatch() {
let mut quote = quote_partial_single();
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.taker_address = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Taker address mismatch"));
}
#[test]
fn validate_single_receiver_mismatch() {
let mut quote = quote_partial_single();
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.receiver = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Receiver address mismatch"));
}
#[test]
fn validate_single_base_token_amount_mismatch() {
let mut quote = quote_partial_single();
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.taker_amount = "9999".to_string();
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Base token amount mismatch"));
}
#[test]
fn validate_aggregate_success() {
let quote = quote_partial_aggregate();
let params = params();
assert!(quote.validate(¶ms).is_ok());
}
#[test]
fn validate_aggregate_taker_address_mismatch() {
let mut quote = quote_partial_aggregate();
if let BebopOrderToSign::Aggregate(ref mut agg) = quote.to_sign {
agg.taker_address = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Taker address mismatch"));
}
#[test]
fn validate_aggregate_receiver_mismatch() {
let mut quote = quote_partial_aggregate();
if let BebopOrderToSign::Aggregate(ref mut agg) = quote.to_sign {
agg.receiver = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Receiver address mismatch"));
}
const BEBOP_ROUTER: &str = "0xBeb0009ACa35087ce7cCF11637E24dd1Aad3bf2A";
fn make_router_mode(quote: &mut BebopQuotePartial) {
quote.tx.to = hex_to_bytes(BEBOP_ROUTER);
match quote.to_sign {
BebopOrderToSign::Single(ref mut single) => {
single.taker_address = hex_to_bytes(BEBOP_ROUTER);
single.receiver = hex_to_bytes(BEBOP_ROUTER);
}
BebopOrderToSign::Aggregate(ref mut agg) => {
agg.taker_address = hex_to_bytes(BEBOP_ROUTER);
agg.receiver = hex_to_bytes(BEBOP_ROUTER);
}
}
}
#[test]
fn validate_single_router_mode_success() {
let mut quote = quote_partial_single();
make_router_mode(&mut quote);
let params = params();
assert!(quote.validate(¶ms).is_ok());
}
#[test]
fn validate_aggregate_router_mode_success() {
let mut quote = quote_partial_aggregate();
make_router_mode(&mut quote);
let params = params();
assert!(quote.validate(¶ms).is_ok());
}
#[test]
fn validate_single_router_mode_receiver_mismatch() {
let mut quote = quote_partial_single();
make_router_mode(&mut quote);
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.receiver = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Receiver address mismatch for router-mode quote"));
}
#[test]
fn validate_single_taker_neither_sender_nor_tx_to() {
let mut quote = quote_partial_single();
make_router_mode(&mut quote);
if let BebopOrderToSign::Single(ref mut single) = quote.to_sign {
single.taker_address = hex_to_bytes("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");
}
let params = params();
let err = quote.validate(¶ms).unwrap_err();
assert!(format!("{err:?}").contains("Taker address mismatch"));
}
}
#[tokio::test]
#[ignore = "hits Bebop's public API"]
async fn live_bebop_api_prices_every_chain_the_enum_names() {
let mut served: HashMap<String, u64> = reqwest::get("https://api.bebop.xyz/pmm/chains")
.await
.unwrap()
.json()
.await
.unwrap();
for chain in [
Chain::Ethereum,
Chain::Bsc,
Chain::Polygon,
Chain::Robinhood,
Chain::Base,
Chain::Arbitrum,
] {
let bebop = BebopSupportedChain::try_from(chain).unwrap();
let served_id = served
.remove(bebop.as_str())
.unwrap_or_else(|| panic!("Bebop no longer prices {chain}"));
assert_eq!(served_id, chain.id());
}
let optimism = served
.remove(BebopSupportedChain::Optimism.as_str())
.expect("Bebop prices Optimism");
let hyperevm = served
.remove(BebopSupportedChain::HyperEvm.as_str())
.expect("Bebop prices HyperEVM");
assert_eq!(optimism, 10);
assert_eq!(hyperevm, 999);
assert!(served.is_empty(), "Bebop prices chains this enum does not name: {served:?}");
}
}