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

Allow Closed pools to be opened #695

Merged
merged 11 commits into from
Jul 18, 2022
Merged

Allow Closed pools to be opened #695

merged 11 commits into from
Jul 18, 2022

Conversation

maltekliemann
Copy link
Member

@maltekliemann maltekliemann commented Jul 4, 2022

This adds the pool status Initialized, with which all Cpmm pool start, and adds the functionality to open an initialized pool.

The purpose of this is to allow prediction-markets to open and close pools depending on market status. The motivation for allowing this is to let a market which is created before it opens to close the pool until the market opens to prevent trading. This will be implemented later. Note that currently, we still call open_pool when creating a cpmm pool by default.

@maltekliemann maltekliemann added the s:review-needed The pull request requires reviews label Jul 4, 2022
@maltekliemann maltekliemann self-assigned this Jul 4, 2022
@maltekliemann maltekliemann changed the title Add PoolStatus::Open Allow Closed pools to be opened Jul 4, 2022
@maltekliemann maltekliemann added s:in-progress The pull requests is currently being worked on and removed s:review-needed The pull request requires reviews labels Jul 6, 2022
@maltekliemann maltekliemann added s:review-needed The pull request requires reviews and removed s:in-progress The pull requests is currently being worked on labels Jul 7, 2022
@maltekliemann maltekliemann added this to the v0.3.4 milestone Jul 7, 2022
Copy link
Member

@Chralt98 Chralt98 left a comment

Choose a reason for hiding this comment

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

Thanks for adding the Initialized state, so that trading is only allowed after the prediction market pallet allows it. I mentioned some small things.

zrml/prediction-markets/src/lib.rs Show resolved Hide resolved
zrml/swaps/src/lib.rs Outdated Show resolved Hide resolved
zrml/swaps/src/lib.rs Show resolved Hide resolved
zrml/swaps/src/tests.rs Outdated Show resolved Hide resolved
zrml/swaps/src/tests.rs Show resolved Hide resolved
zrml/swaps/src/tests.rs Show resolved Hide resolved
maltekliemann and others added 3 commits July 13, 2022 13:17
Co-authored-by: Chralt <chralt98@gmail.com>
Co-authored-by: Chralt <chralt98@gmail.com>
Copy link
Member

@Chralt98 Chralt98 left a comment

Choose a reason for hiding this comment

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

Looks like a charm.

@vivekvpandya vivekvpandya self-requested a review July 15, 2022 03:46
Copy link
Member

@Chralt98 Chralt98 left a comment

Choose a reason for hiding this comment

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

Ok, as you pointed out in Discord: it needs the state of either Initialized or Active (so preventing Closed and Clean) to join the pool. I couldn't find anything to update. What happens after cleaning up the pool. What happens when I call pool_exit then?

zrml/swaps/src/lib.rs Show resolved Hide resolved
@maltekliemann maltekliemann added s:accepted This pull request is ready for merge and removed s:review-needed The pull request requires reviews labels Jul 18, 2022
@maltekliemann
Copy link
Member Author

exit_pool is always ok. The pool (usually) goes into Clean state when the market owning the pools resolves to a certain outcome. Even then (especially then!) the LPs should be allowed to withdraw their funds.

@maltekliemann
Copy link
Member Author

Thanks for the review, guys! 👍

@maltekliemann maltekliemann merged commit ba6efa8 into main Jul 18, 2022
@maltekliemann maltekliemann deleted the open-pool branch July 19, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:accepted This pull request is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants