-
Notifications
You must be signed in to change notification settings - Fork 364
/
hooks.go
53 lines (44 loc) · 1.49 KB
/
hooks.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package types
import sdk "github.com/cosmos/cosmos-sdk/types"
// MultiHARDHooks combine multiple HARD hooks, all hook functions are run in array sequence
type MultiHARDHooks []HARDHooks
// NewMultiHARDHooks returns a new MultiHARDHooks
func NewMultiHARDHooks(hooks ...HARDHooks) MultiHARDHooks {
return hooks
}
// AfterDepositCreated runs after a deposit is created
func (h MultiHARDHooks) AfterDepositCreated(ctx sdk.Context, deposit Deposit) {
for i := range h {
h[i].AfterDepositCreated(ctx, deposit)
}
}
// BeforeDepositModified runs before a deposit is modified
func (h MultiHARDHooks) BeforeDepositModified(ctx sdk.Context, deposit Deposit) {
for i := range h {
h[i].BeforeDepositModified(ctx, deposit)
}
}
// AfterDepositModified runs after a deposit is modified
func (h MultiHARDHooks) AfterDepositModified(ctx sdk.Context, deposit Deposit) {
for i := range h {
h[i].AfterDepositModified(ctx, deposit)
}
}
// AfterBorrowCreated runs after a borrow is created
func (h MultiHARDHooks) AfterBorrowCreated(ctx sdk.Context, borrow Borrow) {
for i := range h {
h[i].AfterBorrowCreated(ctx, borrow)
}
}
// BeforeBorrowModified runs before a borrow is modified
func (h MultiHARDHooks) BeforeBorrowModified(ctx sdk.Context, borrow Borrow) {
for i := range h {
h[i].BeforeBorrowModified(ctx, borrow)
}
}
// AfterBorrowModified runs after a borrow is modified
func (h MultiHARDHooks) AfterBorrowModified(ctx sdk.Context, borrow Borrow) {
for i := range h {
h[i].AfterBorrowModified(ctx, borrow)
}
}