-
Notifications
You must be signed in to change notification settings - Fork 599
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
proposal(twap): consider using last spot price instead of zero on error in getSpotPrices
#2689
Comments
I agree with switching to last spot price as this causes TWAPs to level out and stay stable after an error, which is the property that I believe we wanted to protect by leaving TWAPs open after spot price errors |
Let me think about the possible edge case here, is it going to error when the pool does not have the last spot price? By last spot price, are we referring to the spot price recorded in the previous epoch? |
Assume that we have a twap record at time Currently, we would set the spot price to 0 at Instead of setting it to zero, we might want to reuse the spot price from the previous record (at time ``t`) One edge case I can think of is when we get an error but there is no older record. I don't think it should be hard to implement the change. I will try getting it out before Monday to further discuss |
If this is the case, I'm definitely for what this issue is proposing! (I wonder if we have a test case showing that rn) |
Decided on the call that this is not v12 blocking but good to have in the future releases |
Background
Context:
osmosis/x/twap/logic.go
Lines 46 to 54 in 4bbd3fb
I think this is a worthwhile improvement to make before v12.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: