Skip to content

Commit

Permalink
Added logic to pull tkn_remove from nft in remove_liquidity if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
poliwop committed Sep 10, 2024
1 parent af32d65 commit fb69dbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hydradx/model/amm/omnipool_amm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,10 @@ def remove_liquidity(self, agent: Agent, quantity: float = None, tkn_remove: str
# k = (self.unique_id + "_" + str(i), tkn_remove)

k = (self.unique_id, tkn_remove)
if nft_id is not None:
if nft_id not in agent.nfts:
return self.fail_transaction('Agent does not have liquidity position with specified nft_id.', agent)
tkn_remove = agent.nfts[nft_id].tkn

if tkn_remove not in self.asset_list:
for sub_pool in self.sub_pools.values():
Expand All @@ -1161,7 +1165,7 @@ def remove_liquidity(self, agent: Agent, quantity: float = None, tkn_remove: str
else:
return self

raise AssertionError(f"invalid value for i: {tkn_remove}")
raise AssertionError(f"invalid value for tkn_remove: {tkn_remove}")

if quantity == 0:
return self
Expand Down

0 comments on commit fb69dbd

Please sign in to comment.