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

Fix prices for Coinmachine periods with no sales #3019

Merged
merged 15 commits into from
Dec 12, 2021
Merged

Conversation

area
Copy link
Member

@area area commented Dec 8, 2021

screenshot-2021-12-08_12-37-21

This PR updates the logic for calculating historical prices for coinmachine periods where no tokens have been sold. I've just lightly touched the maths rather than anything more radical, and as a result there are two wrinkles here that I have not solved, but for the majority of historical periods the prices are now correct.

  1. When calculating the price of periods prior to the first sale, I have assumed that the price is evolving and decays. That is not currently the case, but I believe is the intended behaviour. The 'correct' way to solve this is to look at the PriceEvolutionSet event on the contracts, which has a boolean argument to track whether the price is evolving or not.
  2. If no tokens have been sold yet, the historical prices will show as 0.

We can either fix these here (I suspect the second point, at least, needs to be fixed, with Raul's proposed solution the way to go), or elsewhere.

Resolves #3006
Resolves #2995
Resolves #2938
Resolves #2996
Resovles #3026

@rdig
Copy link
Member

rdig commented Dec 8, 2021

When calculating the price of periods prior to the first sale, I have assumed that the price is evolving and decays. That is not currently the case, but I believe is the intended behaviour. The 'correct' way to solve this is to look at the PriceEvolutionSet event on the contracts, which has a boolean argument to track whether the price is evolving or not.

I think we'll have to find a fix for this as well, but I really have no good idea on how

Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

Good to go!

Thank you @area for fixing my shitty math!

Copy link
Contributor

@ArmandoGraterol ArmandoGraterol left a comment

Choose a reason for hiding this comment

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

LGTM 👌

Copy link
Contributor

@chinins chinins left a comment

Choose a reason for hiding this comment

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

All good!

@rdig rdig assigned area and rdig Dec 11, 2021

Unverified

This user has not yet uploaded their public signing key.
@rdig rdig force-pushed the maint/coinmachine-prices branch from 7a96a51 to 49e8135 Compare December 11, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants