Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lp extension #192

Merged
merged 28 commits into from
Sep 23, 2024
Merged

Lp extension #192

merged 28 commits into from
Sep 23, 2024

Conversation

poliwop
Copy link
Collaborator

@poliwop poliwop commented Sep 9, 2024

Adds the ability for LPs to have multiple LP positions in Omnipool in the same asset, by making LP positions NFTs. Backward compatible so that LP positions can still be represented by (pool_name, tkn_name) assets in agent holdings.

@poliwop poliwop marked this pull request as ready for review September 11, 2024 19:19
Copy link
Contributor

@jepidoptera jepidoptera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One higher-level critique: I don't know that it makes sense to have these two parallel systems for holding pool shares: nfts and the old system of ('omnipool', tkn). I think the nfts are a better and more flexible solution, and adding all this overhead to maintain backward compatibility seems worse in the long run than just refactoring things to use the new system. This works for now, but I propose simplifying in the next PR.

hydradx/model/amm/omnipool_amm.py Outdated Show resolved Hide resolved
delta_R = init_agent.holdings[tkn] / 2

single_add_state_1, single_add_agent_1 = oamm.simulate_add_liquidity(initial_state, init_agent, delta_R, tkn)
single_add_state_2, single_add_agent_2 = oamm.simulate_add_liquidity(initial_state, init_agent, delta_R, tkn,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since n=1 is already tested, this is probably redundant

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing adding as an NFT to adding to holdings? I don't think that's redundant?

@@ -29,6 +30,7 @@ def __init__(self,
self.trade_strategy = trade_strategy
self.asset_list = list(self.holdings.keys())
self.unique_id = unique_id
self.nfts = nfts or {}

def __repr__(self):
precision = 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to fix repr() so it can correctly display nfts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to address this in a future PR

hydradx/model/amm/trade_strategies.py Show resolved Hide resolved
hydradx/model/amm/omnipool_amm.py Outdated Show resolved Hide resolved
hydradx/model/amm/omnipool_amm.py Show resolved Hide resolved
@poliwop poliwop merged commit da94618 into main Sep 23, 2024
4 checks passed
@poliwop poliwop deleted the lp-extension branch September 23, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants