diff --git a/mantis/blackbox/main.py b/mantis/blackbox/main.py index cbb32686..40e96535 100644 --- a/mantis/blackbox/main.py +++ b/mantis/blackbox/main.py @@ -63,6 +63,7 @@ def simulator_router(input: Input[str, str] = Depends()) -> list[SingleInputAsse """_summary_ Given input, find and return route. """ + raw_data = get_remote_data() cvm_data = ExtendedCvmRegistry.from_raw( raw_data.cvm_registry, @@ -70,12 +71,13 @@ def simulator_router(input: Input[str, str] = Depends()) -> list[SingleInputAsse raw_data.cosmos_chains.chains, raw_data.osmosis_pools, ) - + input : Input[str, int] = Input[str, int](**input.model_dump()) routes = solve(input, cvm_data) + routes: list[SingleInputAssetCvmRoute[str, str]] = [SingleInputAssetCvmRoute[str, str](**route.model_dump()) for route in routes] return routes -def solve(original_input: Input, cvm_data: ExtendedCvmRegistry) -> list[SingleInputAssetCvmRoute]: +def solve(original_input: Input, cvm_data: ExtendedCvmRegistry) -> list[SingleInputAssetCvmRoute[str, int]]: ctx = Ctx() ctx.max_depth_of_route = 6 original_data = for_simulation(cvm_data, {}) diff --git a/mantis/simulation/routers/data.py b/mantis/simulation/routers/data.py index 1987873a..b5747c14 100644 --- a/mantis/simulation/routers/data.py +++ b/mantis/simulation/routers/data.py @@ -162,27 +162,13 @@ class AssetTransfers( Fixed costs $q_i$ >= 0s """ - in_asset_amount: TAmount = Field( - # strict=True, - json_schema_extra={ - 'title': 'Password', - 'description': 'Password of the user', - 'examples': ['123456'], - } - ) + in_asset_amount: TAmount """ Tendered amount of token on chain were it is. Must be like escrowed amount. """ - out_asset_amount: TAmount = Field( - # strict=True, - json_schema_extra={ - 'title': 'Password', - 'description': 'Password of the user', - 'examples': ['123456'], - } - ) + out_asset_amount: TAmount """ Expected received amount LAMBDA. Must be like liquid amount of this token minted. @@ -344,6 +330,8 @@ class Input( class Trade(Generic[TId, TAmount]): + model_config = ConfigDict(coerce_numbers_to_str=True) + out_asset_amount: TAmount """ Amount to be used out of trade. @@ -367,7 +355,6 @@ class Spawn(BaseModel, Trade[TId, TAmount], Generic[TId, TAmount]): """ cross chain transfer assets """ - in_asset_id: TId | None = None in_asset_amount: TAmount | None = None @@ -395,6 +382,7 @@ class SingleInputAssetCvmRoute(BaseModel, Trade[TId, TAmount], Generic[TId, TAmo """ always starts with Input asset_id """ + model_config = ConfigDict(coerce_numbers_to_str=True) next: list[Union[Exchange[TId, TAmount], Spawn[TId, TAmount]]] diff --git a/mantis/simulation/routers/oracles/bforacle.py b/mantis/simulation/routers/oracles/bforacle.py index 5cc2ac33..72c81524 100644 --- a/mantis/simulation/routers/oracles/bforacle.py +++ b/mantis/simulation/routers/oracles/bforacle.py @@ -176,12 +176,11 @@ class BFSolution: deltas: list[float] routes: list[SingleInputAssetCvmRoute] - def route( input: Input, all_data: AllData, ctx: Ctx = Ctx(), -): +) -> list[SingleInputAssetCvmRoute[str, int]]: """ Bellman Ford inspired solution. The function divides the transaction if several paths (`splits``) and for each path