Skip to content

Commit

Permalink
rename function to positionHasUnderlyingLockInState
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Apr 10, 2023
1 parent 0edfe2b commit 3ff88f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func (k Keeper) IsLockMature(ctx sdk.Context, underlyingLockId uint64) (bool, er
return k.isLockMature(ctx, underlyingLockId)
}

func (k Keeper) DoesPositionHaveUnderlyingLockInState(ctx sdk.Context, positionId uint64) bool {
return k.doesPositionHaveUnderlyingLockInState(ctx, positionId)
func (k Keeper) PositionHasUnderlyingLockInState(ctx sdk.Context, positionId uint64) bool {
return k.positionHasUnderlyingLockInState(ctx, positionId)
}

// fees methods
Expand Down
2 changes: 1 addition & 1 deletion x/concentrated-liquidity/lp.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (k Keeper) withdrawPosition(ctx sdk.Context, owner sdk.AccAddress, position

// If underlying lock exists in state, validate unlocked conditions are met before withdrawing liquidity.
// If unlocked conditions are met, remove the link between the position and the underlying lock.
if k.doesPositionHaveUnderlyingLockInState(ctx, position.PositionId) {
if k.positionHasUnderlyingLockInState(ctx, position.PositionId) {
lockId, err := k.GetPositionIdToLock(ctx, positionId)
if err != nil {
return sdk.Int{}, sdk.Int{}, err
Expand Down
8 changes: 4 additions & 4 deletions x/concentrated-liquidity/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (k Keeper) SetPosition(ctx sdk.Context,

// Set the position ID to underlying lock ID mapping if underlyingLockId is provided.
key = types.KeyPositionIdForLock(positionId)
positionHasUnderlyingLock := k.doesPositionHaveUnderlyingLockInState(ctx, positionId)
positionHasUnderlyingLock := k.positionHasUnderlyingLockInState(ctx, positionId)
if !positionHasUnderlyingLock && underlyingLockId != 0 {
// We did not find an underlying lock ID, but one was provided. Set it.
store.Set(key, sdk.Uint64ToBigEndian(underlyingLockId))
Expand Down Expand Up @@ -399,7 +399,7 @@ func (k Keeper) validatePositionsAndGetTotalLiquidity(ctx sdk.Context, owner sdk
}

// Check that all the positions have no underlying lock that has not yet matured.
positionHasUnderlyingLock := k.doesPositionHaveUnderlyingLockInState(ctx, positionId)
positionHasUnderlyingLock := k.positionHasUnderlyingLockInState(ctx, positionId)
if positionHasUnderlyingLock {
underlyingLockId, err := k.GetPositionIdToLock(ctx, positionId)
if err != nil {
Expand Down Expand Up @@ -476,8 +476,8 @@ func (k Keeper) RemovePositionIdToLock(ctx sdk.Context, positionId uint64) {
store.Delete(key)
}

// doesPositionHaveUnderlyingLockInState checks if a given positionId has a corresponding lock in state.
func (k Keeper) doesPositionHaveUnderlyingLockInState(ctx sdk.Context, positionId uint64) bool {
// positionHasUnderlyingLockInState checks if a given positionId has a corresponding lock in state.
func (k Keeper) positionHasUnderlyingLockInState(ctx sdk.Context, positionId uint64) bool {
// Get the lock ID for the position.
_, err := k.GetPositionIdToLock(ctx, positionId)
return !errors.Is(err, types.PositionIdToLockNotFoundError{PositionId: positionId})
Expand Down

0 comments on commit 3ff88f7

Please sign in to comment.