chore(testing): Remove hard sell limit flag.
The setting is now inferred from the adapters capabilities.
This commit is contained in:
@@ -114,6 +114,8 @@ class Capability(IntEnum):
|
|||||||
ConstantPrice = auto()
|
ConstantPrice = auto()
|
||||||
TokenBalanceIndependent = auto()
|
TokenBalanceIndependent = auto()
|
||||||
ScaledPrice = auto()
|
ScaledPrice = auto()
|
||||||
|
HardLimits = auto()
|
||||||
|
MarginalPrice = auto()
|
||||||
|
|
||||||
|
|
||||||
class SynchronizerState(Enum):
|
class SynchronizerState(Enum):
|
||||||
|
|||||||
@@ -64,13 +64,6 @@ class ThirdPartyPool(BaseModel):
|
|||||||
|
|
||||||
trace: bool = False
|
trace: bool = False
|
||||||
|
|
||||||
hard_sell_limit: bool = False
|
|
||||||
"""
|
|
||||||
Whether the pool will revert if you attempt to sell more than the limit. Defaults to
|
|
||||||
False where it is assumed that exceeding the limit will provide a bad price but will
|
|
||||||
still succeed.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, **data):
|
def __init__(self, **data):
|
||||||
super().__init__(**data)
|
super().__init__(**data)
|
||||||
self._set_engine(data.get("engine", None))
|
self._set_engine(data.get("engine", None))
|
||||||
@@ -179,7 +172,7 @@ class ThirdPartyPool(BaseModel):
|
|||||||
) -> tuple[Decimal, int, TPoolState]:
|
) -> tuple[Decimal, int, TPoolState]:
|
||||||
# if the pool has a hard limit and the sell amount exceeds that, simulate and
|
# if the pool has a hard limit and the sell amount exceeds that, simulate and
|
||||||
# raise a partial trade
|
# raise a partial trade
|
||||||
if self.hard_sell_limit:
|
if Capability.HardLimits in self.capabilities:
|
||||||
sell_limit = self.get_sell_amount_limit(sell_token, buy_token)
|
sell_limit = self.get_sell_amount_limit(sell_token, buy_token)
|
||||||
if sell_amount > sell_limit:
|
if sell_amount > sell_limit:
|
||||||
partial_trade = self._get_amount_out(sell_token, sell_limit, buy_token)
|
partial_trade = self._get_amount_out(sell_token, sell_limit, buy_token)
|
||||||
@@ -297,7 +290,6 @@ class ThirdPartyPool(BaseModel):
|
|||||||
engine=self._engine,
|
engine=self._engine,
|
||||||
balances=self.balances,
|
balances=self.balances,
|
||||||
minimum_gas=self.minimum_gas,
|
minimum_gas=self.minimum_gas,
|
||||||
hard_sell_limit=self.hard_sell_limit,
|
|
||||||
balance_owner=self.balance_owner,
|
balance_owner=self.balance_owner,
|
||||||
stateless_contracts=self.stateless_contracts,
|
stateless_contracts=self.stateless_contracts,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user