-
Notifications
You must be signed in to change notification settings - Fork 611
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
Liquidity balancer pool PokeTokenWeights and params implementation #103
Conversation
Parse is pool changing weights from yaml directly
Something unforeseen thats needed is we will need some precision bounds on the weights in order to capture intermediate weights for small sized weights. My plan is to cap the size of user-provided weights at 2^20, then shift these internally to 2^50, giving 30 bits or ~9 decimal places of precision for natural weights to smoothly change over. This way, even if we switch to capping weights as being measured in uint64's, we can still support up to 2^13 = 8192 assets per pool. However, I'd like to do this in a follow-on PR after this one, for ease of review. I'll write the tests for PokeTokenWeights with already scaled weights for now. |
This PR is now completely ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks good.
But JoinSwapExternAmountIn
, ExitSwapShareAmountIn
, ExitSwapExternAmountOut
all gets affected by the weight so PokeTokenWeights
should be run first. Also, the results of the CalculateSpotPrice
, CalculateSpotPriceSansSwapFee
queries should consider LBP so I think PokeTokenWeights
should be run first. Maybe it’d be more convenient to run PokeTokenWeights
first and return the pool in GetPool()
.
This could also be good because queries probably want the latest weights as well |
Great idea! PokeTokenWeights has been moved to GetPool |
This PR is ready for review. The remaining TODO's should come in follow-on PRs.
Remove poolWeightsChanging from PoolAccount(Done, but was a change internal to this PR)