refactor: simplify epoch hooks (#21552)
This commit is contained in:
parent
3d0fba5768
commit
30688b02bd
@ -10,8 +10,6 @@ type EpochHooks interface {
|
||||
AfterEpochEnd(ctx context.Context, epochIdentifier string, epochNumber int64) error
|
||||
// new epoch is next block of epoch end block
|
||||
BeforeEpochStart(ctx context.Context, epochIdentifier string, epochNumber int64) error
|
||||
// Returns the name of the module implementing epoch hook.
|
||||
GetModuleName() string
|
||||
}
|
||||
|
||||
var _ EpochHooks = MultiEpochHooks{}
|
||||
@ -19,11 +17,6 @@ var _ EpochHooks = MultiEpochHooks{}
|
||||
// combine multiple gamm hooks, all hook functions are run in array sequence.
|
||||
type MultiEpochHooks []EpochHooks
|
||||
|
||||
// GetModuleName implements EpochHooks.
|
||||
func (MultiEpochHooks) GetModuleName() string {
|
||||
return ModuleName
|
||||
}
|
||||
|
||||
func NewMultiEpochHooks(hooks ...EpochHooks) MultiEpochHooks {
|
||||
return hooks
|
||||
}
|
||||
|
||||
@ -37,11 +37,6 @@ type dummyEpochHook struct {
|
||||
shouldError bool
|
||||
}
|
||||
|
||||
// GetModuleName implements types.EpochHooks.
|
||||
func (*dummyEpochHook) GetModuleName() string {
|
||||
return "dummy"
|
||||
}
|
||||
|
||||
func (hook *dummyEpochHook) AfterEpochEnd(ctx context.Context, epochIdentifier string, epochNumber int64) error {
|
||||
if hook.shouldError {
|
||||
return dummyErr
|
||||
|
||||
@ -8,11 +8,6 @@ import (
|
||||
|
||||
var _ epochstypes.EpochHooks = AppModule{}
|
||||
|
||||
// GetModuleName implements types.EpochHooks.
|
||||
func (am AppModule) GetModuleName() string {
|
||||
return am.Name()
|
||||
}
|
||||
|
||||
// BeforeEpochStart calls the mint function.
|
||||
func (am AppModule) BeforeEpochStart(ctx context.Context, epochIdentifier string, epochNumber int64) error {
|
||||
minter, err := am.keeper.Minter.Get(ctx)
|
||||
|
||||
@ -185,6 +185,7 @@ replace (
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/consensus => ../consensus
|
||||
cosmossdk.io/x/epochs => ../epochs
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
cosmossdk.io/x/tx => ../tx
|
||||
)
|
||||
|
||||
@ -16,8 +16,6 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
|
||||
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
|
||||
cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk=
|
||||
cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 h1:GuBrfHsK3RD5vlD4DuBz3DXslR6VlnzrYmHOC3L679Q=
|
||||
cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337/go.mod h1:PhLn1pMBilyRC4GfRkoYhm+XVAYhF4adVrzut8AdpJI=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user