Skip to content

Commit

Permalink
Added forward class declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Chursinau committed Mar 27, 2024
1 parent aa9195e commit c3b2c25
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mantis/simulation/routers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ class Input(
# please fail if bool is False for now
max: bool = Field(example=True)

class Exchange(BaseModel, Generic[TId, TAmount]): pass
class Spawn(BaseModel, Generic[TId, TAmount]): pass

class Trade(Generic[TId, TAmount]):
out_asset_amount: TAmount
Expand All @@ -342,6 +344,9 @@ class Trade(Generic[TId, TAmount]):

in_asset_id: TId

# next: list[Union['Exchange', 'Spawn']]
# next: list[Union['Exchange[TId, TAmount]', 'Spawn[TId, TAmount]']]


# @dataclass
class Spawn(BaseModel, Trade[TId, TAmount], Generic[TId, TAmount]):
Expand All @@ -356,12 +361,16 @@ class Spawn(BaseModel, Trade[TId, TAmount], Generic[TId, TAmount]):
amount to take with transfer
(delta)
"""
# next: list[Union['Exchange[TId, TAmount]', 'Spawn[TId, TAmount]']]
# next: list[Union['Exchange', 'Spawn']]
next: list[Union[Exchange, Spawn]]


# @dataclass
class Exchange(BaseModel, Trade[TId, TAmount], Generic[TId, TAmount]):
pool_id: TId
# next: list[Union['Exchange[TId, TAmount]', 'Spawn[TId, TAmount]']]
# next: list[Union['Exchange', 'Spawn']]
next: list[Union[Exchange, Spawn]]

@model_validator(mode="after")
Expand All @@ -377,7 +386,10 @@ class SingleInputAssetCvmRoute(BaseModel, Trade[TId, TAmount], Generic[TId, TAmo
always starts with Input asset_id
"""

# next: list[Union['Exchange', 'Spawn']]

next: list[Union[Exchange, Spawn]]
# next: list[Union['Exchange[TId, TAmount]', 'Spawn[TId, TAmount]']]

# @model_validator(mode="after")
# def model_validator_after(self):
Expand Down

0 comments on commit c3b2c25

Please sign in to comment.