Expand description
Shared machinery for algorithms that divide an order across several paths.
Structs§
- HopDescriptor
- One leg of a path: the pool, and the direction it trades.
- Market
Overrides - Component state overrides for passing degraded states to
find_single_route. - Path
Allocation - A fully-simulated path allocation.
- SimResult
- Output of simulating one path at a given input amount.
- Simulated
Hop - A
HopDescriptorpaired with its simulation result. Used inPathAllocation::hopswhere the solving algorithm has already computed per-hop outputs and gas.
Enums§
- Split
Math Error - Errors from split-routing math utilities.
Functions§
- build_
post_ swap_ overrides - Builds post-swap component states after all paths in a split-route solution have been executed.
- build_
split_ route - Assembles a
Routefrom split-route path allocations with shared-hop deduplication. - compute_
marginal_ price_ product - Product of spot prices along a path — approximates the exchange rate at near-zero input.
- evaluate_
total_ output - Simulates all paths at their current fractions and returns
(total_amount_out, total_gas).paths[i]corresponds tofractions[i]. - fractions_
to_ amounts - Convert fractions (summing to 1.0) into
BigUintamounts summing exactly tototal. - golden_
section_ search - Find the
xin[lo, hi]that maximisesf(x)using golden-section search. - normalize_
fractions - Normalize a slice of fractions so they sum to 1.0.
- simulate_
path - Simulates a path hop-by-hop, threading output of each hop as input to the next.
- split_
amount - Split
totalinto(part, remainder)wherepart ≈ total * fraction.