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

Let markets open their pools when they start #711

Merged
merged 40 commits into from
Aug 2, 2022
Merged

Conversation

maltekliemann
Copy link
Member

@maltekliemann maltekliemann commented Jul 16, 2022

This is a pull request very similar to #651, but we're dealing with opening markets instead of closing them. It is based on #695, which implements opening of pools. It fixes #691.

A couple of quick points:

  • When a market reaches it's starting point (either block or time frame) and it has a CPMM pool, then that pool is opened. Opening a market currently has no other effect. In particular, I've not introduced a MarketOpen event, etc.
  • It's debatable whether or not markets should also get an Initialized state. I don't think so, as it is currently no different from Active.
  • I took another look into the chain-stalling bug. It seems that the timestamp is set sometime during block 1 using an inherent extrinsic, so during on_initialize of block 1, the timestamp is still not set. So I'm now checking for for block number less or equal to <=1. This led to a lot of reorganizing in the tests.
  • This PR also introduces a compensation for now() lagging one block behind during on_initialize. This led to more reorganizing in the tests.

@maltekliemann maltekliemann added s:in-progress The pull requests is currently being worked on s:on-hold Work on the pull request has been paused and removed s:in-progress The pull requests is currently being worked on labels Jul 16, 2022
@maltekliemann maltekliemann self-assigned this Jul 16, 2022
@maltekliemann maltekliemann added this to the v0.3.5 milestone Jul 17, 2022
@maltekliemann maltekliemann added s:in-progress The pull requests is currently being worked on and removed s:on-hold Work on the pull request has been paused labels Jul 18, 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 19, 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.

This PR allows to activate markets automatically in the future. Impactful 👍 !

zrml/prediction-markets/src/lib.rs Show resolved Hide resolved
zrml/prediction-markets/src/lib.rs Show resolved Hide resolved
zrml/prediction-markets/src/lib.rs Show resolved Hide resolved
zrml/prediction-markets/src/lib.rs Show resolved Hide resolved
zrml/swaps/src/lib.rs Outdated Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Outdated Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Outdated Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Show resolved Hide resolved
@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 26, 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 26, 2022
Copy link
Member

@sea212 sea212 left a comment

Choose a reason for hiding this comment

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

Looks good 👍

zrml/prediction-markets/src/migrations.rs Outdated Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Outdated Show resolved Hide resolved
zrml/prediction-markets/src/migrations.rs Outdated Show resolved Hide resolved
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.

.

@maltekliemann maltekliemann added s:accepted This pull request is ready for merge and removed s:review-needed The pull request requires reviews labels Aug 2, 2022
@maltekliemann maltekliemann merged commit dffd0e9 into main Aug 2, 2022
@maltekliemann maltekliemann deleted the mkl-open-market branch August 2, 2022 08:06
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.

Markets open even if period.start lies in the future
3 participants