Skip to content

Commit

Permalink
perf(CL): Remove redundant collect incentives from withdraw logic (#7747
Browse files Browse the repository at this point in the history
)

* remove redundant collect incentives from withdraw logic

* changelog
  • Loading branch information
AlpinYukseloglu authored Mar 15, 2024
1 parent ea86019 commit 5001247
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#7503](https://github.com/osmosis-labs/osmosis/pull/7503) Add IBC wasm light clients module
* [#7689](https://github.com/osmosis-labs/osmosis/pull/7689) Make CL price estimations not cause state writes (speed and gas improvements)
* [#7745](https://github.com/osmosis-labs/osmosis/pull/7745) Add gauge id query to stargate whitelist
* [#7747](https://github.com/osmosis-labs/osmosis/pull/7747) Remove redundant call to incentive collection in CL position withdrawal logic

## v23.0.6-iavl-v1 (contains everything in v23.0.6)

Expand Down
9 changes: 3 additions & 6 deletions x/concentrated-liquidity/lp.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,14 @@ func (k Keeper) WithdrawPosition(ctx sdk.Context, owner sdk.AccAddress, position
}

// If the requested liquidity amount to withdraw is equal to the available liquidity, delete the position from state.
// Ensure we collect any outstanding spread factors and incentives prior to deleting the position from state. This claiming
// process also clears position records from spread factor and incentive accumulators.
// Ensure we collect any outstanding spread factors prior to deleting the position from state. Outstanding incentives
// should already be fully claimed by this point. This claiming process also clears position records from spread factor
// and incentive accumulators.
if requestedLiquidityAmountToWithdraw.Equal(position.Liquidity) {
if _, err := k.collectSpreadRewards(ctx, owner, positionId); err != nil {
return osmomath.Int{}, osmomath.Int{}, err
}

if _, _, err := k.collectIncentives(ctx, owner, positionId); err != nil {
return osmomath.Int{}, osmomath.Int{}, err
}

if err := k.deletePosition(ctx, positionId, owner, position.PoolId); err != nil {
return osmomath.Int{}, osmomath.Int{}, err
}
Expand Down

0 comments on commit 5001247

Please sign in to comment.