-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
113 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package types | ||
|
||
import sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
type GammHooks interface { | ||
AfterPoolCreated(ctx sdk.Context, poolId uint64) | ||
} | ||
|
||
// combine multiple gamm hooks, all hook functions are run in array sequence | ||
type MultiGammHooks []GammHooks | ||
|
||
func NewMultiGammHooks(hooks ...GammHooks) MultiGammHooks { | ||
return hooks | ||
} | ||
|
||
func (h MultiGammHooks) AfterPoolCreated(ctx sdk.Context, poolId uint64) { | ||
for i := range h { | ||
h[i].AfterPoolCreated(ctx, poolId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package types | ||
|
||
import ( | ||
"time" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
type LockupHooks interface { | ||
OnTokenLocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time) | ||
OnTokenUnlocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time) | ||
} | ||
|
||
var _ LockupHooks = MultiLockupHooks{} | ||
|
||
// combine multiple gamm hooks, all hook functions are run in array sequence | ||
type MultiLockupHooks []LockupHooks | ||
|
||
func NewMultiLockupHooks(hooks ...LockupHooks) MultiLockupHooks { | ||
return hooks | ||
} | ||
|
||
func (h MultiLockupHooks) OnTokenLocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time) { | ||
for i := range h { | ||
h[i].OnTokenLocked(ctx, address, lockID, amount, lockDuration, unlockTime) | ||
} | ||
} | ||
|
||
func (h MultiLockupHooks) OnTokenUnlocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time) { | ||
for i := range h { | ||
h[i].OnTokenUnlocked(ctx, address, lockID, amount, lockDuration, unlockTime) | ||
} | ||
} |