orderstate reordering
This commit is contained in:
@@ -10,12 +10,13 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class SwapOrderState (Enum):
|
class SwapOrderState (Enum):
|
||||||
Unknown = 0
|
Unknown = -1
|
||||||
Open = 1
|
Signing = 0 # only used by the web but here for completeness
|
||||||
Canceled = 2
|
Underfunded = 1
|
||||||
Filled = 3
|
Open = 2
|
||||||
|
Canceled = 3
|
||||||
Expired = 4
|
Expired = 4
|
||||||
Underfunded = 5
|
Filled = 5
|
||||||
|
|
||||||
class Exchange (Enum):
|
class Exchange (Enum):
|
||||||
UniswapV2 = 0
|
UniswapV2 = 0
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class Order:
|
|||||||
|
|
||||||
def complete(self, final_state: SwapOrderState):
|
def complete(self, final_state: SwapOrderState):
|
||||||
""" updates the static order record with its final values, then deletes all its dynamic blockstate and removes the Order from the actives list """
|
""" updates the static order record with its final values, then deletes all its dynamic blockstate and removes the Order from the actives list """
|
||||||
assert final_state is not SwapOrderState.Open
|
assert final_state in (SwapOrderState.Canceled, SwapOrderState.Expired, SwapOrderState.Filled)
|
||||||
status = self.status.copy()
|
status = self.status.copy()
|
||||||
status.state = final_state
|
status.state = final_state
|
||||||
if self.is_open:
|
if self.is_open:
|
||||||
|
|||||||
Reference in New Issue
Block a user