-
Notifications
You must be signed in to change notification settings - Fork 608
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
JoinPoolNoSwap simulation #3242
Conversation
This looks good to me. Can we change the name |
fixed minor mistakes, now ready for review @apollo-sturdy |
Hi. Thanks very much. I now had a chance to look at this. After more thought, this approach doesn't solve for our use case. The reason is that we currently have no way to know what to input to Given some amount of assets that we want to provide liquidity with via I should have noticed that @p0mvn's description of the requirements written here doesn't match what we need, since we don't know how to get the @p0mvn Do you have any suggestions how to solve this? One option would of course be to change the API of |
Hi @rusakh, did something change recently with the |
1ab5665
to
8a73512
Compare
f3aefe1
to
8c1842a
Compare
Hi @georgemc98. That is odd,
the error is:
|
I changed the |
oh, yes it did, thank you very much! I will continue working on it as soon as possible |
Thanks! I fixed the unit tests and I am going to write one additional test. I'll have it done in a few hours. |
@rusakh The test pass on my end and we are ready to merge. Should we change this from a Draft so it can start being reviewed? |
thank you @georgemc98, opened! |
Can we fix CI here? |
Co-authored-by: Roman <[email protected]>
Co-authored-by: Roman <[email protected]>
@@ -288,6 +288,29 @@ func (q Querier) CalcExitPoolCoinsFromShares(ctx context.Context, req *types.Que | |||
return &types.QueryCalcExitPoolCoinsFromSharesResponse{TokensOut: exitCoins}, nil | |||
} | |||
|
|||
// CalcJoinPoolNoSwapShares returns the amount of shares you'd get if joined a pool without a swap and tokens which need to be provided | |||
func (q Querier) CalcJoinPoolNoSwapShares(ctx context.Context, req *types.QueryCalcJoinPoolNoSwapSharesRequest) (*types.QueryCalcJoinPoolNoSwapSharesResponse, error) { |
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.
Can we please add this and your previous query to this test:
osmosis/x/gamm/client/cli/query_test.go
Line 26 in 0423e96
func (s *QueryTestSuite) TestQueriesNeverAlterState() { |
It ensures that queries don't alter state. This would be very useful for a stargate query
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.
Got it, I'll change this ASAP
} | ||
|
||
sdkCtx := sdk.UnwrapSDKContext(ctx) | ||
pool, err := q.GetPoolAndPoke(sdkCtx, req.PoolId) |
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.
This method calls PokePool()
which may update pool weights for a balancer pool. Is this acceptable for a stargate query?
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.
CC: @ValarDragon
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.
* autocli copy from cosmos * reset * save * SimJoinPoolNoSwap * docs * JoinPoolNoSwap simulation * more fixes * fix docs and name * fix: change tokens_in type * test: fix TestCalcJoinPoolNoSwapShares test * chore: remove whitespace Co-authored-by: Roman <[email protected]> * chore: change query name in comment Co-authored-by: Roman <[email protected]> * feat: build query.pb.go Co-authored-by: Ruslan Akhtariev <[email protected]> Co-authored-by: George McAskill <[email protected]> Co-authored-by: Roman <[email protected]> (cherry picked from commit fa2f483)
* autocli copy from cosmos * reset * save * SimJoinPoolNoSwap * docs * JoinPoolNoSwap simulation * more fixes * fix docs and name * fix: change tokens_in type * test: fix TestCalcJoinPoolNoSwapShares test * chore: remove whitespace Co-authored-by: Roman <[email protected]> * chore: change query name in comment Co-authored-by: Roman <[email protected]> * feat: build query.pb.go Co-authored-by: Ruslan Akhtariev <[email protected]> Co-authored-by: George McAskill <[email protected]> Co-authored-by: Roman <[email protected]> (cherry picked from commit fa2f483) Co-authored-by: Ruslan Akhtariev <[email protected]>
Closes: #2956 (actually this)
What is the purpose of the change
Adds a simulating query of JoinPoolNoSwap
Testing and Verifying
tests added
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? no