Skip to content

Commit

Permalink
complete
Browse files Browse the repository at this point in the history
  • Loading branch information
stackman27 committed Aug 12, 2022
1 parent 4521075 commit 3921b30
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions x/lockup/keeper/internal/events/emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (

// EmitLockToken returns a new event when user lock tokens.
func EmitLockToken(ctx sdk.Context, lock *types.PeriodLock) {
if ctx.EventManager() == nil {
return
}

ctx.EventManager().EmitEvents(sdk.Events{
lockTokenEvent(lock),
})
Expand All @@ -26,6 +30,10 @@ func lockTokenEvent(lock *types.PeriodLock) sdk.Event {

// EmitLockToken returns a new event when user lock tokens.
func EmitExtendLockToken(ctx sdk.Context, lock *types.PeriodLock) {
if ctx.EventManager() == nil {
return
}

ctx.EventManager().EmitEvents(sdk.Events{
extendLockTokenEvent(lock),
})
Expand All @@ -42,6 +50,10 @@ func extendLockTokenEvent(lock *types.PeriodLock) sdk.Event {

// EmitAddTokenToLock returns a new event when tokens are added to an existing lock.
func EmitAddTokenToLock(ctx sdk.Context, lockId uint64, owner, coins string) {
if ctx.EventManager() == nil {
return
}

ctx.EventManager().EmitEvents(sdk.Events{
addTokenToLockEvent(lockId, owner, coins),
})
Expand All @@ -58,6 +70,10 @@ func addTokenToLockEvent(lockId uint64, owner, coins string) sdk.Event {

// EmitBeginUnlockAll returns a new event when user beings unlocking for all the lock that the account has.
func EmitBeginUnlockAll(ctx sdk.Context, unlockedCoins, owner string) {
if ctx.EventManager() == nil {
return
}

ctx.EventManager().EmitEvents(sdk.Events{
beginUnlockAll(unlockedCoins, owner),
})
Expand All @@ -73,6 +89,10 @@ func beginUnlockAll(unlockedCoins, owner string) sdk.Event {

// EmitBeginUnlock returns a new event when user beings unlocking speficic lock.
func EmitBeginUnlock(ctx sdk.Context, lock *types.PeriodLock) {
if ctx.EventManager() == nil {
return
}

ctx.EventManager().EmitEvents(sdk.Events{
BeginUnlockEvent(lock),
})
Expand Down

0 comments on commit 3921b30

Please sign in to comment.