Skip to content

Commit

Permalink
chore: add currSqrtPrice to LiquidityNetInDirection return value (bac…
Browse files Browse the repository at this point in the history
…kport #6692) (#6693)

* chore: add currSqrtPrice to LiquidityNetInDirection return value (#6692)

* add cur sqrt price to return

* add changelog entry

(cherry picked from commit c06f809)

# Conflicts:
#	x/concentrated-liquidity/client/queryproto/query.pb.go

* Generated protofile changes

---------

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
3 people authored Oct 13, 2023
1 parent 73be89f commit 057a0dc
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 148 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#6644](https://github.com/osmosis-labs/osmosis/pull/6644) fix: genesis bug in pool incentives linking NoLock gauges and PoolIDs
* [#6666](https://github.com/osmosis-labs/osmosis/pull/6666) fix: cosmwasmpool state export bug
* [#6674](https://github.com/osmosis-labs/osmosis/pull/6674) fix: remove dragonberry replace directive
* [#6692](https://github.com/osmosis-labs/osmosis/pull/6692) chore: add cur sqrt price to LiquidityNetInDirection return value

## v19.2.0

Expand Down
6 changes: 6 additions & 0 deletions proto/osmosis/concentrated-liquidity/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ message LiquidityNetInDirectionResponse {
(gogoproto.moretags) = "yaml:\"current_liquidity\"",
(gogoproto.nullable) = false
];
string current_sqrt_price = 4 [

(gogoproto.customtype) = "github.com/osmosis-labs/osmosis/osmomath.BigDec",
(gogoproto.moretags) = "yaml:\"current_sqrt_price\"",
(gogoproto.nullable) = false
];
}

//=============================== LiquidityPerTickRange
Expand Down
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/client/query_proto_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (q Querier) LiquidityPerTickRange(ctx sdk.Context, req clquery.LiquidityPer
return &clquery.LiquidityPerTickRangeResponse{Liquidity: liquidity}, nil
}

// LiquidityNetInDirection returns an array of LiquidityDepthWithRange, which contains the range(lower tick and upper tick) and the liquidity amount in the range.
// LiquidityNetInDirection returns an array of LiquidityDepthWithRange, which contains the range(lower tick and upper tick), the liquidity amount in the range, and current sqrt price.
func (q Querier) LiquidityNetInDirection(ctx sdk.Context, req clquery.LiquidityNetInDirectionRequest) (*clquery.LiquidityNetInDirectionResponse, error) {
if req.TokenIn == "" {
return nil, status.Error(codes.InvalidArgument, "tokenIn is empty")
Expand Down Expand Up @@ -156,7 +156,7 @@ func (q Querier) LiquidityNetInDirection(ctx sdk.Context, req clquery.LiquidityN
return nil, err
}

return &clquery.LiquidityNetInDirectionResponse{LiquidityDepths: liquidityDepths, CurrentLiquidity: pool.GetLiquidity(), CurrentTick: pool.GetCurrentTick()}, nil
return &clquery.LiquidityNetInDirectionResponse{LiquidityDepths: liquidityDepths, CurrentLiquidity: pool.GetLiquidity(), CurrentTick: pool.GetCurrentTick(), CurrentSqrtPrice: pool.GetCurrentSqrtPrice()}, nil
}

func (q Querier) ClaimableSpreadRewards(ctx sdk.Context, req clquery.ClaimableSpreadRewardsRequest) (*clquery.ClaimableSpreadRewardsResponse, error) {
Expand Down
Loading

0 comments on commit 057a0dc

Please sign in to comment.