MCPcopy Create free account
hub / github.com/cowprotocol/services / start_protocol_external_solver

Method start_protocol_external_solver

crates/e2e/src/setup/services.rs:308–414  ·  view source on GitHub ↗

Starts a basic version of the protocol with a single external solver. Optionally starts a baseline solver and uses it for price estimation.

(
        &self,
        solver: TestAccount,
        solver_endpoint: Option<Url>,
        run_baseline: bool,
    )

Source from the content-addressed store, hash-verified

306 /// Starts a basic version of the protocol with a single external solver.
307 /// Optionally starts a baseline solver and uses it for price estimation.
308 pub async fn start_protocol_external_solver(
309 &self,
310 solver: TestAccount,
311 solver_endpoint: Option<Url>,
312 run_baseline: bool,
313 ) {
314 let external_solver_endpoint =
315 solver_endpoint.unwrap_or("http://localhost:8000/".parse().unwrap());
316
317 let mut solvers = vec![SolverEngine {
318 name: "test_solver".into(),
319 account: solver.clone(),
320 endpoint: external_solver_endpoint,
321 base_tokens: vec![],
322 merge_solutions: true,
323 haircut_bps: 0,
324 submission_keys: vec![],
325 }];
326
327 let shared_native_price_config = configs::native_price::NativePriceConfig {
328 cache: configs::native_price::CacheConfig {
329 max_age: Duration::from_secs(2),
330 ..Default::default()
331 },
332 ..Default::default()
333 };
334
335 // Create TOML config files
336 let autopilot_config = Configuration {
337 native_price_estimation: {
338 if run_baseline {
339 NativePriceConfig {
340 estimators: NativePriceEstimators::new(vec![vec![
341 NativePriceEstimator::driver(
342 "test_quoter".to_string(),
343 Url::from_str("http://localhost:11088/baseline_solver").unwrap(),
344 ),
345 NativePriceEstimator::driver(
346 "test_solver".to_string(),
347 Url::from_str("http://localhost:11088/test_solver").unwrap(),
348 ),
349 ]]),
350 shared: shared_native_price_config.clone(),
351 ..NativePriceConfig::test_default()
352 }
353 } else {
354 NativePriceConfig {
355 estimators: NativePriceEstimators::new(vec![vec![
356 NativePriceEstimator::driver(
357 "test_quoter".to_string(),
358 Url::from_str("http://localhost:11088/test_solver").unwrap(),
359 ),
360 ]]),
361 shared: shared_native_price_config,
362 ..NativePriceConfig::test_default()
363 }
364 }
365 },

Callers

nothing calls this directly

Calls 10

start_baseline_solverFunction · 0.85
start_driverFunction · 0.85
unwrapMethod · 0.80
start_autopilotMethod · 0.80
start_apiMethod · 0.80
newFunction · 0.50
testFunction · 0.50
cloneMethod · 0.45
addressMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected