-
Notifications
You must be signed in to change notification settings - Fork 47
/
hooks_stable_stake.go
39 lines (31 loc) · 1018 Bytes
/
hooks_stable_stake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package keeper
import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
stablestaketypes "github.com/elys-network/elys/x/stablestake/types"
)
func (k Keeper) AfterBond(ctx sdk.Context, sender string, shareAmount math.Int) error {
k.RetreiveAllPortfolio(ctx, sender)
return nil
}
func (k Keeper) AfterUnbond(ctx sdk.Context, sender string, shareAmount math.Int) error {
k.RetreiveAllPortfolio(ctx, sender)
return nil
}
// Hooks wrapper struct for incentive keeper
type StableStakeHooks struct {
k Keeper
}
var _ stablestaketypes.StableStakeHooks = StableStakeHooks{}
// Return the wrapper struct
func (k Keeper) StableStakeHooks() StableStakeHooks {
return StableStakeHooks{k}
}
func (h StableStakeHooks) AfterBond(ctx sdk.Context, sender string, shareAmount math.Int) error {
h.k.AfterBond(ctx, sender, shareAmount)
return nil
}
func (h StableStakeHooks) AfterUnbond(ctx sdk.Context, sender string, shareAmount math.Int) error {
h.k.AfterUnbond(ctx, sender, shareAmount)
return nil
}