Skip to content

Commit

Permalink
feat(gamm): CalcJoinPoolShares and CalcExitPoolCoinsFromShares queries (
Browse files Browse the repository at this point in the history
#2972)

* JoinSwapExactAmountIn query

* ExitSwapShareAmountIn query

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* JoinSwapExactAmountIn, ExitSwapShareAmountIn queries

* save

* test: finish CalcJoinPoolShares query test

* tests for CalcExitPoolCoinsFromShares

* tests for CalcExitPoolCoinsFromShares

* test: add additional exit coin tests

* Update x/gamm/keeper/grpc_query.go

Co-authored-by: Aleksandr Bezobchuk <[email protected]>

* Update x/gamm/keeper/grpc_query.go

Co-authored-by: Aleksandr Bezobchuk <[email protected]>

* Update x/gamm/keeper/grpc_query.go

Co-authored-by: Aleksandr Bezobchuk <[email protected]>

* queries

* docs fix

* chore: generate protobuf files

* feat: remove TokensOutDenoms, fix typos

* Update x/gamm/keeper/grpc_query_test.go

Co-authored-by: Ruslan Akhtariev <[email protected]>
Co-authored-by: George McAskill <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
(cherry picked from commit 94534da)

# Conflicts:
#	CHANGELOG.md
#	x/gamm/keeper/grpc_query.go
#	x/gamm/keeper/grpc_query_test.go
#	x/gamm/types/query.pb.go
  • Loading branch information
pysel authored and mergify[bot] committed Nov 14, 2022
1 parent a53b5b7 commit 3937357
Show file tree
Hide file tree
Showing 4 changed files with 761 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Features

* [#2788](https://github.com/osmosis-labs/osmosis/pull/2788) Add logarithm base 2 implementation.
<<<<<<< HEAD
* [#2739](https://github.com/osmosis-labs/osmosis/pull/2739),[#3356](https://github.com/osmosis-labs/osmosis/pull/3356) Add pool type query, and add it to stargate whitelist
* [#2956](https://github.com/osmosis-labs/osmosis/issues/2956) Add queries for calculating amount of shares/tokens you get by providing X tokens/shares when entering/exiting a pool
* [#3313](https://github.com/osmosis-labs/osmosis/pull/3313) Upgrade to IBC v3.4.0, allowing for IBC transfers with metadata.
Expand All @@ -53,6 +54,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- This PR adds v2 queries for doing the correct thing, and giving people time to migrate from v1beta1 queries to v2.
- It also changes cosmwasm to only allow the v2 queries, as no contracts on Osmosis mainnet uses the v1beta1 queries.

=======
* [#2739](https://github.com/osmosis-labs/osmosis/pull/2739) Add pool type query
* [#2956](https://github.com/osmosis-labs/osmosis/issues/2956) Add queries for calculating amount of shares/tokens you get by providing X tokens/shares when entering/exiting a pool
>>>>>>> 94534da0 (feat(gamm): CalcJoinPoolShares and CalcExitPoolCoinsFromShares queries (#2972))
### Bug fixes

Expand Down
3 changes: 3 additions & 0 deletions x/gamm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func (q Querier) CalcJoinPoolShares(ctx context.Context, req *types.QueryCalcJoi
}, nil
}

<<<<<<< HEAD
// PoolsWithFilter query allows to query pools with specific parameters
func (q Querier) PoolsWithFilter(ctx context.Context, req *types.QueryPoolsWithFilterRequest) (*types.QueryPoolsWithFilterResponse, error) {
res, err := q.Pools(ctx, &types.QueryPoolsRequest{
Expand Down Expand Up @@ -261,6 +262,8 @@ func (q Querier) PoolsWithFilter(ctx context.Context, req *types.QueryPoolsWithF
}, nil
}

=======
>>>>>>> 94534da0 (feat(gamm): CalcJoinPoolShares and CalcExitPoolCoinsFromShares queries (#2972))
// CalcExitPoolCoinsFromShares queries the amount of tokens you get by exiting a specific amount of shares
func (q Querier) CalcExitPoolCoinsFromShares(ctx context.Context, req *types.QueryCalcExitPoolCoinsFromSharesRequest) (*types.QueryCalcExitPoolCoinsFromSharesResponse, error) {
if req == nil {
Expand Down
3 changes: 3 additions & 0 deletions x/gamm/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (suite *KeeperTestSuite) TestCalcExitPoolCoinsFromShares() {
})
}
}
<<<<<<< HEAD

func (suite *KeeperTestSuite) TestPoolsWithFilter() {
var (
Expand Down Expand Up @@ -261,6 +262,8 @@ func (suite *KeeperTestSuite) TestPoolsWithFilter() {

}

=======
>>>>>>> 94534da0 (feat(gamm): CalcJoinPoolShares and CalcExitPoolCoinsFromShares queries (#2972))
func (suite *KeeperTestSuite) TestCalcJoinPoolShares() {
queryClient := suite.queryClient
ctx := suite.Ctx
Expand Down
Loading

0 comments on commit 3937357

Please sign in to comment.