Skip to content

Commit

Permalink
lock and unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed Jan 15, 2024
1 parent d3d4bf1 commit f4e9de3
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 80 deletions.
4 changes: 2 additions & 2 deletions proto/multistaking/v1/multi_staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ message MultiStakingLock {
option (gogoproto.goproto_getters) = false;
// option (gogoproto.goproto_stringer) = false;

LockID lockID = 1;
LockID lockID = 1 [ (gogoproto.nullable) = false ];

MultiStakingCoin locked_coin = 2 [ (gogoproto.nullable) = false ];
};
Expand All @@ -50,7 +50,7 @@ message MultiStakingUnlock {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

UnlockID unlockID = 1;
UnlockID unlockID = 1 [ (gogoproto.nullable) = false ];

repeated UnlockEntry entries = 2 [ (gogoproto.nullable) = false ];
}
Expand Down
2 changes: 1 addition & 1 deletion testing/simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func genesisStateWithValSet(app *SimApp, genesisState GenesisState, valSet *tmty
})

lockId := multistakingtypes.MultiStakingLockID(genAcc.GetAddress().String(), sdk.ValAddress(val.Address).String())
lockRecord := multistakingtypes.NewMultiStakingLock(&lockId, valMsCoin)
lockRecord := multistakingtypes.NewMultiStakingLock(lockId, valMsCoin)

locks = append(locks, lockRecord)
lockCoins = lockCoins.Add(valMsCoin.ToCoin())
Expand Down
2 changes: 1 addition & 1 deletion x/multi-staking/keeper/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func (k Keeper) GetOrCreateMultiStakingLock(ctx sdk.Context, lockID types.LockID) types.MultiStakingLock {
multiStakingLock, found := k.GetMultiStakingLock(ctx, lockID)
if !found {
multiStakingLock = types.NewMultiStakingLock(&lockID, types.MultiStakingCoin{Amount: sdk.ZeroInt()})
multiStakingLock = types.NewMultiStakingLock(lockID, types.MultiStakingCoin{Amount: sdk.ZeroInt()})
}
return multiStakingLock
}
Expand Down
2 changes: 1 addition & 1 deletion x/multi-staking/keeper/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (k Keeper) GetMultiStakingLock(ctx sdk.Context, multiStakingLockID types.Lo

func (k Keeper) SetMultiStakingLock(ctx sdk.Context, multiStakingLock types.MultiStakingLock) {
if multiStakingLock.IsEmpty() {
k.RemoveMultiStakingLock(ctx, *multiStakingLock.LockID)
k.RemoveMultiStakingLock(ctx, multiStakingLock.LockID)
return
}

Expand Down
2 changes: 1 addition & 1 deletion x/multi-staking/types/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

func NewMultiStakingLock(lockID *LockID, lockedCoin MultiStakingCoin) MultiStakingLock {
func NewMultiStakingLock(lockID LockID, lockedCoin MultiStakingCoin) MultiStakingLock {
return MultiStakingLock{
LockID: lockID,
LockedCoin: lockedCoin,
Expand Down
134 changes: 60 additions & 74 deletions x/multi-staking/types/multi_staking.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4e9de3

Please sign in to comment.