Skip to content
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

perf(CL): Remove redundant collect incentives from withdraw logic #7747

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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