Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed May 23, 2024
1 parent 7638132 commit f97c292
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions fastlane_bot/helpers/poolandtokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import math
from _decimal import Decimal
from dataclasses import dataclass
from typing import Dict, Any, List, Union
from typing import Dict, Any, List, Union, Tuple

from fastlane_bot.config import Config

Expand Down Expand Up @@ -397,7 +397,7 @@ def _other_to_cpc(self) -> List[Any]:
class DoubleInvalidCurveError(ValueError):
pass

def _carbon_to_cpc_and_type(self) -> ConstantProductCurve:
def _carbon_to_cpc_dict(self) -> Tuple[Dict, bool]:
"""
constructor: from a single Carbon order (see class docstring for other parameters)*
Expand Down Expand Up @@ -499,11 +499,11 @@ def _carbon_to_cpc_and_type(self) -> ConstantProductCurve:
if typed_args["yint"] < yint0:
typed_args["yint"] = yint0

return {'strategy_typed_args': strategy_typed_args, 'prices_overlap': prices_overlap}
return {"strategy_typed_args": strategy_typed_args, "prices_overlap": prices_overlap}

def _carbon_to_cpc(self) -> ConstantProductCurve:
cpc_list = []
for typed_args in self._carbon_to_cpc_and_type()['strategy_typed_args']:
for typed_args in self._carbon_to_cpc_dict()["strategy_typed_args"]:
try:
cpc_list.append(ConstantProductCurve.from_carbon(**self._convert_to_float(typed_args)))
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion fastlane_bot/tests/test_059_PoolAndTokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_test_poolandtokens_carbon():
tkn0_decimals=strategy["tkn0_decimals"],
tkn1_decimals=strategy["tkn1_decimals"],
)
prices_overlap = pool_and_tokens._carbon_to_cpc_and_type()["prices_overlap"]
prices_overlap = pool_and_tokens._carbon_to_cpc_dict()["prices_overlap"]
expected = "overlapping" if strategy["overlap"] else "disjoint"
actual = "overlapping" if prices_overlap else "disjoint"
assert actual == expected, f"expected {expected} strategy, got {actual} strategy: {dumps(strategy,indent=4)}"

0 comments on commit f97c292

Please sign in to comment.