Skip to content

Commit

Permalink
rename lockNoSend back to lock
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed May 19, 2023
1 parent c59c387 commit d1c7b6f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions x/lockup/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func (k Keeper) GetCoinsFromLocks(locks []types.PeriodLock) sdk.Coins {
return k.getCoinsFromLocks(locks)
}

func (k Keeper) LockNoSend(ctx sdk.Context, lock types.PeriodLock, tokensToLock sdk.Coins) error {
return k.lockNoSend(ctx, lock, tokensToLock)
func (k Keeper) Lock(ctx sdk.Context, lock types.PeriodLock, tokensToLock sdk.Coins) error {
return k.lock(ctx, lock, tokensToLock)
}

func (k Keeper) UnlockMaturedLockInternalLogic(ctx sdk.Context, lock types.PeriodLock) error {
Expand Down
8 changes: 4 additions & 4 deletions x/lockup/keeper/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (k Keeper) AddTokensToLockByID(ctx sdk.Context, lockID uint64, owner sdk.Ac
return nil, err
}

err = k.lockNoSend(ctx, *lock, sdk.NewCoins(tokensToAdd))
err = k.lock(ctx, *lock, sdk.NewCoins(tokensToAdd))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (k Keeper) CreateLockNoSend(ctx sdk.Context, owner sdk.AccAddress, coins sd
lock := types.NewPeriodLock(ID, owner, duration, time.Time{}, coins)

// lock the coins without sending them to the lockup module account
err := k.lockNoSend(ctx, lock, lock.Coins)
err := k.lock(ctx, lock, lock.Coins)
if err != nil {
return lock, err
}
Expand All @@ -162,13 +162,13 @@ func (k Keeper) CreateLockNoSend(ctx sdk.Context, owner sdk.AccAddress, coins sd
return lock, nil
}

// lockNoSend is an internal utility to lock coins and set corresponding states.
// lock is an internal utility to lock coins and set corresponding states.
// This is only called by either of the two possible entry points to lock tokens.
// 1. CreateLock
// 2. AddTokensToLockByID
// WARNING: this method does not send the underlying coins to the lockup module account.
// This must be done by the caller.
func (k Keeper) lockNoSend(ctx sdk.Context, lock types.PeriodLock, tokensToLock sdk.Coins) error {
func (k Keeper) lock(ctx sdk.Context, lock types.PeriodLock, tokensToLock sdk.Coins) error {
owner, err := sdk.AccAddressFromBech32(lock.Owner)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions x/lockup/keeper/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ func (suite *KeeperTestSuite) TestLockNoSend() {
}

// test locking without balance (should work since we don't send the underlying balance)
err := suite.App.LockupKeeper.LockNoSend(suite.Ctx, lock, coins)
err := suite.App.LockupKeeper.Lock(suite.Ctx, lock, coins)
suite.Require().NoError(err)

// check accumulation store
Expand All @@ -785,7 +785,7 @@ func (suite *KeeperTestSuite) TestLockNoSend() {
suite.Require().Equal(accum.String(), "10")

suite.FundAcc(addr1, coins)
err = suite.App.LockupKeeper.LockNoSend(suite.Ctx, lock, coins)
err = suite.App.LockupKeeper.Lock(suite.Ctx, lock, coins)
suite.Require().NoError(err)

// check accumulation store
Expand Down

0 comments on commit d1c7b6f

Please sign in to comment.